本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2.clearResults方法的典型用法代码示例。如果您正苦于以下问题:Java RefactoringSearchEngine2.clearResults方法的具体用法?Java RefactoringSearchEngine2.clearResults怎么用?Java RefactoringSearchEngine2.clearResults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine2
的用法示例。
在下文中一共展示了RefactoringSearchEngine2.clearResults方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: 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();
}
}