當前位置: 首頁>>代碼示例>>Java>>正文


Java SearchEngine.searchAllTypeNames方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.search.SearchEngine.searchAllTypeNames方法的典型用法代碼示例。如果您正苦於以下問題:Java SearchEngine.searchAllTypeNames方法的具體用法?Java SearchEngine.searchAllTypeNames怎麽用?Java SearchEngine.searchAllTypeNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.search.SearchEngine的用法示例。


在下文中一共展示了SearchEngine.searchAllTypeNames方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findType

import org.eclipse.jdt.core.search.SearchEngine; //導入方法依賴的package包/類
/**
 * Find type
 * 
 * @param className
 * @param monitor
 * @return type or <code>null</code>
 */
public IType findType(String className, IProgressMonitor monitor) {
	final IType[] result = { null };
	TypeNameMatchRequestor nameMatchRequestor = new TypeNameMatchRequestor() {
		@Override
		public void acceptTypeNameMatch(TypeNameMatch match) {
			result[0] = match.getType();
		}
	};
	int lastDot = className.lastIndexOf('.');
	char[] packageName = lastDot >= 0 ? className.substring(0, lastDot).toCharArray() : null;
	char[] typeName = (lastDot >= 0 ? className.substring(lastDot + 1) : className).toCharArray();
	SearchEngine engine = new SearchEngine();
	int packageMatchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
	try {
		engine.searchAllTypeNames(packageName, packageMatchRule, typeName, packageMatchRule, IJavaSearchConstants.TYPE,
				SearchEngine.createWorkspaceScope(), nameMatchRequestor,
				IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, monitor);
	} catch (JavaModelException e) {
		EditorUtil.INSTANCE.logError("Was not able to search all type names",e);
	}
	return result[0];
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:30,代碼來源:JDTDataAccess.java

示例2: findTypeByFqn

import org.eclipse.jdt.core.search.SearchEngine; //導入方法依賴的package包/類
private List<IType> findTypeByFqn(char[][] packages, char[][] names, IJavaSearchScope scope)
    throws JavaModelException {
  List<IType> result = new ArrayList<>();

  SearchEngine searchEngine = new SearchEngine();
  searchEngine.searchAllTypeNames(
      packages,
      names,
      scope,
      new TypeNameMatchRequestor() {
        @Override
        public void acceptTypeNameMatch(TypeNameMatch typeNameMatch) {
          result.add(typeNameMatch.getType());
        }
      },
      IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
      new NullProgressMonitor());
  return result;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:20,代碼來源:JavaDebuggerUtils.java

示例3: waitUntilIndexesReady

import org.eclipse.jdt.core.search.SearchEngine; //導入方法依賴的package包/類
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, "[email protected]$#[email protected]".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) {
  }
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:14,代碼來源:AbstractJavaModelTests.java

示例4: getSearchResult

import org.eclipse.jdt.core.search.SearchEngine; //導入方法依賴的package包/類
@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;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:28,代碼來源:TypeInfoViewer.java

示例5: fillContentProvider

import org.eclipse.jdt.core.search.SearchEngine; //導入方法依賴的package包/類
@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);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:34,代碼來源:FilteredTypesSelectionDialog.java

示例6: searchJavaType

import org.eclipse.jdt.core.search.SearchEngine; //導入方法依賴的package包/類
public static void searchJavaType(String matchString, IJavaSearchScope scope,
	TypeNameRequestor requestor) throws JavaModelException
{
	char[] searchPkg = null;
	char[] searchType = null;
	if (matchString != null && matchString.length() > 0)
	{
		char[] match = matchString.toCharArray();
		int lastDotPos = matchString.lastIndexOf('.');
		if (lastDotPos == -1)
		{
			searchType = match;
		}
		else
		{
			if (lastDotPos + 1 < match.length)
			{
				searchType = CharOperation.lastSegment(match, '.');
			}
			searchPkg = Arrays.copyOfRange(match, 0, lastDotPos);
		}
	}
	SearchEngine searchEngine = new SearchEngine();
	searchEngine.searchAllTypeNames(searchPkg, SearchPattern.R_PREFIX_MATCH, searchType,
		SearchPattern.R_CAMELCASE_MATCH, IJavaSearchConstants.CLASS, scope, requestor,
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null);
}
 
開發者ID:mybatis,項目名稱:mybatipse,代碼行數:28,代碼來源:ProposalComputorHelper.java


注:本文中的org.eclipse.jdt.core.search.SearchEngine.searchAllTypeNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。