Java Code Examples for org.eclipse.jdt.core.search.SearchEngine#searchAllTypeNames()
The following examples show how to use
org.eclipse.jdt.core.search.SearchEngine#searchAllTypeNames() .
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: AbstractJavaModelTests.java From dacapobench with Apache License 2.0 | 5 votes |
public static void waitUntilIndexesReady() { // dummy query for waiting until the indexes are ready SearchEngine engine = new SearchEngine(); IJavaSearchScope scope = SearchEngine.createWorkspaceScope(); try { engine.searchAllTypeNames(null, SearchPattern.R_EXACT_MATCH, "!@$#!@".toCharArray(), SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE, IJavaSearchConstants.CLASS, scope, new TypeNameRequestor() { public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { } }, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); } catch (CoreException e) { } }
Example 2
Source File: TypeInfoViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected TypeNameMatch[] getSearchResult(Set matchIdsInHistory, ProgressMonitor monitor) throws CoreException { long start= System.currentTimeMillis(); fReqestor.setHistory(matchIdsInHistory); // consider primary working copies during searching SearchEngine engine= new SearchEngine((WorkingCopyOwner)null); String packPattern= fFilter.getPackagePattern(); monitor.setTaskName(JavaUIMessages.TypeInfoViewer_searchJob_taskName); engine.searchAllTypeNames( packPattern == null ? null : packPattern.toCharArray(), fFilter.getPackageFlags(), fFilter.getNamePattern().toCharArray(), fFilter.getSearchFlags(), fElementKind, fScope, fReqestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, monitor); if (DEBUG) System.out.println("Time needed until search has finished: " + (System.currentTimeMillis() - start)); //$NON-NLS-1$ TypeNameMatch[] result= fReqestor.getResult(); Arrays.sort(result, new TypeInfoComparator(fLabelProvider, fFilter)); if (DEBUG) System.out.println("Time needed until sort has finished: " + (System.currentTimeMillis() - start)); //$NON-NLS-1$ fViewer.rememberResult(fTicket, result); return result; }
Example 3
Source File: FilteredTypesSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected void fillContentProvider(AbstractContentProvider provider, ItemsFilter itemsFilter, IProgressMonitor progressMonitor) throws CoreException { TypeItemsFilter typeSearchFilter= (TypeItemsFilter) itemsFilter; TypeSearchRequestor requestor= new TypeSearchRequestor(provider, typeSearchFilter); SearchEngine engine= new SearchEngine((WorkingCopyOwner) null); String packPattern= typeSearchFilter.getPackagePattern(); progressMonitor.setTaskName(JavaUIMessages.FilteredTypesSelectionDialog_searchJob_taskName); /* * Setting the filter into match everything mode avoids filtering twice * by the same pattern (the search engine only provides filtered * matches). For the case when the pattern is a camel case pattern with * a terminator, the filter is not set to match everything mode because * jdt.core's SearchPattern does not support that case. */ String typePattern= typeSearchFilter.getNamePattern(); int matchRule= typeSearchFilter.getMatchRule(); typeSearchFilter.setMatchEverythingMode(true); try { engine.searchAllTypeNames(packPattern == null ? null : packPattern.toCharArray(), typeSearchFilter.getPackageFlags(), typePattern.toCharArray(), matchRule, typeSearchFilter.getElementKind(), typeSearchFilter.getSearchScope(), requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, progressMonitor); } finally { typeSearchFilter.setMatchEverythingMode(false); } }
Example 4
Source File: SourceRepositoryStore.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private boolean isSourceType(final String qualifiedClassname, final IJavaProject javaProject) throws JavaModelException { final SearchEngine sEngine = new SearchEngine(); final IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new IJavaElement[] { javaProject }, IJavaSearchScope.SOURCES); final TypeNameFoundRequestor nameRequestor = new TypeNameFoundRequestor(); sEngine.searchAllTypeNames(NamingUtils.getPackageName(qualifiedClassname).toCharArray(), SearchPattern.R_EXACT_MATCH, NamingUtils.getSimpleName(qualifiedClassname) .toCharArray(), SearchPattern.R_EXACT_MATCH, IJavaSearchConstants.CLASS_AND_INTERFACE, searchScope, nameRequestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, Repository.NULL_PROGRESS_MONITOR); return nameRequestor.isFound(); }