X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java index 7da81a6..53e57d0 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/core/JavaProjectElementInfo.java @@ -20,14 +20,16 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -/** +/** * Info for IJavaProject. *

- * Note: getChildren() returns all of the IPackageFragmentRoots - * specified on the classpath for the project. This can include roots external to the - * project. See JavaProject#getAllPackageFragmentRoots() and - * JavaProject#getPackageFragmentRoots(). To get only the IPackageFragmentRoots - * that are internal to the project, use JavaProject#getChildren(). + * Note: getChildren() returns all of the + * IPackageFragmentRoots specified on the classpath for the + * project. This can include roots external to the project. See + * JavaProject#getAllPackageFragmentRoots() and + * JavaProject#getPackageFragmentRoots(). To get only the + * IPackageFragmentRoots that are internal to the project, use + * JavaProject#getChildren(). */ /* package */ @@ -39,11 +41,10 @@ class JavaProjectElementInfo extends OpenableElementInfo { protected NameLookup fNameLookup = null; /** - * The searchable builder environment facility used - * with this project (doubles as the builder environment). + * The searchable builder environment facility used with this project + * (doubles as the builder environment). */ -// protected SearchableEnvironment fSearchableEnvironment = null; - + // protected SearchableEnvironment fSearchableEnvironment = null; /** * A array with all the non-java resources contained by this PackageFragment */ @@ -55,31 +56,33 @@ class JavaProjectElementInfo extends OpenableElementInfo { public JavaProjectElementInfo() { fNonJavaResources = null; } - + /** * Compute the non-java resources contained in this java project. */ private Object[] computeNonJavaResources(JavaProject project) { - + // determine if src == project and/or if bin == project IPath projectPath = project.getProject().getFullPath(); boolean srcIsProject = false; - boolean binIsProject = false; + //boolean binIsProject = false; char[][] exclusionPatterns = null; IClasspathEntry[] classpath = null; IPath projectOutput = null; try { - classpath = project.getResolvedClasspath(true/*ignore unresolved variable*/); + classpath = project + .getResolvedClasspath(true/* ignore unresolved variable */); for (int i = 0; i < classpath.length; i++) { IClasspathEntry entry = classpath[i]; if (projectPath.equals(entry.getPath())) { srcIsProject = true; - exclusionPatterns = ((ClasspathEntry)entry).fullExclusionPatternChars(); + exclusionPatterns = ((ClasspathEntry) entry) + .fullExclusionPatternChars(); break; } } projectOutput = project.getOutputLocation(); - binIsProject = projectPath.equals(projectOutput); + //binIsProject = projectPath.equals(projectOutput); } catch (JavaModelException e) { // ignore } @@ -87,68 +90,76 @@ class JavaProjectElementInfo extends OpenableElementInfo { Object[] nonJavaResources = new IResource[5]; int nonJavaResourcesCounter = 0; try { - IResource[] members = ((IContainer) project.getResource()).members(); + IResource[] members = ((IContainer) project.getResource()) + .members(); for (int i = 0, max = members.length; i < max; i++) { IResource res = members[i]; switch (res.getType()) { - case IResource.FILE : - IPath resFullPath = res.getFullPath(); - String resName = res.getName(); - - // ignore a jar file on the classpath -// if (ProjectPrefUtil.isArchiveFileName(resName) && this.isClasspathEntryOrOutputLocation(resFullPath, classpath, projectOutput)) { -// break; -// } - // ignore .java file if src == project - if (srcIsProject -// && ProjectPrefUtil.isValidCompilationUnitName(resName) + case IResource.FILE: + IPath resFullPath = res.getFullPath(); + //String resName = res.getName(); + + // ignore a jar file on the classpath + // if (ProjectPrefUtil.isArchiveFileName(resName) && + // this.isClasspathEntryOrOutputLocation(resFullPath, + // classpath, projectOutput)) { + // break; + // } + // ignore .java file if src == project + if (srcIsProject + // && ProjectPrefUtil.isValidCompilationUnitName(resName) && !Util.isExcluded(res, exclusionPatterns)) { - break; - } - // ignore .class file if bin == project -// if (binIsProject && ProjectPrefUtil.isValidClassFileName(resName)) { -// break; -// } - // else add non java resource - if (nonJavaResources.length == nonJavaResourcesCounter) { - // resize - System.arraycopy( - nonJavaResources, - 0, - (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), - 0, - nonJavaResourcesCounter); - } - nonJavaResources[nonJavaResourcesCounter++] = res; break; - case IResource.FOLDER : - resFullPath = res.getFullPath(); - - // ignore non-excluded folders on the classpath or that correspond to an output location - if ((srcIsProject && !Util.isExcluded(res, exclusionPatterns) && Util.isValidFolderNameForPackage(res.getName())) - || this.isClasspathEntryOrOutputLocation(resFullPath, classpath, projectOutput)) { - break; - } - // else add non java resource - if (nonJavaResources.length == nonJavaResourcesCounter) { - // resize - System.arraycopy( - nonJavaResources, - 0, - (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), - 0, - nonJavaResourcesCounter); - } - nonJavaResources[nonJavaResourcesCounter++] = res; + } + // ignore .class file if bin == project + // if (binIsProject && + // ProjectPrefUtil.isValidClassFileName(resName)) { + // break; + // } + // else add non java resource + if (nonJavaResources.length == nonJavaResourcesCounter) { + // resize + System + .arraycopy( + nonJavaResources, + 0, + (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), + 0, nonJavaResourcesCounter); + } + nonJavaResources[nonJavaResourcesCounter++] = res; + break; + case IResource.FOLDER: + resFullPath = res.getFullPath(); + + // ignore non-excluded folders on the classpath or that + // correspond to an output location + if ((srcIsProject + && !Util.isExcluded(res, exclusionPatterns) && Util + .isValidFolderNameForPackage(res.getName())) + || this.isClasspathEntryOrOutputLocation( + resFullPath, classpath, projectOutput)) { + break; + } + // else add non java resource + if (nonJavaResources.length == nonJavaResourcesCounter) { + // resize + System + .arraycopy( + nonJavaResources, + 0, + (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), + 0, nonJavaResourcesCounter); + } + nonJavaResources[nonJavaResourcesCounter++] = res; } } if (nonJavaResources.length != nonJavaResourcesCounter) { - System.arraycopy( - nonJavaResources, - 0, - (nonJavaResources = new IResource[nonJavaResourcesCounter]), - 0, - nonJavaResourcesCounter); + System + .arraycopy( + nonJavaResources, + 0, + (nonJavaResources = new IResource[nonJavaResourcesCounter]), + 0, nonJavaResourcesCounter); } } catch (CoreException e) { nonJavaResources = NO_NON_JAVA_RESOURCES; @@ -156,7 +167,7 @@ class JavaProjectElementInfo extends OpenableElementInfo { } return nonJavaResources; } - + /** * @see IJavaProject */ @@ -164,7 +175,7 @@ class JavaProjectElementInfo extends OpenableElementInfo { return fNameLookup; } - + /** * Returns an array of non-java resources contained in the receiver. */ @@ -177,41 +188,45 @@ class JavaProjectElementInfo extends OpenableElementInfo { } return nonJavaResources; } - + /** - * @see IJavaProject + * @see IJavaProject */ -// protected SearchableEnvironment getSearchableEnvironment() { -// -// return fSearchableEnvironment; -// } + // protected SearchableEnvironment getSearchableEnvironment() { + // + // return fSearchableEnvironment; + // } /* - * Returns whether the given path is a classpath entry or an output location. + * Returns whether the given path is a classpath entry or an output + * location. */ - private boolean isClasspathEntryOrOutputLocation(IPath path, IClasspathEntry[] resolvedClasspath, IPath projectOutput) { - if (projectOutput.equals(path)) return true; + private boolean isClasspathEntryOrOutputLocation(IPath path, + IClasspathEntry[] resolvedClasspath, IPath projectOutput) { + if (projectOutput.equals(path)) + return true; for (int i = 0, length = resolvedClasspath.length; i < length; i++) { IClasspathEntry entry = resolvedClasspath[i]; if (entry.getPath().equals(path)) { return true; } IPath output; - if ((output = entry.getOutputLocation()) != null && output.equals(path)) { + if ((output = entry.getOutputLocation()) != null + && output.equals(path)) { return true; } } return false; } - + protected void setNameLookup(NameLookup newNameLookup) { fNameLookup = newNameLookup; // Reinitialize the searchable name environment since it caches // the name lookup. -// fSearchableEnvironment = null; + // fSearchableEnvironment = null; } - + /** * Set the fNonJavaResources to res value */ @@ -219,9 +234,10 @@ class JavaProjectElementInfo extends OpenableElementInfo { fNonJavaResources = resources; } - -// protected void setSearchableEnvironment(SearchableEnvironment newSearchableEnvironment) { -// -// fSearchableEnvironment = newSearchableEnvironment; -// } + + // protected void setSearchableEnvironment(SearchableEnvironment + // newSearchableEnvironment) { + // + // fSearchableEnvironment = newSearchableEnvironment; + // } }