diff options
4 files changed, 34 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 1a38e0e325d..320277c184b 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,11 @@ +2004-12-08 Bogdan Gheorghe + Fix for 76123 + * src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java + + Added sorting for external file matches + * src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.jaav + * src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java + 2004-12-06 Alain Magloire Fix for 79865 * src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java index ed863ea7092..bcc1eef6ce0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultPage.java @@ -290,7 +290,10 @@ public class CSearchResultPage extends AbstractTextSearchViewPage { if (canonicalPath != null && (!(originalFile.isLinked()))){ IPath path = new Path(canonicalPath); - originalFile = CUIPlugin.getWorkspace().getRoot().getFileForLocation(path); + + IFile[] matches = CUIPlugin.getWorkspace().getRoot().findFilesForLocation(path); + if (matches.length > 0) + originalFile = matches[0]; } return originalFile; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java index dd6c5f0d8fc..965a8c669e0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/LevelTreeContentProvider.java @@ -23,6 +23,7 @@ import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.search.BasicSearchMatch; import org.eclipse.cdt.ui.CElementContentProvider; import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IPath; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.search.ui.text.Match; @@ -100,15 +101,27 @@ public class LevelTreeContentProvider extends CSearchContentProvider implements } } } - } + } return possibleParent; } private Object internalGetParent(Object child) { - return fContentProvider.getParent(child); + Object parent = fContentProvider.getParent(child); + + if (parent == null){ + //Could be an external file + if (child instanceof CSearchMatch){ + BasicSearchMatch match = ((CSearchMatch) child).getSearchMatch(); + IPath location=match.getLocation(); + return location; + } + } + + return parent; } + public Object[] getElements(Object inputElement) { return getChildren(inputElement); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java index a0083e97d80..37ab2730cb6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CSearchResultLabelProvider.java @@ -23,6 +23,7 @@ import org.eclipse.cdt.internal.ui.search.NewSearchResultCollector; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.search.ui.ISearchResultViewEntry; @@ -90,6 +91,9 @@ public class CSearchResultLabelProvider extends LabelProvider { elementType = new Integer(elType).intValue(); visibility = new Integer(elViz).intValue(); + } else if (element instanceof IPath){ + //External File; use Translation Unit + elementType = ICElement.C_UNIT; } @@ -182,6 +186,9 @@ public class CSearchResultLabelProvider extends LabelProvider { return getCSearchSortElementText(elParent, elName, elPath); } + else if (element instanceof IPath){ + return ((IPath) element).toOSString(); + } if( match == null ) return ""; //$NON-NLS-1$ |