mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for CSearchQuery M8 changes
This commit is contained in:
parent
4d5a0e4e7c
commit
c1b941c286
5 changed files with 83 additions and 48 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue