Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorBogdan Gheorghe2004-03-29 11:51:35 -0500
committerBogdan Gheorghe2004-03-29 11:51:35 -0500
commitc1b941c2869cef0a71bb7e90f5e0b60842481214 (patch)
tree6e6fc56a412090fb4f935468ffc52d67fc8d84a0 /core
parent4d5a0e4e7cd55c735ecba08046b42456fd37612d (diff)
downloadorg.eclipse.cdt-c1b941c2869cef0a71bb7e90f5e0b60842481214.tar.gz
org.eclipse.cdt-c1b941c2869cef0a71bb7e90f5e0b60842481214.tar.xz
org.eclipse.cdt-c1b941c2869cef0a71bb7e90f5e0b60842481214.zip
Fix for CSearchQuery M8 changes
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java107
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResult.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java5
5 files changed, 83 insertions, 48 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
index 1465b7e692..751181b251 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
@@ -95,3 +95,9 @@ CElementLabels.concat_string=\ -\
CElementLabels.comma_string=,\
CElementLabels.declseparator_string=\ :\
CSearchResultCollector.4=IMatchObject
+
+CSearchQuery.searchfor_references=Search for References
+CSearchQuery.searchfor_declarations=Search for Declarations
+CSearchQuery.searchfor_definitions=Search for Definitions
+CSearchQuery.searchfor_all=Search for All Occurrences
+CSearchQuery.search_label=Search
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 b17b3f66fa..dc79381bce 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
@@ -16,7 +16,6 @@ package org.eclipse.cdt.internal.ui.search;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -58,7 +57,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -146,7 +144,7 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
CSearchQuery job = new CSearchQuery(workspace, data.pattern, data.isCaseSensitive, searching, data.limitTo, scope, scopeDescription, collector);
//NewSearchUI.activateSearchResultView();
CSearchResult result = new CSearchResult(job);
- NewSearchUI.runSearchInBackground(job, result);
+ NewSearchUI.runQuery(job);
return true;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java
index 3b68d2d913..5335474c3c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchQuery.java
@@ -55,45 +55,7 @@ public class CSearchQuery implements ISearchQuery, ICSearchConstants {
_collector = collector;
_collector.setOperation( this );
}
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchQuery#run(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.search.ui.ISearchResult)
- */
- public IStatus run(IProgressMonitor monitor, ISearchResult result) {
- _collector.setProgressMonitor( monitor );
-
- SearchEngine engine = new SearchEngine( CUIPlugin.getSharedWorkingCopies() );
-
- ICSearchPattern pattern = null;
- if( _searchFor.size() > 1 ){
- OrPattern orPattern = new OrPattern();
- for (Iterator iter = _searchFor.iterator(); iter.hasNext();) {
- SearchFor element = (SearchFor)iter.next();
- orPattern.addPattern( SearchEngine.createSearchPattern( _stringPattern, element, _limitTo, _caseSensitive ) );
- }
-
- pattern = orPattern;
-
- } else {
- Iterator iter = _searchFor.iterator();
- pattern = SearchEngine.createSearchPattern( _stringPattern, (SearchFor)iter.next(), _limitTo, _caseSensitive );
- }
-
- try {
- engine.search( _workspace, pattern, _scope, _collector, false );
- } catch (InterruptedException e) {
- }
-
- return new Status(IStatus.OK, CUIPlugin.getPluginId(),0,"",null); //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * @see org.eclipse.search.ui.ISearchQuery#getName()
- */
- public String getName() {
- // TODO Auto-generated method stub
- return "CDT Search Job"; //$NON-NLS-1$
- }
-
/**
* @return
*/
@@ -149,4 +111,73 @@ public class CSearchQuery implements ISearchQuery, ICSearchConstants {
return CPluginImages.DESC_OBJS_SEARCH_REF;
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.search.ui.ISearchQuery#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public IStatus run(IProgressMonitor monitor) {
+ _collector.setProgressMonitor( monitor );
+
+ SearchEngine engine = new SearchEngine( CUIPlugin.getSharedWorkingCopies() );
+
+ ICSearchPattern pattern = null;
+ if( _searchFor.size() > 1 ){
+ OrPattern orPattern = new OrPattern();
+ for (Iterator iter = _searchFor.iterator(); iter.hasNext();) {
+ SearchFor element = (SearchFor)iter.next();
+ orPattern.addPattern( SearchEngine.createSearchPattern( _stringPattern, element, _limitTo, _caseSensitive ) );
+ }
+
+ pattern = orPattern;
+
+ } else {
+ Iterator iter = _searchFor.iterator();
+ pattern = SearchEngine.createSearchPattern( _stringPattern, (SearchFor)iter.next(), _limitTo, _caseSensitive );
+ }
+
+ try {
+ engine.search( _workspace, pattern, _scope, _collector, false );
+ } catch (InterruptedException e) {
+ }
+
+ return new Status(IStatus.OK, CUIPlugin.getPluginId(),0,"",null); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.search.ui.ISearchQuery#getLabel()
+ */
+ public String getLabel() {
+ if (_limitTo == REFERENCES)
+ return CSearchMessages.getString("CSearchQuery.searchfor_references"); //$NON-NLS-1$
+ else if (_limitTo == DECLARATIONS)
+ return CSearchMessages.getString("CSearchQuery.searchfor_declarations"); //$NON-NLS-1$
+ else if (_limitTo == DEFINITIONS)
+ return CSearchMessages.getString("CSearchQuery.searchfor_definitions"); //$NON-NLS-1$
+ else if (_limitTo == ALL_OCCURRENCES)
+ return CSearchMessages.getString("CSearchQuery.searchfor_all"); //$NON-NLS-1$
+
+ return CSearchMessages.getString("CSearchQuery.search_label"); //$NON-NLS-1$;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.search.ui.ISearchQuery#canRerun()
+ */
+ public boolean canRerun() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.search.ui.ISearchQuery#canRunInBackground()
+ */
+ public boolean canRunInBackground() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.search.ui.ISearchQuery#getSearchResult()
+ */
+ public ISearchResult getSearchResult() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
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 87e6d404a2..4a815b1cee 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
@@ -11,7 +11,6 @@ import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IParent;
@@ -134,7 +133,13 @@ public class CSearchResult extends AbstractTextSearchResult {
* @see org.eclipse.search.ui.ISearchResult#getQuery()
*/
public ISearchQuery getQuery() {
- // TODO Auto-generated method stub
return cQuery;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.search.ui.ISearchResult#getLabel()
+ */
+ public String getLabel() {
+ return cQuery.getLabel();
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java
index c29edbe80a..a6885e5469 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java
@@ -22,17 +22,12 @@ import org.eclipse.cdt.core.search.BasicSearchResultCollector;
import org.eclipse.cdt.core.search.IMatch;
import org.eclipse.cdt.ui.CSearchResultLabelProvider;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IPathVariableManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.search.ui.IGroupByKeyComputer;
import org.eclipse.search.ui.ISearchResultView;
import org.eclipse.search.ui.SearchUI;

Back to the top