mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 13:55:39 +02:00
Cosmetics.
This commit is contained in:
parent
c644a857ba
commit
63019e2c6a
2 changed files with 26 additions and 27 deletions
|
@ -48,7 +48,7 @@ import org.eclipse.cdt.internal.ui.util.ExternalEditorInput;
|
||||||
*/
|
*/
|
||||||
public class CSearchResult extends AbstractTextSearchResult implements IEditorMatchAdapter, IFileMatchAdapter {
|
public class CSearchResult extends AbstractTextSearchResult implements IEditorMatchAdapter, IFileMatchAdapter {
|
||||||
private static final String KEY_SHOW_POLYMORPHIC_CALLS = "ShowPolymorphicCalls"; //$NON-NLS-1$
|
private static final String KEY_SHOW_POLYMORPHIC_CALLS = "ShowPolymorphicCalls"; //$NON-NLS-1$
|
||||||
final static MatchFilter[] ALL_FILTERS = new MatchFilter[] {HidePolymorphicCalls.FILTER};
|
final static MatchFilter[] ALL_FILTERS = new MatchFilter[] { HidePolymorphicCalls.FILTER };
|
||||||
final static MatchFilter[] NO_FILTERS = {};
|
final static MatchFilter[] NO_FILTERS = {};
|
||||||
|
|
||||||
private CSearchQuery query;
|
private CSearchQuery query;
|
||||||
|
@ -73,20 +73,20 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
final IEditorInput input= editor.getEditorInput();
|
final IEditorInput input= editor.getEditorInput();
|
||||||
IPath path= null;
|
IPath path= null;
|
||||||
if (input instanceof FileEditorInput) {
|
if (input instanceof FileEditorInput) {
|
||||||
final FileEditorInput fileInput = (FileEditorInput)input;
|
final FileEditorInput fileInput = (FileEditorInput) input;
|
||||||
path= fileInput.getFile().getLocation();
|
path= fileInput.getFile().getLocation();
|
||||||
} else if (input instanceof ExternalEditorInput) {
|
} else if (input instanceof ExternalEditorInput) {
|
||||||
final ExternalEditorInput extInput = (ExternalEditorInput)input;
|
final ExternalEditorInput extInput = (ExternalEditorInput) input;
|
||||||
path= extInput.getPath();
|
path= extInput.getPath();
|
||||||
} else if (input instanceof IStorageEditorInput) {
|
} else if (input instanceof IStorageEditorInput) {
|
||||||
try {
|
try {
|
||||||
final IStorage storage= ((IStorageEditorInput)input).getStorage();
|
final IStorage storage= ((IStorageEditorInput) input).getStorage();
|
||||||
path= storage.getFullPath();
|
path= storage.getFullPath();
|
||||||
} catch (CoreException exc) {
|
} catch (CoreException e) {
|
||||||
// ignore
|
CUIPlugin.log(e);
|
||||||
}
|
}
|
||||||
} else if (input instanceof IPathEditorInput) {
|
} else if (input instanceof IPathEditorInput) {
|
||||||
path= ((IPathEditorInput)input).getPath();
|
path= ((IPathEditorInput) input).getPath();
|
||||||
} else {
|
} else {
|
||||||
ILocationProvider provider= (ILocationProvider) input.getAdapter(ILocationProvider.class);
|
ILocationProvider provider= (ILocationProvider) input.getAdapter(ILocationProvider.class);
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
|
@ -104,7 +104,7 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
final String fileName= getFileName(editor);
|
final String fileName= getFileName(editor);
|
||||||
if (fileName != null && match instanceof CSearchMatch) {
|
if (fileName != null && match instanceof CSearchMatch) {
|
||||||
final IPath filePath= new Path(fileName);
|
final IPath filePath= new Path(fileName);
|
||||||
return filePath.equals(IndexLocationFactory.getAbsolutePath(((CSearchMatch)match).getLocation()));
|
return filePath.equals(IndexLocationFactory.getAbsolutePath(((CSearchMatch) match).getLocation()));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
List<Match> list = new ArrayList<Match>();
|
List<Match> list = new ArrayList<Match>();
|
||||||
Object[] elements = result.getElements();
|
Object[] elements = result.getElements();
|
||||||
for (int i = 0; i < elements.length; ++i) {
|
for (int i = 0; i < elements.length; ++i) {
|
||||||
if (pfilename.equals(IndexLocationFactory.getAbsolutePath(((CSearchElement)elements[i]).getLocation()))) {
|
if (pfilename.equals(IndexLocationFactory.getAbsolutePath(((CSearchElement) elements[i]).getLocation()))) {
|
||||||
Match[] matches = result.getMatches(elements[i]);
|
Match[] matches = result.getMatches(elements[i]);
|
||||||
for (int j = 0; j < matches.length; ++j) {
|
for (int j = 0; j < matches.length; ++j) {
|
||||||
if (matches[j] instanceof CSearchMatch) {
|
if (matches[j] instanceof CSearchMatch) {
|
||||||
|
@ -152,17 +152,17 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
@Override
|
@Override
|
||||||
public IFile getFile(Object element) {
|
public IFile getFile(Object element) {
|
||||||
if (element instanceof IIndexName) {
|
if (element instanceof IIndexName) {
|
||||||
IIndexName name = (IIndexName)element;
|
IIndexName name = (IIndexName) element;
|
||||||
try {
|
try {
|
||||||
IIndexFileLocation location = name.getFile().getLocation();
|
IIndexFileLocation location = name.getFile().getLocation();
|
||||||
if(location.getFullPath()!=null) {
|
if (location.getFullPath() != null) {
|
||||||
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath()));
|
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath()));
|
||||||
}
|
}
|
||||||
} catch(CoreException ce) { /* fall-through to return null */ }
|
} catch(CoreException ce) { /* fall-through to return null */ }
|
||||||
} else if (element instanceof CSearchElement) {
|
} else if (element instanceof CSearchElement) {
|
||||||
CSearchElement searchElement = (CSearchElement)element;
|
CSearchElement searchElement = (CSearchElement) element;
|
||||||
IIndexFileLocation location = searchElement.getLocation();
|
IIndexFileLocation location = searchElement.getLocation();
|
||||||
if(location.getFullPath()!=null) {
|
if (location.getFullPath() != null) {
|
||||||
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath()));
|
return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remember whether the indexer was busy when the search was performed.
|
* Remembers whether the indexer was busy when the search was performed.
|
||||||
* @param b
|
* @param b
|
||||||
*/
|
*/
|
||||||
public void setIndexerBusy(boolean b) {
|
public void setIndexerBusy(boolean b) {
|
||||||
|
@ -199,7 +199,7 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell if the indexer was busy when search results were gathered.
|
* Tells if the indexer was busy when search results were gathered.
|
||||||
*/
|
*/
|
||||||
public boolean wasIndexerBusy() {
|
public boolean wasIndexerBusy() {
|
||||||
return indexerBusy;
|
return indexerBusy;
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.eclipse.search.ui.text.Match;
|
||||||
import org.eclipse.search.ui.text.MatchFilter;
|
import org.eclipse.search.ui.text.MatchFilter;
|
||||||
|
|
||||||
public class HidePolymorphicCalls extends MatchFilter {
|
public class HidePolymorphicCalls extends MatchFilter {
|
||||||
|
|
||||||
public static final MatchFilter FILTER = new HidePolymorphicCalls();
|
public static final MatchFilter FILTER = new HidePolymorphicCalls();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue