Java Code Examples for org.eclipse.search.ui.NewSearchUI#runQueryInBackground()
The following examples show how to use
org.eclipse.search.ui.NewSearchUI#runQueryInBackground() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Implementations.java From corrosion with Eclipse Public License 2.0 | 6 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IEditorPart part = HandlerUtil.getActiveEditor(event); if (part instanceof ITextEditor) { Collection<LSPDocumentInfo> infos = LanguageServiceAccessor.getLSPDocumentInfosFor( LSPEclipseUtils.getDocument((ITextEditor) part), capabilities -> Boolean.TRUE.equals(capabilities.getReferencesProvider())); if (!infos.isEmpty()) { LSPDocumentInfo info = infos.iterator().next(); ISelection sel = ((AbstractTextEditor) part).getSelectionProvider().getSelection(); if (sel instanceof TextSelection) { try { int offset = ((TextSelection) sel).getOffset(); ImplementationsSearchQuery query = new ImplementationsSearchQuery(offset, info); NewSearchUI.runQueryInBackground(query); } catch (BadLocationException e) { LanguageServerPlugin.logError(e); } } } } return null; }
Example 2
Source File: FindAction.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public void run() { ITextSelection textSelection = getSelectedStringFromEditor(); if (textSelection != null) { ISourceViewer textViewer = (ISourceViewer)editor.getAdapter(ISourceViewer.class); PstLeafNode pstLeafNode = ModulaEditorSymbolUtils.getIdentifierPstLeafNode(editor, textSelection.getOffset()); if (pstLeafNode != null) { IModulaSymbol symbol = ModulaEditorSymbolUtils.getModulaSymbol( textViewer.getDocument(), pstLeafNode ); IResource searchScope = getSearchScope(); if (symbol != null && searchScope != null) { NewSearchUI.activateSearchResultView(); NewSearchUI.runQueryInBackground(new ModulaSearchQuery(getInput(symbol, searchScope))); } } } }
Example 3
Source File: ModulaSearchPage.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public boolean performAction() { saveQueryData(); NewSearchUI.activateSearchResultView(); NewSearchUI.runQueryInBackground(new ModulaSearchQuery(getInput())); return true; }
Example 4
Source File: SearchWholeWordAction.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public void run(IAction action) { final String pattern = getPattern(); if (pattern.isEmpty()) { return; } try { ISearchQuery query = TextSearchQueryProvider.getPreferred().createQuery(new TextSearchInput() { @Override public boolean isRegExSearch() { return true; } @Override public boolean isCaseSensitiveSearch() { return true; } @Override public String getSearchText() { return pattern; } @Override public FileTextSearchScope getScope() { return SearchWholeWordAction.this.getScope(); //$NON-NLS-1$ } }); NewSearchUI.runQueryInBackground(query); } catch (CoreException e) { e.printStackTrace(); } return; }
Example 5
Source File: ReferencesCodeLens.java From typescript.java with MIT License | 5 votes |
@Override public void open() { // Execute Search try { int offset = tsFile.getPosition(getRange().startLineNumber, getRange().startColumn); TypeScriptSearchQuery query = new TypeScriptSearchQuery(tsFile.getResource(), offset); NewSearchUI.runQueryInBackground(query); } catch (TypeScriptException e) { e.printStackTrace(); } }
Example 6
Source File: FindHelper.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private static void performFind(final String searchText, final boolean caseSensitive, final boolean isRegEx, final FileTextSearchScope searchScope) { try { ISearchQuery query = TextSearchQueryProvider.getPreferred().createQuery(new TextSearchInput() { public boolean isRegExSearch() { return isRegEx; } public boolean isCaseSensitiveSearch() { return caseSensitive; } public String getSearchText() { return searchText; } public FileTextSearchScope getScope() { return searchScope; //$NON-NLS-1$ } }); NewSearchUI.runQueryInBackground(query); } catch (CoreException e1) { FindBarPlugin.log(e1); } }
Example 7
Source File: TagsSearchHandler.java From e4macs with Eclipse Public License 1.0 | 5 votes |
/** * @see com.mulgasoft.emacsplus.commands.MinibufferExecHandler#doExecuteResult(org.eclipse.ui.texteditor.ITextEditor, java.lang.Object) */ public boolean doExecuteResult(ITextEditor editor, Object minibufferResult) { TextSearchQueryProvider provider= TextSearchQueryProvider.getPreferred(); ISearchResult result = (ISearchResult)minibufferResult; try { ISearchQuery query= provider.createQuery(getTextInput(result.getSearchStr(),result.isCaseSensitive(),getInputObject(editor))); if (query != null) { // and execute the search NewSearchUI.runQueryInBackground(query); } } catch (OperationCanceledException ex) { // action canceled } catch (CoreException e) {} return true; }
Example 8
Source File: PyFindAllOccurrences.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override protected String perform(IAction action, IProgressMonitor monitor) throws Exception { IPyRefactoring2 r = (IPyRefactoring2) AbstractPyRefactoring.getPyRefactoring(); RefactoringRequest req = getRefactoringRequest(new NullProgressMonitor()); //as we're doing it in the background req.fillInitialNameAndOffset(); if (req.initialName != null && req.initialName.trim().length() > 0) { NewSearchUI.runQueryInBackground(newQuery(r, req)); } return null; }
Example 9
Source File: PySearchIndexPage.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public boolean performAction() { ScopeAndData scopeAndData = getScopeAndData(); SearchIndexData data = new SearchIndexData(fPattern.getText(), fIsCaseSensitiveCheckbox.getSelection(), fIsWholeWordCheckbox.getSelection(), scopeAndData.scope, scopeAndData.scopeData, "*"); // filenamePattern is always * for Python searches (we'll always be searching the whole index). PySearchIndexQuery query = new PySearchIndexQuery(data); NewSearchUI.runQueryInBackground(query); searchIndexDataHistory.add(data); searchIndexDataHistory.writeConfiguration(); return true; }
Example 10
Source File: GoSearchPage.java From goclipse with Eclipse Public License 1.0 | 5 votes |
@Override public boolean performAction() { try { NewSearchUI.runQueryInBackground(newQuery()); } catch (CoreException e) { ErrorDialog.openError(getShell(), "Search", "Problems occurred while searching. The affected files will be skipped.", e.getStatus()); return false; } return true; }
Example 11
Source File: ReferenceQueryExecutor.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
public void execute() { NewSearchUI.activateSearchResultView(); NewSearchUI.runQueryInBackground(referenceQuery); }
Example 12
Source File: ReferencesInBinaryStatusContextViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected void fillInSearchView() { NewSearchUI.runQueryInBackground(new ReferencesInBinarySearchQuery(fInput), null); fButton.setEnabled(false); }
Example 13
Source File: SearchBrokenNLSKeysUtil.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public static void search(String scopeName, IType[] accessorClasses, IFile[] propertieFiles) { NLSSearchQuery query= new NLSSearchQuery(accessorClasses, propertieFiles, SearchEngine.createWorkspaceScope(), scopeName); NewSearchUI.runQueryInBackground(query); }
Example 14
Source File: FindOccurrencesEngine.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void performNewSearch(IOccurrencesFinder finder, ITypeRoot element) { NewSearchUI.runQueryInBackground(new OccurrencesSearchQuery(finder, element)); }
Example 15
Source File: FindInOpenDocuments.java From Pydev with Eclipse Public License 1.0 | 4 votes |
/** * Here, all the editors available will be gotten and searched (if possible). * * Note that editors that are not in the workspace may not be searched (it should be possible * to do, but one may have to reimplement large portions of the search for that to work). */ public static void findInOpenDocuments(final String searchText, final boolean caseSensitive, final boolean wholeWord, final boolean isRegEx, IStatusLineManager statusLineManager) { final List<Object> opened = EditorUtils.getFilesInOpenEditors(statusLineManager); final List<IFile> files = new ArrayList<>(opened.size()); for (Object object : opened) { if (object instanceof IFile) { files.add((IFile) object); } } if (files.size() == 0) { if (statusLineManager != null) { statusLineManager .setMessage( "No file was found to perform the search (editors not in the workspace cannot be searched)."); } return; } try { ISearchQuery query = TextSearchQueryProvider.getPreferred().createQuery(new TextSearchInput() { @Override public boolean isRegExSearch() { return isRegEx; } @Override public boolean isCaseSensitiveSearch() { return caseSensitive; } @Override public String getSearchText() { return searchText; } @Override public FileTextSearchScope getScope() { return FileTextSearchScope.newSearchScope(files.toArray(new IResource[files.size()]), new String[] { "*" }, true); } }); NewSearchUI.runQueryInBackground(query); } catch (CoreException e1) { Log.log(e1); } }
Example 16
Source File: SearchUtil.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * This helper method with Object as parameter is needed to prevent the loading * of the Search plug-in: the VM verifies the method call and hence loads the * types used in the method signature, eventually triggering the loading of * a plug-in (in this case ISearchQuery results in Search plug-in being loaded). * * @param query the search query */ public static void runQueryInBackground(Object query) { NewSearchUI.runQueryInBackground((ISearchQuery)query); }