1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Fix for 76123

Added sorting for external file matches
This commit is contained in:
Bogdan Gheorghe 2004-12-08 21:17:37 +00:00
parent 1a2283799d
commit 3148081868
4 changed files with 34 additions and 3 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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$