use of org.eclipse.search.ui.text.TextSearchQueryProvider 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());
}
}
use of org.eclipse.search.ui.text.TextSearchQueryProvider in project eclipse.platform.text by eclipse.
the class TextSearchQueryProviderRegistry method createFromExtension.
private TextSearchQueryProvider createFromExtension(final String id) {
final TextSearchQueryProvider[] res = new TextSearchQueryProvider[] { null };
SafeRunnable safe = new SafeRunnable() {
@Override
public void run() throws Exception {
IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID);
for (IConfigurationElement curr : extensions) {
if (PROVIDER_NODE_NAME.equals(curr.getName()) && id.equals(curr.getAttribute(ATTRIB_ID))) {
res[0] = (TextSearchQueryProvider) curr.createExecutableExtension(ATTRIB_CLASS);
return;
}
}
}
@Override
public void handleException(Throwable e) {
SearchPlugin.log(e);
}
};
SafeRunnable.run(safe);
return res[0];
}
Aggregations