本文整理汇总了Java中org.eclipse.jdt.internal.corext.util.JavaModelUtil.isVisibleInHierarchy方法的典型用法代码示例。如果您正苦于以下问题:Java JavaModelUtil.isVisibleInHierarchy方法的具体用法?Java JavaModelUtil.isVisibleInHierarchy怎么用?Java JavaModelUtil.isVisibleInHierarchy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.corext.util.JavaModelUtil
的用法示例。
在下文中一共展示了JavaModelUtil.isVisibleInHierarchy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: uniteWithSupertypes
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private void uniteWithSupertypes(IType anchor, IType type) throws JavaModelException {
IType[] supertypes = fHierarchy.getSupertypes(type);
for (int i = 0; i < supertypes.length; i++) {
IType supertype = supertypes[i];
IType superRep = fUnionFind.find(supertype);
if (superRep == null) {
//Type doesn't declare method, but maybe supertypes?
uniteWithSupertypes(anchor, supertype);
} else {
//check whether method in supertype is really overridden:
IMember superMethod = fTypeToMethod.get(supertype);
if (JavaModelUtil.isVisibleInHierarchy(superMethod, anchor.getPackageFragment())) {
IType rep = fUnionFind.find(anchor);
fUnionFind.union(rep, superRep);
// current type is no root anymore
fRootTypes.remove(anchor);
uniteWithSupertypes(supertype, supertype);
} else {
//Not overridden -> overriding chain ends here.
}
}
}
}
示例2: uniteWithSupertypes
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private void uniteWithSupertypes(IType anchor, IType type) throws JavaModelException {
IType[] supertypes= fHierarchy.getSupertypes(type);
for (int i= 0; i < supertypes.length; i++) {
IType supertype= supertypes[i];
IType superRep= fUnionFind.find(supertype);
if (superRep == null) {
//Type doesn't declare method, but maybe supertypes?
uniteWithSupertypes(anchor, supertype);
} else {
//check whether method in supertype is really overridden:
IMember superMethod= fTypeToMethod.get(supertype);
if (JavaModelUtil.isVisibleInHierarchy(superMethod, anchor.getPackageFragment())) {
IType rep= fUnionFind.find(anchor);
fUnionFind.union(rep, superRep);
// current type is no root anymore
fRootTypes.remove(anchor);
uniteWithSupertypes(supertype, supertype);
} else {
//Not overridden -> overriding chain ends here.
}
}
}
}
示例3: hasFocusMethod
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
protected boolean hasFocusMethod(IType type) {
if (fFocus == null) {
return true;
}
if (type.equals(fFocus.getDeclaringType())) {
return true;
}
try {
IMethod method= findMethod(fFocus, type);
if (method != null) {
// check visibility
IPackageFragment pack= (IPackageFragment) fFocus.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
if (JavaModelUtil.isVisibleInHierarchy(method, pack)) {
return true;
}
}
} catch (JavaModelException e) {
// ignore
JavaPlugin.log(e);
}
return false;
}
示例4: isValid
import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
/**
* Determines if a given type satisfies a set of type constraints.
* @param type
* @param relevantVars
* @param constraints
* @param pm
* @return <code>true</code> if a the type satisfies a set of type constraints.
* @throws JavaModelException
*/
private boolean isValid(ITypeBinding type,
Collection<ConstraintVariable> relevantVars,
Collection<ITypeConstraint> constraints,
IProgressMonitor pm) throws JavaModelException {
pm.beginTask(RefactoringCoreMessages.ChangeTypeRefactoring_analyzingMessage, constraints.size());
for(ICompilationUnit cu: fAffectedUnits){
if (!JavaModelUtil.isVisibleInHierarchy((IMember) (type.getJavaElement()), (IPackageFragment) cu.getParent())) {
return false;
}
}
for (Iterator<ITypeConstraint> it= constraints.iterator(); it.hasNext(); ) {
ITypeConstraint tc= it.next();
if (tc instanceof SimpleTypeConstraint) {
if (!(isValidSimpleConstraint(type, relevantVars, (SimpleTypeConstraint) tc)))
return false;
} else if (tc instanceof CompositeOrTypeConstraint) {
if (!(isValidOrConstraint(type, relevantVars, (CompositeOrTypeConstraint) tc)))
return false;
}
pm.worked(1);
}
pm.done();
return true;
}