org.eclipse.search.ui.ISearchQuery Java Examples
The following examples show how to use
org.eclipse.search.ui.ISearchQuery.
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: CompositeSearchResult.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public CompositeSearchResult(CompositeSearchQuery compositeSearchQuery) { super(compositeSearchQuery); this.query = compositeSearchQuery; Assert.isLegal(!query.getChildren().isEmpty()); childListener = new ISearchResultListener() { int removeAll = 0; @Override public void searchResultChanged(SearchResultEvent e) { if(!(e instanceof RemoveAllEvent) || removeAll++%query.getChildren().size() == 0) fireChange(e); } }; for(ISearchQuery child: query.getChildren()) child.getSearchResult().addListener(childListener); }
Example #2
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 #3
Source File: SearchResultUpdater.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public void queryRemoved(ISearchQuery query) { if (fResult.equals(query.getSearchResult())) { ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); NewSearchUI.removeQueryListener(this); } }
Example #4
Source File: SearchResultUpdater.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public void queryRemoved(ISearchQuery query) { if (fResult.equals(query.getSearchResult())) { ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); NewSearchUI.removeQueryListener(this); } }
Example #5
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 #6
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 #7
Source File: CompositeSearchQuery.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public boolean canRunInBackground() { for(ISearchQuery child: children) if(!child.canRunInBackground()) return false; return true; }
Example #8
Source File: CompositeSearchQuery.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@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; }
Example #9
Source File: CompositeSearchResult.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public int getMatchCount(Object element) { int count = 0; for(ISearchQuery child: query.getChildren()) { ISearchResult childResult = child.getSearchResult(); if(childResult instanceof AbstractTextSearchResult) count += ((AbstractTextSearchResult) childResult).getMatchCount(element); } return count; }
Example #10
Source File: CompositeSearchResult.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public int getMatchCount() { int count = 0; for(ISearchQuery child: query.getChildren()) { ISearchResult childResult = child.getSearchResult(); if(childResult instanceof AbstractTextSearchResult) count += ((AbstractTextSearchResult) childResult).getMatchCount(); } return count; }
Example #11
Source File: CompositeSearchResult.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public Match[] getMatches(Object element) { List<Match> matches = newArrayList(); for(ISearchQuery child: query.getChildren()) { ISearchResult childResult = child.getSearchResult(); if(childResult instanceof AbstractTextSearchResult) { for(Match match: ((AbstractTextSearchResult) childResult).getMatches(element)) matches.add(match); } } return toArray(matches, Match.class); }
Example #12
Source File: CompositeSearchQuery.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public boolean canRerun() { for(ISearchQuery child: children) if(!child.canRerun()) return false; return true; }
Example #13
Source File: ReferenceSearchResult.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public ISearchQuery getQuery() { return query; }
Example #14
Source File: PythonFileSearchResult.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public ISearchQuery getQuery() { return fQuery; }
Example #15
Source File: PyFindAllOccurrences.java From Pydev with Eclipse Public License 1.0 | 4 votes |
private ISearchQuery newQuery(final IPyRefactoring2 r, final RefactoringRequest req) { return new FindOccurrencesSearchQuery(r, req); }
Example #16
Source File: SearchResultUpdater.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void queryFinished(ISearchQuery query) { // don't care }
Example #17
Source File: SearchResultUpdater.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void queryStarting(ISearchQuery query) { // don't care }
Example #18
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 #19
Source File: SearchResultUpdater.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void queryAdded(ISearchQuery query) { // don't care }
Example #20
Source File: SearchIndexResult.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public ISearchQuery getQuery() { return query; }
Example #21
Source File: AbstractSearchIndexResultPage.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public String getLabel() { StructuredViewer viewer = getViewer(); if (viewer instanceof TreeViewer) { int count = 0; TreeViewer tv = (TreeViewer) viewer; final AbstractTextSearchResult input = getInput(); if (input != null) { ViewerFilter[] filters = tv.getFilters(); if (filters != null && filters.length > 0) { Object[] elements = input.getElements(); for (int j = 0; j < elements.length; j++) { Object element = elements[j]; Match[] matches = input.getMatches(element); for (Match match : matches) { for (int i = 0; i < filters.length; i++) { ViewerFilter vf = filters[i]; if (vf instanceof AbstractSearchResultsViewerFilter) { AbstractSearchResultsViewerFilter searchResultsViewerFilter = (AbstractSearchResultsViewerFilter) vf; if (searchResultsViewerFilter.isLeafMatch(viewer, match)) { count += 1; } } } } } } else { // No active filters count = input.getMatchCount(); } } AbstractTextSearchResult result = getInput(); if (result == null) { return ""; } ISearchQuery query = result.getQuery(); if (query instanceof AbstractSearchIndexQuery) { AbstractSearchIndexQuery searchIndexQuery = (AbstractSearchIndexQuery) query; return searchIndexQuery.getResultLabel(count); } } return super.getLabel(); }
Example #22
Source File: SearchResultUpdater.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void queryFinished(ISearchQuery query) { // don't care }
Example #23
Source File: SearchResultUpdater.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void queryStarting(ISearchQuery query) { // don't care }
Example #24
Source File: SearchResultUpdater.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void queryAdded(ISearchQuery query) { // don't care }
Example #25
Source File: GoSearchPage.java From goclipse with Eclipse Public License 1.0 | 4 votes |
private ISearchQuery newQuery() throws CoreException { SearchPatternData data = getPatternData(); TextSearchPageInput input = new TextSearchPageInput(data.textPattern, data.isCaseSensitive, data.isRegExSearch, createTextSearchScope()); return TextSearchQueryProvider.getPreferred().createQuery(input); }
Example #26
Source File: JavaSearchResult.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public ISearchQuery getQuery() { return fQuery; }
Example #27
Source File: OccurrencesSearchResult.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public ISearchQuery getQuery() { return fQuery; }
Example #28
Source File: SearchResultUpdater.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void queryFinished(ISearchQuery query) { // not interested }
Example #29
Source File: SearchResultUpdater.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void queryStarting(ISearchQuery query) { // not interested }
Example #30
Source File: SearchResultUpdater.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void queryRemoved(ISearchQuery query) { if (fResult.equals(query.getSearchResult())) { JavaCore.removeElementChangedListener(this); NewSearchUI.removeQueryListener(this); } }