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


Java RefactoringSearchEngine2.setStatus方法代码示例

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


在下文中一共展示了RefactoringSearchEngine2.setStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findReferences

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
private SearchResultGroup[] findReferences(IProgressMonitor pm, RefactoringStatus status)
    throws JavaModelException {
  final RefactoringSearchEngine2 engine =
      new RefactoringSearchEngine2(
          SearchPattern.createPattern(fField, IJavaSearchConstants.REFERENCES));
  engine.setFiltering(true, true);
  engine.setScope(RefactoringScopeFactory.create(fField));
  engine.setStatus(status);
  engine.setRequestor(
      new IRefactoringSearchRequestor() {
        public SearchMatch acceptSearchMatch(SearchMatch match) {
          return match.isInsideDocComment() ? null : match;
        }
      });
  engine.searchPattern(new SubProgressMonitor(pm, 1));
  return (SearchResultGroup[]) engine.getResults();
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:InlineConstantRefactoring.java

示例2: hasNonMovedReferences

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
protected boolean hasNonMovedReferences(final IMember member, final IProgressMonitor monitor, final RefactoringStatus status) throws JavaModelException {
	if (!fCachedMembersReferences.containsKey(member)) {
		final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(member, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
		engine.setFiltering(true, true);
		engine.setStatus(status);
		engine.setOwner(fOwner);
		engine.setScope(RefactoringScopeFactory.create(member));
		engine.searchPattern(new SubProgressMonitor(monitor, 1));
		fCachedMembersReferences.put(member, engine.getResults());
	}
	final SearchResultGroup[] groups= (SearchResultGroup[]) fCachedMembersReferences.get(member);
	if (groups.length == 0)
		return false;
	else if (groups.length > 1)
		return true;
	final ICompilationUnit unit= groups[0].getCompilationUnit();
	if (!getDeclaringType().getCompilationUnit().equals(unit))
		return true;
	final SearchMatch[] matches= groups[0].getSearchResults();
	for (int index= 0; index < matches.length; index++) {
		if (!isMovedReference(matches[index]))
			return true;
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:HierarchyProcessor.java

示例3: getReferencingElementsFromSameClass

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
private static IJavaElement[] getReferencingElementsFromSameClass(IMember member, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
	Assert.isNotNull(member);
	final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(member, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
	engine.setFiltering(true, true);
	engine.setScope(SearchEngine.createJavaSearchScope(new IJavaElement[] { member.getDeclaringType() }));
	engine.setStatus(status);
	engine.searchPattern(new SubProgressMonitor(pm, 1));
	SearchResultGroup[] groups= (SearchResultGroup[]) engine.getResults();
	Set<IJavaElement> result= new HashSet<IJavaElement>(3);
	for (int i= 0; i < groups.length; i++) {
		SearchResultGroup group= groups[i];
		SearchMatch[] results= group.getSearchResults();
		for (int j= 0; j < results.length; j++) {
			SearchMatch searchResult= results[j];
			result.add(SearchUtils.getEnclosingJavaElement(searchResult));
		}
	}
	return result.toArray(new IJavaElement[result.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:PushDownRefactoringProcessor.java

示例4: createTypeReferencesMapping

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
private Map<ICompilationUnit, SearchMatch[]> createTypeReferencesMapping(IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
	final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(fType, IJavaSearchConstants.ALL_OCCURRENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
	engine.setFiltering(true, true);
	engine.setScope(RefactoringScopeFactory.create(fType));
	engine.setStatus(status);
	engine.searchPattern(new SubProgressMonitor(pm, 1));
	final SearchResultGroup[] groups= (SearchResultGroup[]) engine.getResults();
	Map<ICompilationUnit, SearchMatch[]> result= new HashMap<ICompilationUnit, SearchMatch[]>();
	for (int i= 0; i < groups.length; i++) {
		SearchResultGroup group= groups[i];
		ICompilationUnit cu= group.getCompilationUnit();
		if (cu == null)
			continue;
		result.put(cu, group.getSearchResults());
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:MoveInnerToTopRefactoring.java

示例5: getReferencingCompilationUnits

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
/**
 * Computes the compilation units referencing the subtype to replace.
 *
 * @param type
 *            the subtype
 * @param monitor
 *            the progress monitor to use
 * @param status
 *            the refactoring status
 * @return the referenced compilation units (element type:
 *         <code>&lt;IJavaProject, Collection&lt;SearchResultGroup&gt;&gt;</code>)
 * @throws JavaModelException
 *             if an error occurs
 */
protected final Map<IJavaProject, Set<SearchResultGroup>> getReferencingCompilationUnits(final IType type, final IProgressMonitor monitor, final RefactoringStatus status) throws JavaModelException {
	try {
		monitor.beginTask("", 100); //$NON-NLS-1$
		monitor.setTaskName(RefactoringCoreMessages.SuperTypeRefactoringProcessor_creating);
		final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2();
		engine.setOwner(fOwner);
		engine.setFiltering(true, true);
		engine.setStatus(status);
		engine.setScope(RefactoringScopeFactory.create(type));
		engine.setPattern(SearchPattern.createPattern(type, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
		engine.searchPattern(new SubProgressMonitor(monitor, 100));
		@SuppressWarnings("unchecked")
		Map<IJavaProject, Set<SearchResultGroup>> result= (Map<IJavaProject, Set<SearchResultGroup>>) engine.getAffectedProjects();
		return result;
	} finally {
		monitor.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:33,代码来源:SuperTypeRefactoringProcessor.java

示例6: findNonPrimaryType

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
private IType findNonPrimaryType(String fullyQualifiedName, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
	SearchPattern p= SearchPattern.createPattern(fullyQualifiedName, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
	final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(p);

	engine.setFiltering(true, true);
	engine.setScope(RefactoringScopeFactory.create(fCtorBinding.getJavaElement().getJavaProject()));
	engine.setStatus(status);
	engine.searchPattern(new SubProgressMonitor(pm, 1));

	SearchResultGroup[] groups= (SearchResultGroup[]) engine.getResults();

	if (groups.length != 0) {
		for(int i= 0; i < groups.length; i++) {
			SearchMatch[] matches= groups[i].getSearchResults();
			for(int j= 0; j < matches.length; j++) {
				if (matches[j].getAccuracy() == SearchMatch.A_ACCURATE)
					return (IType) matches[j].getElement();
			}
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:IntroduceFactoryRefactoring.java

示例7: getReferencingElementsFromSameClass

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
private static IJavaElement[] getReferencingElementsFromSameClass(IMember member, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
	Assert.isNotNull(member);
	final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(member, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
	engine.setFiltering(true, true);
	engine.setScope(SearchEngine.createJavaSearchScope(new IJavaElement[] { member.getDeclaringType() }));
	engine.setStatus(status);
	engine.searchPattern(new SubProgressMonitor(pm, 1));
	SearchResultGroup[] groups= (SearchResultGroup[]) engine.getResults();
	Set<IJavaElement> result= new HashSet<IJavaElement>(3);
	for (int i= 0; i < groups.length; i++) {
		SearchResultGroup group= groups[i];
		SearchMatch[] results= group.getSearchResults();
		for (int j= 0; j < results.length; j++) {
			SearchMatch searchResult= results[i];
			result.add(SearchUtils.getEnclosingJavaElement(searchResult));
		}
	}
	return result.toArray(new IJavaElement[result.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:PushDownRefactoringProcessor.java

示例8: getReferencingCompilationUnits

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
/**
 * Computes the compilation units referencing the subtype to replace.
 *
 * @param type
 *            the subtype
 * @param monitor
 *            the progress monitor to use
 * @param status
 *            the refactoring status
 * @return the referenced compilation units (element type:
 *         <code>&lt;IJavaProject, Collection&lt;SearchResultGroup&gt;&gt;</code>)
 * @throws JavaModelException
 *             if an error occurs
 */
protected final Map<IJavaProject, Set<SearchResultGroup>> getReferencingCompilationUnits(final IType type, final IProgressMonitor monitor, final RefactoringStatus status) throws JavaModelException {
	try {
		monitor.beginTask("", 100); //$NON-NLS-1$
		monitor.setTaskName(RefactoringCoreMessages.SuperTypeRefactoringProcessor_creating);
		final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2();
		engine.setOwner(fOwner);
		engine.setFiltering(true, true);
		engine.setStatus(status);
		engine.setScope(RefactoringScopeFactory.create(type));
		engine.setPattern(SearchPattern.createPattern(type, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
		engine.searchPattern(new SubProgressMonitor(monitor, 100));
		return (Map<IJavaProject, Set<SearchResultGroup>>) engine.getAffectedProjects();
	} finally {
		monitor.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:31,代码来源:SuperTypeRefactoringProcessor.java

示例9: searchForCallsTo

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
/**
 * Search for all calls to the given <code>IMethodBinding</code> in the project that contains the
 * compilation unit <code>fCUHandle</code>.
 *
 * @param methodBinding
 * @param pm
 * @param status
 * @return an array of <code>SearchResultGroup</code>'s that identify the search matches
 * @throws JavaModelException
 */
private SearchResultGroup[] searchForCallsTo(
    IMethodBinding methodBinding, IProgressMonitor pm, RefactoringStatus status)
    throws JavaModelException {
  IMethod method = (IMethod) methodBinding.getJavaElement();
  final RefactoringSearchEngine2 engine =
      new RefactoringSearchEngine2(createSearchPattern(method, methodBinding));
  engine.setFiltering(true, true);
  engine.setScope(createSearchScope(method, methodBinding));
  engine.setStatus(status);
  engine.searchPattern(new SubProgressMonitor(pm, 1));
  return (SearchResultGroup[]) engine.getResults();
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:IntroduceFactoryRefactoring.java

示例10: findNonPrimaryType

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
private IType findNonPrimaryType(
    String fullyQualifiedName, IProgressMonitor pm, RefactoringStatus status)
    throws JavaModelException {
  SearchPattern p =
      SearchPattern.createPattern(
          fullyQualifiedName,
          IJavaSearchConstants.TYPE,
          IJavaSearchConstants.DECLARATIONS,
          SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
  final RefactoringSearchEngine2 engine = new RefactoringSearchEngine2(p);

  engine.setFiltering(true, true);
  engine.setScope(RefactoringScopeFactory.create(fCtorBinding.getJavaElement().getJavaProject()));
  engine.setStatus(status);
  engine.searchPattern(new SubProgressMonitor(pm, 1));

  SearchResultGroup[] groups = (SearchResultGroup[]) engine.getResults();

  if (groups.length != 0) {
    for (int i = 0; i < groups.length; i++) {
      SearchMatch[] matches = groups[i].getSearchResults();
      for (int j = 0; j < matches.length; j++) {
        if (matches[j].getAccuracy() == SearchMatch.A_ACCURATE)
          return (IType) matches[j].getElement();
      }
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:30,代码来源:IntroduceFactoryRefactoring.java

示例11: getReferences

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
private static SearchResultGroup[] getReferences(IMember member, IProgressMonitor monitor, RefactoringStatus status) throws JavaModelException {
	final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(member, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
	engine.setFiltering(true, true);
	engine.setScope(RefactoringScopeFactory.create(member));
	engine.setStatus(status);
	engine.searchPattern(new SubProgressMonitor(monitor, 1));
	return (SearchResultGroup[]) engine.getResults();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:MoveStaticMembersProcessor.java

示例12: adjustVisibility

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
/**
 * Adjusts the visibilities of the referenced and referencing elements.
 *
 * @param monitor the progress monitor to use
 * @throws JavaModelException if an error occurs during search
 */
public final void adjustVisibility(final IProgressMonitor monitor) throws JavaModelException {
	try {
		monitor.beginTask("", 7); //$NON-NLS-1$
		monitor.setTaskName(RefactoringCoreMessages.MemberVisibilityAdjustor_checking);
		final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(fReferenced, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
		engine.setScope(fScope);
		engine.setStatus(fStatus);
		engine.setOwner(fOwner);
		if (fIncoming) {
			// check calls to the referenced (moved) element, adjust element
			// visibility if necessary.
			engine.searchPattern(new SubProgressMonitor(monitor, 1));
			adjustIncomingVisibility((SearchResultGroup[]) engine.getResults(), new SubProgressMonitor(monitor, 1));
			engine.clearResults();
			// If the moved element is a type: Adjust visibility of members
			// of the type if they are accessed outside of the moved type
			if (fReferenced instanceof IType) {
				final IType type= (IType) fReferenced;
				adjustMemberVisibility(type, new SubProgressMonitor(monitor, 1));
			}
		}
		if (fOutgoing) {
			/*
			 * Search for the types, fields, and methods which
			 * are called/acted upon inside the referenced element (the one
			 * to be moved) and assure that they are also visible from
			 * within the referencing element (the destination type (or
			 * package if move to new type)).
			 */
			engine.searchReferencedTypes(fReferenced, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
			engine.searchReferencedFields(fReferenced, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
			engine.searchReferencedMethods(fReferenced, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
			adjustOutgoingVisibility((SearchResultGroup[]) engine.getResults(), new SubProgressMonitor(monitor, 1));
		}
	} finally {
		monitor.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:45,代码来源:MemberVisibilityAdjustor.java

示例13: findReferences

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
private SearchResultGroup[] findReferences(IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
	final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(SearchPattern.createPattern(fField, IJavaSearchConstants.REFERENCES));
	engine.setFiltering(true, true);
	engine.setScope(RefactoringScopeFactory.create(fField));
	engine.setStatus(status);
	engine.setRequestor(new IRefactoringSearchRequestor() {
		public SearchMatch acceptSearchMatch(SearchMatch match) {
			return match.isInsideDocComment() ? null : match;
		}
	});
	engine.searchPattern(new SubProgressMonitor(pm, 1));
	return (SearchResultGroup[]) engine.getResults();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:InlineConstantRefactoring.java

示例14: searchForCallsTo

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
/**
 * Search for all calls to the given <code>IMethodBinding</code> in the project
 * that contains the compilation unit <code>fCUHandle</code>.
 * @param methodBinding
 * @param pm
 * @param status
 * @return an array of <code>SearchResultGroup</code>'s that identify the search matches
 * @throws JavaModelException
 */
private SearchResultGroup[] searchForCallsTo(IMethodBinding methodBinding, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
	IMethod method= (IMethod) methodBinding.getJavaElement();
	final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(createSearchPattern(method, methodBinding));
	engine.setFiltering(true, true);
	engine.setScope(createSearchScope(method, methodBinding));
	engine.setStatus(status);
	engine.searchPattern(new SubProgressMonitor(pm, 1));
	return (SearchResultGroup[]) engine.getResults();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:IntroduceFactoryRefactoring.java

示例15: adjustVisibility

import org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2; //导入方法依赖的package包/类
/**
 * Adjusts the visibilities of the referenced and referencing elements.
 *
 * @param monitor the progress monitor to use
 * @throws JavaModelException if an error occurs during search
 */
public final void adjustVisibility(final IProgressMonitor monitor) throws JavaModelException {
  try {
    monitor.beginTask("", 7); // $NON-NLS-1$
    monitor.setTaskName(RefactoringCoreMessages.MemberVisibilityAdjustor_checking);
    final RefactoringSearchEngine2 engine =
        new RefactoringSearchEngine2(
            SearchPattern.createPattern(
                fReferenced,
                IJavaSearchConstants.REFERENCES,
                SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE));
    engine.setScope(fScope);
    engine.setStatus(fStatus);
    engine.setOwner(fOwner);
    if (fIncoming) {
      // check calls to the referenced (moved) element, adjust element
      // visibility if necessary.
      engine.searchPattern(new SubProgressMonitor(monitor, 1));
      adjustIncomingVisibility(
          (SearchResultGroup[]) engine.getResults(), new SubProgressMonitor(monitor, 1));
      engine.clearResults();
      // If the moved element is a type: Adjust visibility of members
      // of the type if they are accessed outside of the moved type
      if (fReferenced instanceof IType) {
        final IType type = (IType) fReferenced;
        adjustMemberVisibility(type, new SubProgressMonitor(monitor, 1));
      }
    }
    if (fOutgoing) {
      /*
       * Search for the types, fields, and methods which
       * are called/acted upon inside the referenced element (the one
       * to be moved) and assure that they are also visible from
       * within the referencing element (the destination type (or
       * package if move to new type)).
       */
      engine.searchReferencedTypes(
          fReferenced,
          new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
      engine.searchReferencedFields(
          fReferenced,
          new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
      engine.searchReferencedMethods(
          fReferenced,
          new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
      adjustOutgoingVisibility(
          (SearchResultGroup[]) engine.getResults(), new SubProgressMonitor(monitor, 1));
    }
  } finally {
    monitor.done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:58,代码来源:MemberVisibilityAdjustor.java


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