X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java index a634464..21777c4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProject.java @@ -36,6 +36,7 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import net.sourceforge.phpdt.core.IClasspathEntry; +import net.sourceforge.phpdt.core.ICompilationUnit; import net.sourceforge.phpdt.core.IJavaElement; import net.sourceforge.phpdt.core.IJavaModelMarker; import net.sourceforge.phpdt.core.IJavaModelStatus; @@ -43,19 +44,25 @@ import net.sourceforge.phpdt.core.IJavaModelStatusConstants; import net.sourceforge.phpdt.core.IJavaProject; import net.sourceforge.phpdt.core.IPackageFragment; import net.sourceforge.phpdt.core.IPackageFragmentRoot; +import net.sourceforge.phpdt.core.JavaCore; import net.sourceforge.phpdt.core.JavaModelException; +import net.sourceforge.phpdt.core.WorkingCopyOwner; import net.sourceforge.phpdt.internal.codeassist.ISearchableNameEnvironment; import net.sourceforge.phpdt.internal.compiler.util.ObjectVector; +import net.sourceforge.phpdt.internal.core.util.Util; import net.sourceforge.phpdt.internal.corext.Assert; import net.sourceforge.phpeclipse.LoadPathEntry; -import net.sourceforge.phpeclipse.PHPCore; import net.sourceforge.phpeclipse.PHPeclipsePlugin; -import org.apache.xerces.dom.DocumentImpl; -import org.apache.xml.serialize.Method; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.Serializer; -import org.apache.xml.serialize.SerializerFactory; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; @@ -73,6 +80,8 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.QualifiedName; +import net.sourceforge.phpdt.internal.core.ClasspathEntry; +import net.sourceforge.phpdt.internal.core.XMLWriter; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -119,7 +128,7 @@ public class JavaProject /** * The platform project this IJavaProject is based on */ - protected IProject fProject; + protected IProject project; protected List fLoadPathEntries; protected boolean fScratched; @@ -221,15 +230,15 @@ public class JavaProject /** * Constructor needed for IProject.getNature() and IProject.addNature(). * - * @see #setProject + * @see #setProject(IProject) */ public JavaProject() { - super(JAVA_PROJECT, null, null); + super(null, null); } - public JavaProject(IProject project, IJavaElement parent) { - super(JAVA_PROJECT, parent, project.getName()); - fProject = project; + public JavaProject(IProject project, JavaElement parent) { + super(parent, project.getName()); + this.project = project; } public void addLoadPathEntry(IProject anotherPHPProject) { fScratched = true; @@ -240,7 +249,7 @@ public class JavaProject public void configure() throws CoreException { // get project description and then the associated build commands - IProjectDescription desc = fProject.getDescription(); + IProjectDescription desc = project.getDescription(); ICommand[] commands = desc.getBuildSpec(); // determine if builder already associated @@ -262,7 +271,7 @@ public class JavaProject System.arraycopy(commands, 0, newCommands, 1, commands.length); newCommands[0] = command; desc.setBuildSpec(newCommands); - fProject.setDescription(desc, null); + project.setDescription(desc, null); } } @@ -333,7 +342,7 @@ public class JavaProject } protected IFile getLoadPathEntriesFile() { - return fProject.getFile(".loadpath"); + return project.getFile(".loadpath"); } protected String getLoadPathXML() { @@ -366,19 +375,67 @@ public class JavaProject setJavaCommand(description, command); } } + /** + * @see Openable + */ + protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException { + + // check whether the java project can be opened + if (!underlyingResource.isAccessible()) { + throw newNotPresentException(); + } + + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IWorkspaceRoot wRoot = workspace.getRoot(); + // cannot refresh cp markers on opening (emulate cp check on startup) since can create deadlocks (see bug 37274) +// IClasspathEntry[] resolvedClasspath = getResolvedClasspath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/); + +// // compute the pkg fragment roots +// info.setChildren(computePackageFragmentRoots(resolvedClasspath, false)); +// +// // remember the timestamps of external libraries the first time they are looked up +// for (int i = 0, length = resolvedClasspath.length; i < length; i++) { +// IClasspathEntry entry = resolvedClasspath[i]; +// if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { +// IPath path = entry.getPath(); +// Object target = JavaModel.getTarget(wRoot, path, true); +// if (target instanceof java.io.File) { +// Map externalTimeStamps = JavaModelManager.getJavaModelManager().deltaState.externalTimeStamps; +// if (externalTimeStamps.get(path) == null) { +// long timestamp = DeltaProcessor.getTimeStamp((java.io.File)target); +// externalTimeStamps.put(path, new Long(timestamp)); +// } +// } +// } +// } - protected void closing(Object info) throws JavaModelException { + return true; + } + protected void closing(Object info) { - // forget source attachment recommendations - IPackageFragmentRoot[] roots = this.getPackageFragmentRoots(); -// for (int i = 0; i < roots.length; i++) { -// if (roots[i] instanceof JarPackageFragmentRoot){ -// ((JarPackageFragmentRoot) roots[i]).setSourceAttachmentProperty(null); +// // forget source attachment recommendations +// Object[] children = ((JavaElementInfo)info).children; +// for (int i = 0, length = children.length; i < length; i++) { +// Object child = children[i]; +// if (child instanceof JarPackageFragmentRoot){ +// ((JarPackageFragmentRoot)child).setSourceAttachmentProperty(null); // } // } super.closing(info); } +// protected void closing(Object info) throws JavaModelException { +// +// // forget source attachment recommendations +// IPackageFragmentRoot[] roots = this.getPackageFragmentRoots(); +//// for (int i = 0; i < roots.length; i++) { +//// if (roots[i] instanceof JarPackageFragmentRoot){ +//// ((JarPackageFragmentRoot) roots[i]).setSourceAttachmentProperty(null); +//// } +//// } +// +// super.closing(info); +// } @@ -419,7 +476,7 @@ public class JavaProject if (member != null && member.getType() == IResource.PROJECT){ // double check if bound to project (23977) IProject projRsc = (IProject) member; if (JavaProject.hasJavaNature(projRsc)) { - JavaProject project = (JavaProject) PHPCore.create(projRsc); + JavaProject project = (JavaProject) JavaCore.create(projRsc); project.computeExpandedClasspath( initialProject, ignoreUnresolvedVariable, @@ -560,7 +617,7 @@ public class JavaProject IProject requiredProjectRsc = (IProject) member; if (JavaProject.hasJavaNature(requiredProjectRsc)){ // special builder binary output rootIDs.add(rootID); - JavaProject requiredProject = (JavaProject)PHPCore.create(requiredProjectRsc); + JavaProject requiredProject = (JavaProject)JavaCore.create(requiredProjectRsc); requiredProject.computePackageFragmentRoots( requiredProject.getResolvedClasspath(true), accumulatedRoots, @@ -655,10 +712,10 @@ public class JavaProject switch (innerMostEntry.getEntryKind()) { case IClasspathEntry.CPE_SOURCE: // .class files are not visible in source folders - return true; //!Util.isClassFileName(fullPath.lastSegment()); + return true; //!net.sourceforge.phpdt.internal.compiler.util.Util.isClassFileName(fullPath.lastSegment()); case IClasspathEntry.CPE_LIBRARY: // .java files are not visible in library folders - return !Util.isJavaFileName(fullPath.lastSegment()); + return !net.sourceforge.phpdt.internal.compiler.util.Util.isJavaFileName(fullPath.lastSegment()); } } if (innerMostOutput != null) { @@ -680,7 +737,7 @@ public class JavaProject case IJavaModelStatusConstants.CLASSPATH_CYCLE : isCycleProblem = true; - if (PHPCore.ERROR.equals(getOption(PHPCore.CORE_CIRCULAR_CLASSPATH, true))) { + if (JavaCore.ERROR.equals(getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true))) { severity = IMarker.SEVERITY_ERROR; } else { severity = IMarker.SEVERITY_WARNING; @@ -695,7 +752,7 @@ public class JavaProject default: IPath path = status.getPath(); if (path != null) arguments = new String[] { path.toString() }; - if (PHPCore.ERROR.equals(getOption(PHPCore.CORE_INCOMPLETE_CLASSPATH, true))) { + if (JavaCore.ERROR.equals(getOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, true))) { severity = IMarker.SEVERITY_ERROR; } else { severity = IMarker.SEVERITY_WARNING; @@ -733,11 +790,25 @@ public class JavaProject /** * Returns a new element info for this element. */ - protected OpenableElementInfo createElementInfo() { - + protected Object createElementInfo() { return new JavaProjectElementInfo(); } + + + /* + * Returns a new search name environment for this project. This name environment first looks in the given working copies. + */ +// public ISearchableNameEnvironment newSearchableNameEnvironment(ICompilationUnit[] workingCopies) throws JavaModelException { +// return new SearchableEnvironment(this, workingCopies); +// } + /* + * Returns a new search name environment for this project. This name environment first looks in the working copies + * of the given owner. + */ + public ISearchableNameEnvironment newSearchableNameEnvironment(WorkingCopyOwner owner) throws JavaModelException { + return new SearchableEnvironment(this, owner); + } /** * Reads and decode an XML classpath string */ @@ -836,7 +907,7 @@ public class JavaProject protected IClasspathEntry[] defaultClasspath() throws JavaModelException { return new IClasspathEntry[] { - PHPCore.newSourceEntry(getProject().getFullPath())}; + JavaCore.newSourceEntry(getProject().getFullPath())}; } /** @@ -850,45 +921,76 @@ public class JavaProject /** * Returns the XML String encoding of the class path. */ - protected String encodeClasspath(IClasspathEntry[] classpath, IPath outputLocation, boolean useLineSeparator) throws JavaModelException { - - Document document = new DocumentImpl(); - Element cpElement = document.createElement("classpath"); //$NON-NLS-1$ - document.appendChild(cpElement); - - for (int i = 0; i < classpath.length; ++i) { - cpElement.appendChild(((ClasspathEntry)classpath[i]).elementEncode(document, getProject().getFullPath())); - } - - if (outputLocation != null) { - outputLocation = outputLocation.removeFirstSegments(1); - outputLocation = outputLocation.makeRelative(); - Element oElement = document.createElement("classpathentry"); //$NON-NLS-1$ - oElement.setAttribute("kind", ClasspathEntry.kindToString(ClasspathEntry.K_OUTPUT)); //$NON-NLS-1$ - oElement.setAttribute("path", outputLocation.toString()); //$NON-NLS-1$ - cpElement.appendChild(oElement); - } - - // produce a String output + protected String encodeClasspath(IClasspathEntry[] classpath, IPath outputLocation, boolean indent) throws JavaModelException { try { ByteArrayOutputStream s = new ByteArrayOutputStream(); - OutputFormat format = new OutputFormat(); - if (useLineSeparator) { - format.setIndenting(true); - format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$ - } else { - format.setPreserveSpace(true); - } - Serializer serializer = - SerializerFactory.getSerializerFactory(Method.XML).makeSerializer( - new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$ - format); - serializer.asDOMSerializer().serialize(document); - return s.toString("UTF8"); //$NON-NLS-1$ + OutputStreamWriter writer = new OutputStreamWriter(s, "UTF8"); //$NON-NLS-1$ + XMLWriter xmlWriter = new XMLWriter(writer); + + xmlWriter.startTag("classpath", indent); //$NON-NLS-1$ + for (int i = 0; i < classpath.length; ++i) { + ((ClasspathEntry)classpath[i]).elementEncode(xmlWriter, this.project.getFullPath(), indent, true); + } + + if (outputLocation != null) { + outputLocation = outputLocation.removeFirstSegments(1); + outputLocation = outputLocation.makeRelative(); + HashMap parameters = new HashMap(); + parameters.put("kind", ClasspathEntry.kindToString(ClasspathEntry.K_OUTPUT));//$NON-NLS-1$ + parameters.put("path", String.valueOf(outputLocation));//$NON-NLS-1$ + xmlWriter.printTag("classpathentry", parameters, indent, true, true);//$NON-NLS-1$ + } + + xmlWriter.endTag("classpath", indent);//$NON-NLS-1$ + writer.flush(); + writer.close(); + return s.toString("UTF8");//$NON-NLS-1$ } catch (IOException e) { throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION); } } + /** + * Returns the XML String encoding of the class path. + */ +// protected String encodeClasspath(IClasspathEntry[] classpath, IPath outputLocation, boolean useLineSeparator) throws JavaModelException { +// +// Document document = new DocumentImpl(); +// Element cpElement = document.createElement("classpath"); //$NON-NLS-1$ +// document.appendChild(cpElement); +// +// for (int i = 0; i < classpath.length; ++i) { +// cpElement.appendChild(((ClasspathEntry)classpath[i]).elementEncode(document, getProject().getFullPath())); +// } +// +// if (outputLocation != null) { +// outputLocation = outputLocation.removeFirstSegments(1); +// outputLocation = outputLocation.makeRelative(); +// Element oElement = document.createElement("classpathentry"); //$NON-NLS-1$ +// oElement.setAttribute("kind", ClasspathEntry.kindToString(ClasspathEntry.K_OUTPUT)); //$NON-NLS-1$ +// oElement.setAttribute("path", outputLocation.toString()); //$NON-NLS-1$ +// cpElement.appendChild(oElement); +// } +// +// // produce a String output +// try { +// ByteArrayOutputStream s = new ByteArrayOutputStream(); +// OutputFormat format = new OutputFormat(); +// if (useLineSeparator) { +// format.setIndenting(true); +// format.setLineSeparator(System.getProperty("line.separator")); //$NON-NLS-1$ +// } else { +// format.setPreserveSpace(true); +// } +// Serializer serializer = +// SerializerFactory.getSerializerFactory(Method.XML).makeSerializer( +// new OutputStreamWriter(s, "UTF8"), //$NON-NLS-1$ +// format); +// serializer.asDOMSerializer().serialize(document); +// return s.toString("UTF8"); //$NON-NLS-1$ +// } catch (IOException e) { +// throw new JavaModelException(e, IJavaModelStatusConstants.IO_EXCEPTION); +// } +// } /** * Returns true if this handle represents the same Java project @@ -908,11 +1010,11 @@ public class JavaProject JavaProject other = (JavaProject) o; return getProject().equals(other.getProject()) - && fOccurrenceCount == other.fOccurrenceCount; + && occurrenceCount == other.occurrenceCount; } public boolean exists() { - if (!hasJavaNature(fProject)) return false; + if (!hasJavaNature(project)) return false; return super.exists(); } @@ -1111,50 +1213,50 @@ public class JavaProject } } - /** - * @see Openable - */ - protected boolean generateInfos( - OpenableElementInfo info, - IProgressMonitor pm, - Map newElements, - IResource underlyingResource) throws JavaModelException { - - boolean validInfo = false; - try { - if (getProject().isOpen()) { - // put the info now, because computing the roots requires it - JavaModelManager.getJavaModelManager().putInfo(this, info); - - // compute the pkg fragment roots - updatePackageFragmentRoots(); - - // remember the timestamps of external libraries the first time they are looked up - IClasspathEntry[] resolvedClasspath = getResolvedClasspath(true/*ignore unresolved variable*/); - for (int i = 0, length = resolvedClasspath.length; i < length; i++) { - IClasspathEntry entry = resolvedClasspath[i]; - if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { - IPath path = entry.getPath(); - Object target = JavaModel.getTarget(ResourcesPlugin.getWorkspace().getRoot(), path, true); - if (target instanceof java.io.File) { - Map externalTimeStamps = JavaModelManager.getJavaModelManager().deltaProcessor.externalTimeStamps; - if (externalTimeStamps.get(path) == null) { - long timestamp = DeltaProcessor.getTimeStamp((java.io.File)target); - externalTimeStamps.put(path, new Long(timestamp)); - } - } - } - } - - // only valid if reaches here - validInfo = true; - } - } finally { - if (!validInfo) - JavaModelManager.getJavaModelManager().removeInfo(this); - } - return validInfo; - } +// /** +// * @see Openable +// */ +// protected boolean generateInfos( +// OpenableElementInfo info, +// IProgressMonitor pm, +// Map newElements, +// IResource underlyingResource) throws JavaModelException { +// +// boolean validInfo = false; +// try { +// if (getProject().isOpen()) { +// // put the info now, because computing the roots requires it +// JavaModelManager.getJavaModelManager().putInfo(this, info); +// +// // compute the pkg fragment roots +// updatePackageFragmentRoots(); +// +// // remember the timestamps of external libraries the first time they are looked up +// IClasspathEntry[] resolvedClasspath = getResolvedClasspath(true/*ignore unresolved variable*/); +// for (int i = 0, length = resolvedClasspath.length; i < length; i++) { +// IClasspathEntry entry = resolvedClasspath[i]; +// if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { +// IPath path = entry.getPath(); +// Object target = JavaModel.getTarget(ResourcesPlugin.getWorkspace().getRoot(), path, true); +// if (target instanceof java.io.File) { +// Map externalTimeStamps = JavaModelManager.getJavaModelManager().deltaProcessor.externalTimeStamps; +// if (externalTimeStamps.get(path) == null) { +// long timestamp = DeltaProcessor.getTimeStamp((java.io.File)target); +// externalTimeStamps.put(path, new Long(timestamp)); +// } +// } +// } +// } +// +// // only valid if reaches here +// validInfo = true; +// } +// } finally { +// if (!validInfo) +// JavaModelManager.getJavaModelManager().removeInfo(this); +// } +// return validInfo; +// } /** * @see IJavaProject @@ -1201,7 +1303,12 @@ public class JavaProject } return null; } - + /** + * @see IJavaElement + */ + public int getElementType() { + return JAVA_PROJECT; + } /** * This is a helper method returning the expanded classpath for the project, as a list of classpath entries, * where all classpath variable entries have been resolved and substituted with their final target entries. @@ -1278,6 +1385,28 @@ public class JavaProject return nameLookup; } } + /* + * Returns a new name lookup. This name lookup first looks in the given working copies. + */ + public NameLookup newNameLookup(ICompilationUnit[] workingCopies) throws JavaModelException { + + JavaProjectElementInfo info = getJavaProjectElementInfo(); + // lock on the project info to avoid race condition while computing the pkg fragment roots and package fragment caches +// synchronized(info){ +// return new NameLookup(info.getAllPackageFragmentRoots(this), info.getAllPackageFragments(this), workingCopies); +// } + return null; + } + + /* + * Returns a new name lookup. This name lookup first looks in the working copies of the given owner. + */ + public NameLookup newNameLookup(WorkingCopyOwner owner) throws JavaModelException { + + JavaModelManager manager = JavaModelManager.getJavaModelManager(); + ICompilationUnit[] workingCopies = owner == null ? null : manager.getWorkingCopies(owner, true/*add primary WCs*/); + return newNameLookup(workingCopies); + } // // /** // * Returns an array of non-java resources contained in the receiver. @@ -1296,7 +1425,7 @@ public class JavaProject Preferences preferences = getPreferences(); if (preferences == null || preferences.isDefault(optionName)) { - return inheritJavaCoreOptions ? PHPCore.getOption(optionName) : null; + return inheritJavaCoreOptions ? JavaCore.getOption(optionName) : null; } return preferences.getString(optionName).trim(); } @@ -1309,7 +1438,7 @@ public class JavaProject public Map getOptions(boolean inheritJavaCoreOptions) { // initialize to the defaults from JavaCore options pool - Map options = inheritJavaCoreOptions ? PHPCore.getOptions() : new Hashtable(5); + Map options = inheritJavaCoreOptions ? JavaCore.getOptions() : new Hashtable(5); Preferences preferences = getPreferences(); if (preferences == null) return options; // cannot do better (non-Java project) @@ -1341,7 +1470,7 @@ public class JavaProject */ public IPath getOutputLocation() throws JavaModelException { - JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(fProject); + JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project); IPath outputLocation = perProjectInfo.outputLocation; if (outputLocation != null) return outputLocation; @@ -1526,7 +1655,7 @@ public class JavaProject */ public IProject getProject() { - return fProject; + return project; } protected IProject getProject(String name) { @@ -1567,7 +1696,7 @@ public class JavaProject */ public IClasspathEntry[] getRawClasspath() throws JavaModelException { - JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(fProject); + JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project); IClasspathEntry[] classpath = perProjectInfo.classpath; if (classpath != null) return classpath; classpath = this.readClasspathFile(false/*don't create markers*/, true/*log problems*/); @@ -1627,7 +1756,7 @@ public class JavaProject throws JavaModelException { JavaModelManager manager = JavaModelManager.getJavaModelManager(); - JavaModelManager.PerProjectInfo perProjectInfo = manager.getPerProjectInfoCheckExistence(fProject); + JavaModelManager.PerProjectInfo perProjectInfo = manager.getPerProjectInfoCheckExistence(project); // reuse cache if not needing to refresh markers or checking bound variables if (ignoreUnresolvedEntry && !generateMarkerOnError && perProjectInfo != null){ @@ -1646,7 +1775,7 @@ public class JavaProject if (perProjectInfo != null){ if (perProjectInfo.classpath == null // .classpath file could not be read && generateMarkerOnError - && JavaProject.hasJavaNature(fProject)) { + && JavaProject.hasJavaNature(project)) { this.createClasspathProblemMarker(new JavaModelStatus( IJavaModelStatusConstants.INVALID_CLASSPATH_FILE_FORMAT, Util.bind("classpath.cannotReadClasspathFile", this.getElementName()))); //$NON-NLS-1$ @@ -1693,7 +1822,7 @@ public class JavaProject case IClasspathEntry.CPE_VARIABLE : - IClasspathEntry resolvedEntry = PHPCore.getResolvedClasspathEntry(rawEntry); + IClasspathEntry resolvedEntry = JavaCore.getResolvedClasspathEntry(rawEntry); if (resolvedEntry == null) { if (!ignoreUnresolvedEntry) throw new JavaModelException(status); } else { @@ -1828,7 +1957,7 @@ public class JavaProject } public int hashCode() { - return fProject.hashCode(); + return project.hashCode(); } /** @@ -1955,7 +2084,7 @@ public class JavaProject Preferences preferences = new Preferences(); // File prefFile = getProject().getLocation().append(PREF_FILENAME).toFile(); - IPath projectMetaLocation = getProject().getPluginWorkingLocation(PHPCore.getPlugin().getDescriptor()); + IPath projectMetaLocation = getProject().getPluginWorkingLocation(JavaCore.getPlugin().getDescriptor()); if (projectMetaLocation != null) { File prefFile = projectMetaLocation.append(PREF_FILENAME).toFile(); if (prefFile.exists()) { // load preferences from file @@ -2024,17 +2153,17 @@ public class JavaProject // return op.getResult(); // } - /** - * Open project if resource isn't closed - */ - protected void openWhenClosed(IProgressMonitor pm) throws JavaModelException { - - if (!this.fProject.isOpen()) { - throw newNotPresentException(); - } else { - super.openWhenClosed(pm); - } - } +// /** +// * Open project if resource isn't closed +// */ +// protected void openWhenClosed(IProgressMonitor pm) throws JavaModelException { +// +// if (!this.fProject.isOpen()) { +// throw newNotPresentException(); +// } else { +// super.openWhenClosed(pm); +// } +// } public String[] projectPrerequisites(IClasspathEntry[] entries) throws JavaModelException { @@ -2164,7 +2293,7 @@ public class JavaProject // the preferences file is located in the plug-in's state area // at a well-known name (.jprefs) // File prefFile = getProject().getLocation().append(PREF_FILENAME).toFile(); - File prefFile = project.getPluginWorkingLocation(PHPCore.getPlugin().getDescriptor()).append(PREF_FILENAME).toFile(); + File prefFile = project.getPluginWorkingLocation(JavaCore.getPlugin().getDescriptor()).append(PREF_FILENAME).toFile(); if (preferences.propertyNames().length == 0) { // there are no preference settings // rather than write an empty file, just delete any existing file @@ -2282,9 +2411,9 @@ public class JavaProject */ public void setProject(IProject project) { - fProject = project; - fParent = JavaModelManager.getJavaModelManager().getJavaModel(); - fName = project.getName(); + project = project; + parent = JavaModelManager.getJavaModelManager().getJavaModel(); + name = project.getName(); } /** @@ -2367,7 +2496,7 @@ public class JavaProject protected void setRawClasspath0(IClasspathEntry[] rawEntries) throws JavaModelException { - JavaModelManager.PerProjectInfo info = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(fProject); + JavaModelManager.PerProjectInfo info = JavaModelManager.getJavaModelManager().getPerProjectInfoCheckExistence(project); synchronized (info) { if (rawEntries != null) { @@ -2438,8 +2567,8 @@ public class JavaProject if (cycleParticipants.contains(project.getPath())){ IMarker cycleMarker = project.getCycleMarker(); - String circularCPOption = project.getOption(PHPCore.CORE_CIRCULAR_CLASSPATH, true); - int circularCPSeverity = PHPCore.ERROR.equals(circularCPOption) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; + String circularCPOption = project.getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true); + int circularCPSeverity = JavaCore.ERROR.equals(circularCPOption) ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING; if (cycleMarker != null) { // update existing cycle marker if needed try { @@ -2491,7 +2620,7 @@ public class JavaProject if (!traversed.contains(prereqProjectPath)) { IResource member = workspaceRoot.findMember(prereqProjectPath); if (member != null && member.getType() == IResource.PROJECT){ - JavaProject project = (JavaProject)PHPCore.create((IProject)member); + JavaProject project = (JavaProject)JavaCore.create((IProject)member); project.updateCycleParticipants(null, prereqChain, cycleParticipants, workspaceRoot, traversed); } }