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:
parent
1a2283799d
commit
3148081868
4 changed files with 34 additions and 3 deletions
|
@ -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
|
2004-12-06 Alain Magloire
|
||||||
Fix for 79865
|
Fix for 79865
|
||||||
* src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java
|
* src/org/eclipse/cdt/internal/ui/text/CHelpProviderDescriptor.java
|
||||||
|
|
|
@ -290,7 +290,10 @@ public class CSearchResultPage extends AbstractTextSearchViewPage {
|
||||||
|
|
||||||
if (canonicalPath != null && (!(originalFile.isLinked()))){
|
if (canonicalPath != null && (!(originalFile.isLinked()))){
|
||||||
IPath path = new Path(canonicalPath);
|
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;
|
return originalFile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||||
import org.eclipse.cdt.ui.CElementContentProvider;
|
import org.eclipse.cdt.ui.CElementContentProvider;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
import org.eclipse.search.ui.text.Match;
|
import org.eclipse.search.ui.text.Match;
|
||||||
|
@ -100,15 +101,27 @@ public class LevelTreeContentProvider extends CSearchContentProvider implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return possibleParent;
|
return possibleParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object internalGetParent(Object child) {
|
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) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return getChildren(inputElement);
|
return getChildren(inputElement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.internal.ui.search.NewSearchResultCollector;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.search.ui.ISearchResultViewEntry;
|
import org.eclipse.search.ui.ISearchResultViewEntry;
|
||||||
|
@ -90,6 +91,9 @@ public class CSearchResultLabelProvider extends LabelProvider {
|
||||||
|
|
||||||
elementType = new Integer(elType).intValue();
|
elementType = new Integer(elType).intValue();
|
||||||
visibility = new Integer(elViz).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);
|
return getCSearchSortElementText(elParent, elName, elPath);
|
||||||
}
|
}
|
||||||
|
else if (element instanceof IPath){
|
||||||
|
return ((IPath) element).toOSString();
|
||||||
|
}
|
||||||
|
|
||||||
if( match == null )
|
if( match == null )
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue