X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java index 0ab7de9..4c295b7 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaModelManager.java @@ -39,10 +39,10 @@ import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; import net.sourceforge.phpdt.core.IWorkingCopy; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; -import net.sourceforge.phpeclipse.builder.PHPBuilder; +import net.sourceforge.phpdt.internal.core.builder.PHPBuilder; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; @@ -248,13 +248,13 @@ public class JavaModelManager implements ISaveParticipant { int type = resource.getType(); switch (type) { case IResource.PROJECT : - return PHPCore.create((IProject) resource); + return JavaCore.create((IProject) resource); case IResource.FILE : return create((IFile) resource, project); case IResource.FOLDER : return create((IFolder) resource, project); case IResource.ROOT : - return PHPCore.create((IWorkspaceRoot) resource); + return JavaCore.create((IWorkspaceRoot) resource); default : return null; } @@ -280,7 +280,7 @@ public class JavaModelManager implements ISaveParticipant { return null; } if (project == null) { - project = PHPCore.create(file.getProject()); + project = JavaCore.create(file.getProject()); } if (file.getFileExtension() != null) { @@ -311,7 +311,7 @@ public class JavaModelManager implements ISaveParticipant { return null; } if (project == null) { - project = PHPCore.create(folder.getProject()); + project = JavaCore.create(folder.getProject()); } IJavaElement element = determineIfOnClasspath(folder, project); if (conflictsWithOutputLocation(folder.getFullPath(), (JavaProject)project) @@ -355,7 +355,7 @@ public class JavaModelManager implements ISaveParticipant { if (file == null) return null; if (project == null) { - project = PHPCore.create(file.getProject()); + project = JavaCore.create(file.getProject()); } IPackageFragment pkg = (IPackageFragment) determineIfOnClasspath(file, project); if (pkg == null) { @@ -540,7 +540,7 @@ public class JavaModelManager implements ISaveParticipant { this.project = project; } } - public static boolean VERBOSE = false; + public static boolean VERBOSE = true; public static boolean CP_RESOLVE_VERBOSE = false; public static boolean ZIP_ACCESS_VERBOSE = false; @@ -655,7 +655,7 @@ public class JavaModelManager implements ISaveParticipant { * Configure the plugin with respect to option settings defined in ".options" file */ public void configurePluginDebugOptions(){ - if(PHPCore.getPlugin().isDebugging()){ + if(JavaCore.getPlugin().isDebugging()){ // TODO khartlage temp-del String option = Platform.getDebugOption(BUILDER_DEBUG); // if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$ @@ -1000,7 +1000,7 @@ public class JavaModelManager implements ISaveParticipant { JavaModelManager.PerProjectInfo info = getPerProjectInfo(project, false /* don't create info */); if (info == null) { if (!JavaProject.hasJavaNature(project)) { - throw ((JavaProject)PHPCore.create(project)).newNotPresentException(); + throw ((JavaProject)JavaCore.create(project)).newNotPresentException(); } info = getPerProjectInfo(project, true /* create info */); } @@ -1012,7 +1012,7 @@ public class JavaModelManager implements ISaveParticipant { */ public static String[] getRegisteredVariableNames(){ - Plugin jdtCorePlugin = PHPCore.getPlugin(); + Plugin jdtCorePlugin = JavaCore.getPlugin(); if (jdtCorePlugin == null) return null; ArrayList variableList = new ArrayList(5); @@ -1062,7 +1062,7 @@ public class JavaModelManager implements ISaveParticipant { */ private File getSerializationFile(IProject project) { if (!project.exists()) return null; - IPluginDescriptor descr= PHPCore.getJavaCore().getDescriptor(); + IPluginDescriptor descr= JavaCore.getJavaCore().getDescriptor(); IPath workingLocation= project.getPluginWorkingLocation(descr); return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$ } @@ -1094,18 +1094,18 @@ public class JavaModelManager implements ISaveParticipant { } else { // internal resource (not an IFile or not existing) IPath location; if (file.getType() != IResource.FILE || (location = file.getLocation()) == null) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } fileSystemPath= location.toOSString(); } } else if (!path.isAbsolute()) { file= root.getFile(path); if (file == null || file.getType() != IResource.FILE) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } IPath location = file.getLocation(); if (location == null) { - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$ } fileSystemPath= location.toOSString(); } else { @@ -1122,7 +1122,7 @@ public class JavaModelManager implements ISaveParticipant { } return zipFile; } catch (IOException e) { - throw new CoreException(new Status(Status.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$ + throw new CoreException(new Status(Status.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$ } } } @@ -1297,22 +1297,21 @@ public class JavaModelManager implements ISaveParticipant { DataInputStream in= new DataInputStream(new BufferedInputStream(new FileInputStream(file))); try { String pluginID= in.readUTF(); - if (!pluginID.equals(PHPCore.PLUGIN_ID)) + if (!pluginID.equals(JavaCore.PLUGIN_ID)) throw new IOException(Util.bind("build.wrongFileFormat")); //$NON-NLS-1$ String kind= in.readUTF(); if (!kind.equals("STATE")) //$NON-NLS-1$ throw new IOException(Util.bind("build.wrongFileFormat")); //$NON-NLS-1$ if (in.readBoolean()) return PHPBuilder.readState(project, in); -// TODO khartlage temp-del -// if (JavaBuilder.DEBUG) -// System.out.println("Saved state thinks last build failed for " + project.getName()); //$NON-NLS-1$ + if (PHPBuilder.DEBUG) + System.out.println("Saved state thinks last build failed for " + project.getName()); //$NON-NLS-1$ } finally { in.close(); } } catch (Exception e) { e.printStackTrace(); - throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$ + throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$ } } return null; @@ -1446,15 +1445,15 @@ public class JavaModelManager implements ISaveParticipant { * Saves the built state for the project. */ private void saveBuiltState(PerProjectInfo info) throws CoreException { -// if (JavaBuilder.DEBUG) -// System.out.println(Util.bind("build.saveStateProgress", info.project.getName())); //$NON-NLS-1$ + if (PHPBuilder.DEBUG) + System.out.println(Util.bind("build.saveStateProgress", info.project.getName())); //$NON-NLS-1$ File file = getSerializationFile(info.project); if (file == null) return; long t = System.currentTimeMillis(); try { DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); try { - out.writeUTF(PHPCore.PLUGIN_ID); + out.writeUTF(JavaCore.PLUGIN_ID); out.writeUTF("STATE"); //$NON-NLS-1$ if (info.savedState == null) { out.writeBoolean(false); @@ -1468,18 +1467,18 @@ public class JavaModelManager implements ISaveParticipant { } catch (RuntimeException e) { try {file.delete();} catch(SecurityException se) {} throw new CoreException( - new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, + new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$ } catch (IOException e) { try {file.delete();} catch(SecurityException se) {} throw new CoreException( - new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, + new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$ } -// if (JavaBuilder.DEBUG) { -// t = System.currentTimeMillis() - t; -// System.out.println(Util.bind("build.saveStateComplete", String.valueOf(t))); //$NON-NLS-1$ -// } + if (PHPBuilder.DEBUG) { + t = System.currentTimeMillis() - t; + System.out.println(Util.bind("build.saveStateComplete", String.valueOf(t))); //$NON-NLS-1$ + } } /** @@ -1509,7 +1508,7 @@ public class JavaModelManager implements ISaveParticipant { if (vStats != null) { IStatus[] stats= new IStatus[vStats.size()]; vStats.toArray(stats); - throw new CoreException(new MultiStatus(PHPCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$ + throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$ } } @@ -1521,7 +1520,7 @@ public class JavaModelManager implements ISaveParticipant { // optional behaviour // possible value of index 0 is Compute - if (!PHPCore.COMPUTE.equals(PHPCore.getOption(PHPCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level + if (!JavaCore.COMPUTE.equals(JavaCore.getOption(JavaCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level if (javaBuildOrder == null || javaBuildOrder.length <= 1) return; @@ -1662,11 +1661,11 @@ public class JavaModelManager implements ISaveParticipant { if (variablePath == JavaModelManager.VariableInitializationInProgress){ return; } - Preferences preferences = PHPCore.getPlugin().getPluginPreferences(); + Preferences preferences = JavaCore.getPlugin().getPluginPreferences(); String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName; String variableString = variablePath == null ? CP_ENTRY_IGNORE : variablePath.toString(); preferences.setDefault(variableKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones preferences.setValue(variableKey, variableString); - PHPCore.getPlugin().savePluginPreferences(); + JavaCore.getPlugin().savePluginPreferences(); } }