From 63019e2c6a8f84c1edb713a7f5672f088a8d005f Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Thu, 17 Oct 2013 20:34:42 -0700 Subject: [PATCH] Cosmetics. --- .../cdt/internal/ui/search/CSearchResult.java | 48 +++++++++---------- .../ui/search/HidePolymorphicCalls.java | 5 +- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java index bd3a4f0a4ee..907427f7fef 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java @@ -48,12 +48,12 @@ import org.eclipse.cdt.internal.ui.util.ExternalEditorInput; */ public class CSearchResult extends AbstractTextSearchResult implements IEditorMatchAdapter, IFileMatchAdapter { 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 = {}; private CSearchQuery query; private boolean indexerBusy; - + public CSearchResult(CSearchQuery query) { super(); this.query = query; @@ -73,48 +73,48 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa final IEditorInput input= editor.getEditorInput(); IPath path= null; if (input instanceof FileEditorInput) { - final FileEditorInput fileInput = (FileEditorInput)input; + final FileEditorInput fileInput = (FileEditorInput) input; path= fileInput.getFile().getLocation(); } else if (input instanceof ExternalEditorInput) { - final ExternalEditorInput extInput = (ExternalEditorInput)input; + final ExternalEditorInput extInput = (ExternalEditorInput) input; path= extInput.getPath(); } else if (input instanceof IStorageEditorInput) { try { - final IStorage storage= ((IStorageEditorInput)input).getStorage(); + final IStorage storage= ((IStorageEditorInput) input).getStorage(); path= storage.getFullPath(); - } catch (CoreException exc) { - // ignore + } catch (CoreException e) { + CUIPlugin.log(e); } } else if (input instanceof IPathEditorInput) { - path= ((IPathEditorInput)input).getPath(); + path= ((IPathEditorInput) input).getPath(); } else { ILocationProvider provider= (ILocationProvider) input.getAdapter(ILocationProvider.class); if (provider != null) { path= provider.getPath(input); } - } + } if (path != null) return path.toOSString(); - + return null; } - + @Override public boolean isShownInEditor(Match match, IEditorPart editor) { final String fileName= getFileName(editor); if (fileName != null && match instanceof CSearchMatch) { final IPath filePath= new Path(fileName); - return filePath.equals(IndexLocationFactory.getAbsolutePath(((CSearchMatch)match).getLocation())); + return filePath.equals(IndexLocationFactory.getAbsolutePath(((CSearchMatch) match).getLocation())); } return false; } - + private Match[] computeContainedMatches(AbstractTextSearchResult result, String filename) throws CoreException { IPath pfilename= new Path(filename); - List list = new ArrayList(); + List list = new ArrayList(); Object[] elements = result.getElements(); 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]); for (int j = 0; j < matches.length; ++j) { if (matches[j] instanceof CSearchMatch) { @@ -125,7 +125,7 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa } return list.toArray(new Match[list.size()]); } - + @Override public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) { try { @@ -152,17 +152,17 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa @Override public IFile getFile(Object element) { if (element instanceof IIndexName) { - IIndexName name = (IIndexName)element; + IIndexName name = (IIndexName) element; try { IIndexFileLocation location = name.getFile().getLocation(); - if(location.getFullPath()!=null) { + if (location.getFullPath() != null) { return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath())); } } catch(CoreException ce) { /* fall-through to return null */ } } else if (element instanceof CSearchElement) { - CSearchElement searchElement = (CSearchElement)element; + CSearchElement searchElement = (CSearchElement) element; IIndexFileLocation location = searchElement.getLocation(); - if(location.getFullPath()!=null) { + if (location.getFullPath() != null) { return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(location.getFullPath())); } } @@ -191,15 +191,15 @@ 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 */ public void setIndexerBusy(boolean b) { this.indexerBusy = b; } - + /** - * 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() { return indexerBusy; @@ -211,7 +211,7 @@ public class CSearchResult extends AbstractTextSearchResult implements IEditorMa } @Override - public MatchFilter[] getActiveMatchFilters() { + public MatchFilter[] getActiveMatchFilters() { MatchFilter[] result = super.getActiveMatchFilters(); if (result == null) { if (CUIPlugin.getDefault().getDialogSettings().getBoolean(KEY_SHOW_POLYMORPHIC_CALLS)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/HidePolymorphicCalls.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/HidePolymorphicCalls.java index 281c96db6c0..6a79b1884e1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/HidePolymorphicCalls.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/HidePolymorphicCalls.java @@ -6,15 +6,14 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation - *******************************************************************************/ + * Markus Schorn - initial API and implementation + *******************************************************************************/ package org.eclipse.cdt.internal.ui.search; import org.eclipse.search.ui.text.Match; import org.eclipse.search.ui.text.MatchFilter; public class HidePolymorphicCalls extends MatchFilter { - public static final MatchFilter FILTER = new HidePolymorphicCalls(); @Override