use of org.eclipse.search.ui.ISearchQuery in project che by eclipse.
the class QueryManager method removeAll.
public void removeAll() {
synchronized (this) {
List old = fQueries;
fQueries = new LinkedList();
Iterator iter = old.iterator();
while (iter.hasNext()) {
ISearchQuery element = (ISearchQuery) iter.next();
fireRemoved(element);
}
}
}
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 eclipse.platform.text by eclipse.
the class ShowSearchHistoryDialogAction method run.
@Override
public void run() {
ISearchQuery[] queries = NewSearchUI.getQueries();
ArrayList<ISearchResult> input = new ArrayList<>();
for (ISearchQuery query : queries) {
ISearchResult search = query.getSearchResult();
input.add(search);
}
SearchHistorySelectionDialog dlg = new SearchHistorySelectionDialog(SearchPlugin.getActiveWorkbenchShell(), input);
ISearchResult current = fSearchView.getCurrentSearchResult();
if (current != null) {
Object[] selected = new Object[1];
selected[0] = current;
dlg.setInitialSelections(selected);
}
if (dlg.open() == Window.OK) {
Object[] result = dlg.getResult();
if (result != null && result.length == 1) {
ISearchResult searchResult = (ISearchResult) result[0];
InternalSearchUI.getInstance().showSearchResult(fSearchView, searchResult, dlg.isOpenInNewView());
}
}
}
use of org.eclipse.search.ui.ISearchQuery in project eclipse.platform.text by eclipse.
the class PositionTracker method bufferCreated.
// IFileBufferListener implementation ---------------------------------------------------------------------
@Override
public void bufferCreated(IFileBuffer buffer) {
final int[] trackCount = new int[1];
if (!(buffer instanceof ITextFileBuffer))
return;
IPath location = buffer.getLocation();
if (location == null)
return;
IFile file = FileBuffers.getWorkspaceFileAtLocation(location);
if (file == null)
return;
ISearchQuery[] queries = NewSearchUI.getQueries();
for (ISearchQuery query : queries) {
ISearchResult result = query.getSearchResult();
if (result instanceof AbstractTextSearchResult) {
AbstractTextSearchResult textResult = (AbstractTextSearchResult) result;
IFileMatchAdapter adapter = textResult.getFileMatchAdapter();
if (adapter != null) {
Match[] matches = adapter.computeContainedMatches(textResult, file);
for (Match match : matches) {
trackCount[0]++;
trackPosition((AbstractTextSearchResult) result, (ITextFileBuffer) buffer, match);
}
}
}
}
}
use of org.eclipse.search.ui.ISearchQuery in project eclipse.platform.text by eclipse.
the class RetrieverAction method run.
@Override
public void run() {
IWorkbenchPage page = getWorkbenchPage();
if (page == null) {
return;
}
TextSearchQueryProvider provider = TextSearchQueryProvider.getPreferred();
String searchForString = getSearchForString(page);
if (searchForString.length() == 0) {
MessageDialog.openInformation(getShell(), SearchMessages.RetrieverAction_dialog_title, SearchMessages.RetrieverAction_empty_selection);
return;
}
try {
ISearchQuery query = createQuery(provider, searchForString);
if (query != null) {
NewSearchUI.runQueryInBackground(query);
}
} catch (OperationCanceledException ex) {
// action cancelled
} catch (CoreException e) {
ErrorDialog.openError(getShell(), SearchMessages.RetrieverAction_error_title, SearchMessages.RetrieverAction_error_message, e.getStatus());
}
}
Aggregations