diff options
Diffstat (limited to 'build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java')
-rw-r--r-- | build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java index 8dd51ee18f2..93c1e3387d6 100644 --- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java +++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/ResourceLookup.java @@ -10,7 +10,7 @@ * * Contributors: * Markus Schorn - initial API and implementation - *******************************************************************************/ + *******************************************************************************/ package org.eclipse.cdt.internal.autotools.ui; import java.net.URI; @@ -25,23 +25,23 @@ import org.eclipse.core.runtime.IPath; * Allows for looking up resources by location or name. */ public class ResourceLookup { - private static ResourceLookupTree lookupTree= new ResourceLookupTree(); + private static ResourceLookupTree lookupTree = new ResourceLookupTree(); public static void startup() { lookupTree.startup(); } - + public static void shutdown() { lookupTree.shutdown(); } - + /** - * Searches for files with the given location suffix. - * - * At this point the method works for sources and headers (no other content types), only. - * This is done to use less memory and can be changed if necessary. + * Searches for files with the given location suffix. + * + * At this point the method works for sources and headers (no other content types), only. + * This is done to use less memory and can be changed if necessary. * For linked resource files, the name of the link target is relevant. - * + * * @param locationSuffix the suffix to match, always used as relative path. * @param projects the projects to search * @param ignoreCase whether or not to ignore case when comparing the suffix. @@ -49,10 +49,10 @@ public class ResourceLookup { public static IFile[] findFilesByName(IPath locationSuffix, IProject[] projects, boolean ignoreCase) { return lookupTree.findFilesByName(locationSuffix, projects, ignoreCase); } - + /** * Uses a lookup-tree that finds resources for locations using the canonical representation - * of the path. + * of the path. */ public static IFile[] findFilesForLocationURI(URI location) { return lookupTree.findFilesForLocationURI(location); @@ -60,7 +60,7 @@ public class ResourceLookup { /** * Uses a lookup-tree that finds resources for locations using the canonical representation - * of the path. The method does not work for files where the name (last segment) of the + * of the path. The method does not work for files where the name (last segment) of the * resources differs from the name of the location. */ public static IFile[] findFilesForLocation(IPath location) { @@ -70,7 +70,7 @@ public class ResourceLookup { /** * Uses {@link #findFilesForLocationURI(URI)} and selects the most relevant file * from the result. Files form the first project, from cdt-projects and those on source - * roots are preferred, see {@link FileRelevance}. + * roots are preferred, see {@link FileRelevance}. * @param location an URI for the location of the files to search for. * @param preferredProject a project to be preferred over others, or <code>null</code>. * @return a file for the location in one of the given projects, or <code>null</code>. @@ -83,7 +83,7 @@ public class ResourceLookup { /** * Uses {@link #findFilesForLocation(IPath)} and selects the most relevant file * from the result. Files form the preferred project, from cdt-projects and those on source - * roots are preferred, see {@link FileRelevance}. + * roots are preferred, see {@link FileRelevance}. * @param location a path for the location of the files to search for. * @param preferredProject a project to be preferred over others, or <code>null</code>. * @return a file for the location or <code>null</code>. @@ -100,17 +100,16 @@ public class ResourceLookup { if (files.length == 1) return files[0]; - IFile best= null; - int bestRelevance= -1; + IFile best = null; + int bestRelevance = -1; for (int i = 0; i < files.length; i++) { IFile file = files[i]; - int relevance= FileRelevance.getRelevance(file, preferredProject); - if (best == null || relevance > bestRelevance || - (relevance == bestRelevance && - best.getFullPath().toString().compareTo(file.getFullPath().toString()) > 0)) { - bestRelevance= relevance; - best= file; + int relevance = FileRelevance.getRelevance(file, preferredProject); + if (best == null || relevance > bestRelevance || (relevance == bestRelevance + && best.getFullPath().toString().compareTo(file.getFullPath().toString()) > 0)) { + bestRelevance = relevance; + best = file; } } return best; @@ -138,19 +137,21 @@ public class ResourceLookup { }); } - /** + /** * For testing, only. */ public static void dump() { lookupTree.dump(); } - /** + + /** * For testing, only. */ public static void unrefNodeMap() { lookupTree.unrefNodeMap(); } - /** + + /** * For testing, only. */ public static void simulateNodeMapCollection() { |