use of org.eclipse.search.ui.ISearchQuery in project eclipse.platform.text by eclipse.
the class TestSearchResult method testRemoveMatch.
@Test
public void testRemoveMatch() {
ISearchQuery query = new NullQuery();
AbstractTextSearchResult result = (AbstractTextSearchResult) query.getSearchResult();
// $NON-NLS-1$
String object = "object";
Match match1 = new Match(object, 0, 0);
result.addMatch(match1);
Match match2 = new Match(object, 0, 0);
result.addMatch(match2);
assertEquals(result.getMatchCount(), 2);
result.removeMatch(match1);
assertEquals(result.getMatchCount(), 1);
result.removeMatch(match1);
assertEquals(result.getMatchCount(), 1);
}
use of org.eclipse.search.ui.ISearchQuery in project xtext-eclipse by eclipse.
the class CompositeSearchQuery method run.
@Override
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
SubMonitor progress = SubMonitor.convert(monitor, children.size());
MultiStatus multiStatus = new MultiStatus(getPluginId(), IStatus.OK, "Composite search state", null);
for (ISearchQuery child : children) {
IStatus status = child.run(progress.newChild(1));
multiStatus.add(status);
if (progress.isCanceled()) {
return Status.CANCEL_STATUS;
}
}
return multiStatus;
}
use of org.eclipse.search.ui.ISearchQuery in project titan.EclipsePlug-ins by eclipse.
the class LogSearchPage method performAction.
@Override
public boolean performAction() {
List<IFile> files = collectFilesForSearch();
LogSearchQuery query = new LogSearchQuery(files, getPattern());
for (ISearchQuery runningQuery : NewSearchUI.getQueries()) {
NewSearchUI.cancelQuery(runningQuery);
}
NewSearchUI.runQueryInBackground(query);
return true;
}
use of org.eclipse.search.ui.ISearchQuery in project titan.EclipsePlug-ins by eclipse.
the class ReferenceSearch method runAction.
/**
* Helper function used by FindReferences classes for TTCN-3, ASN.1 and
* TTCNPP editors
*/
public static void runAction(final IEditorPart targetEditor, final ISelection selection) {
targetEditor.getEditorSite().getActionBars().getStatusLineManager().setErrorMessage(null);
IFile file = (IFile) targetEditor.getEditorInput().getAdapter(IFile.class);
if (file == null) {
targetEditor.getEditorSite().getActionBars().getStatusLineManager().setErrorMessage(FILENOTIDENTIFIABLE);
return;
}
if (!TITANNature.hasTITANNature(file.getProject())) {
targetEditor.getEditorSite().getActionBars().getStatusLineManager().setErrorMessage(TITANNature.NO_TITAN_FILE_NATURE_FOUND);
return;
}
IPreferencesService prefs = Platform.getPreferencesService();
boolean reportDebugInformation = prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.DISPLAYDEBUGINFORMATION, true, null);
int offset;
if (selection instanceof TextSelection && !selection.isEmpty() && !"".equals(((TextSelection) selection).getText())) {
if (reportDebugInformation) {
TITANDebugConsole.println("text selected: " + ((TextSelection) selection).getText());
}
TextSelection tSelection = (TextSelection) selection;
offset = tSelection.getOffset() + tSelection.getLength();
} else {
offset = ((IEditorWithCarretOffset) targetEditor).getCarretOffset();
}
// find the module
ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(file.getProject());
if (ResourceExclusionHelper.isExcluded(file)) {
targetEditor.getEditorSite().getActionBars().getStatusLineManager().setErrorMessage(MessageFormat.format(EXCLUDEDFROMBUILD, file.getFullPath()));
return;
}
final Module module = projectSourceParser.containedModule(file);
if (module == null) {
targetEditor.getEditorSite().getActionBars().getStatusLineManager().setErrorMessage(MessageFormat.format(NOTFOUNDMODULE, file.getName()));
return;
}
final ReferenceFinder rf = new ReferenceFinder();
boolean isDetected = rf.detectAssignmentDataByOffset(module, offset, targetEditor, true, reportDebugInformation);
if (!isDetected) {
return;
}
final ReferenceSearchQuery query = new ReferenceSearchQuery(rf, module, file.getProject());
for (ISearchQuery runningQuery : NewSearchUI.getQueries()) {
NewSearchUI.cancelQuery(runningQuery);
}
NewSearchUI.runQueryInBackground(query);
}
use of org.eclipse.search.ui.ISearchQuery in project che by eclipse.
the class InternalSearchUI method removeAllQueries.
public void removeAllQueries() {
for (Iterator queries = fSearchJobs.keySet().iterator(); queries.hasNext(); ) {
ISearchQuery query = (ISearchQuery) queries.next();
cancelSearch(query);
}
fSearchJobs.clear();
getSearchManager().removeAll();
}
Aggregations