当前位置: 首页>>代码示例>>Java>>正文


Java CuCollectingSearchRequestor类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor的典型用法代码示例。如果您正苦于以下问题:Java CuCollectingSearchRequestor类的具体用法?Java CuCollectingSearchRequestor怎么用?Java CuCollectingSearchRequestor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CuCollectingSearchRequestor类属于org.eclipse.jdt.internal.corext.refactoring包,在下文中一共展示了CuCollectingSearchRequestor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReferences

import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] getReferences(IProgressMonitor pm, RefactoringStatus status)
    throws CoreException {
  String binaryRefsDescription =
      Messages.format(
          RefactoringCoreMessages.ReferencesInBinaryContext_ref_in_binaries_description,
          BasicElementLabels.getJavaElementName(getCurrentElementName()));
  ReferencesInBinaryContext binaryRefs = new ReferencesInBinaryContext(binaryRefsDescription);

  SearchResultGroup[] result =
      RefactoringSearchEngine.search(
          createSearchPattern(),
          createRefactoringScope(),
          new CuCollectingSearchRequestor(binaryRefs),
          pm,
          status);
  binaryRefs.addErrorIfNecessary(status);

  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:RenameFieldProcessor.java

示例2: getReferencesToTypesInPackage

import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private List<SearchResultGroup> getReferencesToTypesInPackage(IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status) throws CoreException {
	pm.beginTask("", 2); //$NON-NLS-1$
	IJavaSearchScope referencedFromNamesakesScope= RefactoringScopeFactory.create(fPackage, true, false);
	IPackageFragment[] namesakePackages= getNamesakePackages(referencedFromNamesakesScope, new SubProgressMonitor(pm, 1));
	if (namesakePackages.length == 0) {
		pm.done();
		return new ArrayList<SearchResultGroup>(0);
	}

	IJavaSearchScope scope= SearchEngine.createJavaSearchScope(namesakePackages);
	IType[] typesToSearch= getTypesInPackage(fPackage);
	if (typesToSearch.length == 0) {
		pm.done();
		return new ArrayList<SearchResultGroup>(0);
	}
	SearchPattern pattern= RefactoringSearchEngine.createOrPattern(typesToSearch, IJavaSearchConstants.REFERENCES);
	CollectingSearchRequestor requestor= new CuCollectingSearchRequestor(binaryRefs);
	SearchResultGroup[] results= RefactoringSearchEngine.search(pattern, scope, requestor, new SubProgressMonitor(pm, 1), status);
	pm.done();
	return new ArrayList<SearchResultGroup>(Arrays.asList(results));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:RenamePackageProcessor.java

示例3: getReferences

import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] getReferences(
    IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status)
    throws CoreException {
  IJavaSearchScope scope = RefactoringScopeFactory.create(fPackage, true, false);
  SearchPattern pattern =
      SearchPattern.createPattern(fPackage, IJavaSearchConstants.REFERENCES);
  CollectingSearchRequestor requestor = new CuCollectingSearchRequestor(binaryRefs);
  return RefactoringSearchEngine.search(pattern, scope, requestor, pm, status);
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:RenamePackageProcessor.java

示例4: getReferencesToTypesInPackage

import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private List<SearchResultGroup> getReferencesToTypesInPackage(
    IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status)
    throws CoreException {
  pm.beginTask("", 2); // $NON-NLS-1$
  IJavaSearchScope referencedFromNamesakesScope =
      RefactoringScopeFactory.create(fPackage, true, false);
  IPackageFragment[] namesakePackages =
      getNamesakePackages(referencedFromNamesakesScope, new SubProgressMonitor(pm, 1));
  if (namesakePackages.length == 0) {
    pm.done();
    return new ArrayList<SearchResultGroup>(0);
  }

  IJavaSearchScope scope = SearchEngine.createJavaSearchScope(namesakePackages);
  IType[] typesToSearch = getTypesInPackage(fPackage);
  if (typesToSearch.length == 0) {
    pm.done();
    return new ArrayList<SearchResultGroup>(0);
  }
  SearchPattern pattern =
      RefactoringSearchEngine.createOrPattern(typesToSearch, IJavaSearchConstants.REFERENCES);
  CollectingSearchRequestor requestor = new CuCollectingSearchRequestor(binaryRefs);
  SearchResultGroup[] results =
      RefactoringSearchEngine.search(
          pattern, scope, requestor, new SubProgressMonitor(pm, 1), status);
  pm.done();
  return new ArrayList<SearchResultGroup>(Arrays.asList(results));
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:RenamePackageProcessor.java

示例5: getReferences

import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] getReferences(IProgressMonitor pm, RefactoringStatus status) throws CoreException{
	String binaryRefsDescription= Messages.format(RefactoringCoreMessages.ReferencesInBinaryContext_ref_in_binaries_description , BasicElementLabels.getJavaElementName(getCurrentElementName()));
	ReferencesInBinaryContext binaryRefs= new ReferencesInBinaryContext(binaryRefsDescription);

	SearchResultGroup[] result= RefactoringSearchEngine.search(createSearchPattern(), createRefactoringScope(),
			new CuCollectingSearchRequestor(binaryRefs), pm, status);
	binaryRefs.addErrorIfNecessary(status);

	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:RenameFieldProcessor.java

示例6: findOccurrences

import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] findOccurrences(
    IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status)
    throws JavaModelException {
  final boolean isConstructor = fMethod.isConstructor();
  CuCollectingSearchRequestor requestor =
      new CuCollectingSearchRequestor(binaryRefs) {
        @Override
        protected void acceptSearchMatch(ICompilationUnit unit, SearchMatch match)
            throws CoreException {
          // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=27236 :
          if (isConstructor && match instanceof MethodReferenceMatch) {
            MethodReferenceMatch mrm = (MethodReferenceMatch) match;
            if (mrm.isSynthetic()) {
              return;
            }
          }
          collectMatch(match);
        }
      };

  SearchPattern pattern;
  if (isConstructor) {

    //			// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226151 : don't find
    // binary refs for constructors for now
    //			return ConstructorReferenceFinder.getConstructorOccurrences(fMethod, pm, status);

    //			SearchPattern occPattern= SearchPattern.createPattern(fMethod,
    // IJavaSearchConstants.ALL_OCCURRENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
    SearchPattern declPattern =
        SearchPattern.createPattern(
            fMethod, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
    SearchPattern refPattern =
        SearchPattern.createPattern(
            fMethod, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
    //			pattern= SearchPattern.createOrPattern(declPattern, refPattern);
    //			pattern= occPattern;

    // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226151 : do two searches
    try {
      SearchEngine engine = new SearchEngine();
      engine.search(
          declPattern,
          SearchUtils.getDefaultSearchParticipants(),
          createRefactoringScope(),
          requestor,
          new NullProgressMonitor());
      engine.search(
          refPattern,
          SearchUtils.getDefaultSearchParticipants(),
          createRefactoringScope(),
          requestor,
          pm);
    } catch (CoreException e) {
      throw new JavaModelException(e);
    }
    return RefactoringSearchEngine.groupByCu(requestor.getResults(), status);

  } else {
    pattern =
        RefactoringSearchEngine.createOrPattern(
            fRippleMethods, IJavaSearchConstants.ALL_OCCURRENCES);
  }
  return RefactoringSearchEngine.search(pattern, createRefactoringScope(), requestor, pm, status);
}
 
开发者ID:eclipse,项目名称:che,代码行数:66,代码来源:ChangeSignatureProcessor.java

示例7: findOccurrences

import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] findOccurrences(IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status) throws JavaModelException{
		final boolean isConstructor= fMethod.isConstructor();
		CuCollectingSearchRequestor requestor= new CuCollectingSearchRequestor(binaryRefs) {
			@Override
			protected void acceptSearchMatch(ICompilationUnit unit, SearchMatch match) throws CoreException {
				// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=27236 :
				if (isConstructor && match instanceof MethodReferenceMatch) {
					MethodReferenceMatch mrm= (MethodReferenceMatch) match;
					if (mrm.isSynthetic()) {
						return;
					}
				}
				collectMatch(match);
			}
		};

		SearchPattern pattern;
		if (isConstructor) {

//			// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226151 : don't find binary refs for constructors for now
//			return ConstructorReferenceFinder.getConstructorOccurrences(fMethod, pm, status);

//			SearchPattern occPattern= SearchPattern.createPattern(fMethod, IJavaSearchConstants.ALL_OCCURRENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
			SearchPattern declPattern= SearchPattern.createPattern(fMethod, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
			SearchPattern refPattern= SearchPattern.createPattern(fMethod, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
//			pattern= SearchPattern.createOrPattern(declPattern, refPattern);
//			pattern= occPattern;

			// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=226151 : do two searches
			try {
				SearchEngine engine= new SearchEngine();
				engine.search(declPattern, SearchUtils.getDefaultSearchParticipants(), createRefactoringScope(), requestor, new NullProgressMonitor());
				engine.search(refPattern, SearchUtils.getDefaultSearchParticipants(), createRefactoringScope(), requestor, pm);
			} catch (CoreException e) {
				throw new JavaModelException(e);
			}
			return RefactoringSearchEngine.groupByCu(requestor.getResults(), status);

		} else {
			pattern= RefactoringSearchEngine.createOrPattern(fRippleMethods, IJavaSearchConstants.ALL_OCCURRENCES);
		}
		return RefactoringSearchEngine.search(pattern, createRefactoringScope(), requestor, pm, status);
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:44,代码来源:ChangeSignatureProcessor.java

示例8: getReferences

import org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor; //导入依赖的package包/类
private SearchResultGroup[] getReferences(IProgressMonitor pm, ReferencesInBinaryContext binaryRefs, RefactoringStatus status) throws CoreException {
	IJavaSearchScope scope= RefactoringScopeFactory.create(fPackage, true, false);
	SearchPattern pattern= SearchPattern.createPattern(fPackage, IJavaSearchConstants.REFERENCES);
	CollectingSearchRequestor requestor= new CuCollectingSearchRequestor(binaryRefs);
	return RefactoringSearchEngine.search(pattern, scope, requestor, pm, status);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:RenamePackageProcessor.java


注:本文中的org.eclipse.jdt.internal.corext.refactoring.CuCollectingSearchRequestor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。