From 77fbc604e7f8a8c6569e31c12b04c4e4fc7b7bf3 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Wed, 1 Oct 2003 21:33:23 +0000 Subject: [PATCH] Patch for Andrew Niefer core: - fix bug 44026 by checking scope before reporting match in MatchLocator.report ui: -bug44032 - deleting/moving files breaks search * modified src/org/eclipse/cdt/ui/CSearchResultLabelProvider getText to return empty string instead of null -bug43130 - Selected resources is disabled but selected * src/org/eclipse/cdt/internal/ui/search/CSearchPage --- core/org.eclipse.cdt.core/search/ChangeLog | 3 +++ .../internal/core/search/matching/MatchLocator.java | 4 ++++ core/org.eclipse.cdt.ui/ChangeLog | 6 ++++++ .../eclipse/cdt/internal/ui/search/CSearchPage.java | 11 +++++++---- .../eclipse/cdt/ui/CSearchResultLabelProvider.java | 6 +++--- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/core/org.eclipse.cdt.core/search/ChangeLog b/core/org.eclipse.cdt.core/search/ChangeLog index 0bb6106106c..162118f66bf 100644 --- a/core/org.eclipse.cdt.core/search/ChangeLog +++ b/core/org.eclipse.cdt.core/search/ChangeLog @@ -1,3 +1,6 @@ +2003-10-01 Andrew Niefer + - fix bug 44026 by checking scope before reporting match in MatchLocator.report + 2003-10-01 Andrew Niefer - fix BasicSearchMatch.equals() for bug43988 diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java index 6a2a25bebb5..9da2c6e6290 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java @@ -441,6 +441,10 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants protected void report( ISourceElementCallbackDelegate node, int accuracyLevel ){ try { + if( currentResource != null && !searchScope.encloses(currentResource.getFullPath().toOSString() ) ){ + return; + } + int offset = 0; int end = 0; diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index dcaa9014f32..3fc6d6b8be8 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,9 @@ +2003-10-01 Andrew Niefer + -bug44032 - deleting/moving files breaks search + * modified src/org/eclipse/cdt/ui/CSearchResultLabelProvider getText to return empty string instead of null + -bug43130 - Selected resources is disabled but selected + * src/org/eclipse/cdt/internal/ui/search/CSearchPage + 2003-10-01 Alain Magloire Fix PR 44013, not defining a resource. diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java index 18e9215f50b..dc302f910d2 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java @@ -86,14 +86,17 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons String scopeDescription = ""; //$NON-NLS-1$ switch( getContainer().getSelectedScope() ) { + case ISearchPageContainer.SELECTION_SCOPE: + if( fStructuredSelection != null && fStructuredSelection.iterator().hasNext() ){ + scopeDescription = CSearchMessages.getString("SelectionScope"); //$NON-NLS-1$ + scope = CSearchScopeFactory.getInstance().createCSearchScope(fStructuredSelection); + break; + } + /* else fall through to workspace scope */ case ISearchPageContainer.WORKSPACE_SCOPE: scopeDescription = CSearchMessages.getString("WorkspaceScope"); //$NON-NLS-1$ scope = SearchEngine.createWorkspaceScope(); break; - case ISearchPageContainer.SELECTION_SCOPE: - scopeDescription = CSearchMessages.getString("SelectionScope"); //$NON-NLS-1$ - scope = CSearchScopeFactory.getInstance().createCSearchScope(fStructuredSelection); - break; case ISearchPageContainer.WORKING_SET_SCOPE: IWorkingSet[] workingSets= getContainer().getSelectedWorkingSets(); // should not happen - just to be sure 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 967095c6f06..9d936faeaca 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 @@ -120,18 +120,18 @@ public class CSearchResultLabelProvider extends LabelProvider { try { match = (IMatch) marker.getAttribute(CSearchResultCollector.IMATCH); } catch (CoreException e) { - return null; + return ""; } } else if( element instanceof IMatch ){ match = (IMatch) element; } if( match == null ) - return null; + return ""; IResource resource = match.getResource(); - String result = null; + String result = ""; String path = (resource != null ) ? resource.getFullPath().toString() : ""; switch( getOrder() ){