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


Java JavaModelUtil.isVisibleInHierarchy方法代码示例

本文整理汇总了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.
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:24,代码来源:RippleMethodFinder.java

示例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.
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:RippleMethodFinder2.java

示例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;

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:HierarchyInformationControl.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:ChangeTypeRefactoring.java


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