diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IndexLocationFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IndexLocationFactory.java index 24ee1579219..5c21dca6af7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IndexLocationFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/IndexLocationFactory.java @@ -7,18 +7,24 @@ * * Contributors: * Andrew Ferguson (Symbian) - initial API and implementation + * Markus Schorn (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.core.index; import java.net.URI; +import java.util.Arrays; +import java.util.Comparator; +import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.internal.core.index.IndexFileLocation; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; @@ -35,6 +41,25 @@ import org.eclipse.core.runtime.Path; * @since 4.0 */ public class IndexLocationFactory { + /** + * Comparator to sort files for location. + */ + private static final class FILE_COMPARATOR implements Comparator { + public int compare(IFile o1, IFile o2) { + return compare(o1.getLocationURI(), o2.getLocationURI()); + } + + private int compare(URI uri1, URI uri2) { + if (uri1 == uri2) + return 0; + if (uri1 == null) + return -1; + if (uri2 == null) + return 1; + return uri1.toString().compareTo(uri2.toString()); + } + } + /** * Returns *