当前位置: 首页>>代码示例>>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;未经允许,请勿转载。