use of org.eclipse.search.ui.ISearchQuery in project eclipse.platform.text by eclipse.
the class InternalSearchUI method removeAllQueries.
public void removeAllQueries() {
for (ISearchQuery query : fSearchJobs.keySet()) {
cancelSearch(query);
}
fSearchJobs.clear();
getSearchManager().removeAll();
}
use of org.eclipse.search.ui.ISearchQuery in project eclipse.platform.text by eclipse.
the class SearchAgainAction method run.
@Override
public void run() {
final ISearchResult search = fView.getCurrentSearchResult();
if (search != null) {
ISearchQuery query = search.getQuery();
NewSearchUI.cancelQuery(query);
if (query.canRerun()) {
if (query.canRunInBackground())
NewSearchUI.runQueryInBackground(query, fView);
else {
Shell shell = fView.getSite().getShell();
ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
IStatus status = NewSearchUI.runQueryInForeground(pmd, query, fView);
if (!status.isOK() && status.getSeverity() != IStatus.CANCEL) {
ErrorDialog.openError(shell, SearchMessages.SearchAgainAction_Error_title, SearchMessages.SearchAgainAction_Error_message, status);
}
}
}
}
}
use of org.eclipse.search.ui.ISearchQuery in project eclipse.platform.text by eclipse.
the class SearchHistoryDropDownAction method getMenu.
@Override
public Menu getMenu(Control parent) {
ISearchResult currentSearch = fSearchView.getCurrentSearchResult();
disposeMenu();
fMenu = new Menu(parent);
ISearchQuery[] searches = NewSearchUI.getQueries();
if (searches.length > 0) {
for (ISearchQuery search : searches) {
ISearchResult searchResult = search.getSearchResult();
ShowSearchFromHistoryAction action = new ShowSearchFromHistoryAction(searchResult);
action.setChecked(searchResult.equals(currentSearch));
addActionToMenu(fMenu, action);
}
new MenuItem(fMenu, SWT.SEPARATOR);
addActionToMenu(fMenu, new ShowSearchHistoryDialogAction(fSearchView));
addActionToMenu(fMenu, new RemoveAllSearchesAction());
}
return fMenu;
}
use of org.eclipse.search.ui.ISearchQuery in project eclipse.platform.text by eclipse.
the class SearchHistorySelectionDialog method okPressed.
/*
* Overrides method from Dialog
*/
@Override
protected void okPressed() {
// Build a list of selected children.
ISelection selection = fViewer.getSelection();
if (selection instanceof IStructuredSelection)
setResult(((IStructuredSelection) fViewer.getSelection()).toList());
// remove queries
for (ISearchResult result : fRemovedEntries) {
ISearchQuery query = result.getQuery();
if (query != null) {
// must not be null: invalid implementation of a search query
InternalSearchUI.getInstance().removeQuery(query);
}
}
super.okPressed();
}
use of org.eclipse.search.ui.ISearchQuery in project webtools.sourceediting by eclipse.
the class FindOccurrencesProcessor method findOccurrences.
public boolean findOccurrences(IDocument document, ITextSelection textSelection, IFile file) {
boolean findOccurrences = false;
// determine if action should be enabled or not
if (document instanceof IStructuredDocument) {
IStructuredDocument structuredDocument = (IStructuredDocument) document;
IStructuredDocumentRegion sdRegion = structuredDocument.getRegionAtCharacterOffset(textSelection.getOffset());
if (sdRegion != null) {
ITextRegion r = sdRegion.getRegionAtCharacterOffset(textSelection.getOffset());
if (r != null) {
String type = r.getType();
if (enabledForRegionType(type)) {
String matchText = sdRegion.getText(r);
// first of all activate the view
NewSearchUI.activateSearchResultView();
if (matchText != null && type != null) {
ISearchQuery searchQuery = getSearchQuery(file, structuredDocument, matchText, type, textSelection);
if (searchQuery != null) {
if (searchQuery.canRunInBackground())
NewSearchUI.runQueryInBackground(searchQuery);
else
NewSearchUI.runQueryInForeground(null, searchQuery);
}
findOccurrences = true;
}
}
}
}
}
return findOccurrences;
}
Aggregations