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


Java ITypeHierarchy.getImplementingClasses方法代码示例

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


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

示例1: hierarchyDeclaresMethodName

import org.eclipse.jdt.core.ITypeHierarchy; //导入方法依赖的package包/类
static final IMethod[] hierarchyDeclaresMethodName(
    IProgressMonitor pm, ITypeHierarchy hierarchy, IMethod method, String newName)
    throws CoreException {
  try {
    Set<IMethod> result = new HashSet<IMethod>();
    IType type = method.getDeclaringType();
    IMethod foundMethod =
        Checks.findMethod(newName, method.getParameterTypes().length, false, type);
    if (foundMethod != null) result.add(foundMethod);
    IMethod[] foundInHierarchyClasses =
        classesDeclareMethodName(
            hierarchy, Arrays.asList(hierarchy.getAllClasses()), method, newName);
    if (foundInHierarchyClasses != null) result.addAll(Arrays.asList(foundInHierarchyClasses));
    IType[] implementingClasses = hierarchy.getImplementingClasses(type);
    IMethod[] foundInImplementingClasses =
        classesDeclareMethodName(hierarchy, Arrays.asList(implementingClasses), method, newName);
    if (foundInImplementingClasses != null)
      result.addAll(Arrays.asList(foundInImplementingClasses));
    return result.toArray(new IMethod[result.size()]);
  } finally {
    if (pm != null) {
      pm.done();
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:RenameMethodProcessor.java

示例2: isImplementedInSupertype

import org.eclipse.jdt.core.ITypeHierarchy; //导入方法依赖的package包/类
@Override
public boolean isImplementedInSupertype(final IType objectClass, final String interfaceName)
        throws JavaModelException {

    String simpleName = getSimpleInterfaceName(interfaceName);

    ITypeHierarchy typeHierarchy = objectClass.newSupertypeHierarchy(null);
    IType[] interfaces = typeHierarchy.getAllInterfaces();
    for (int i = 0; i < interfaces.length; i++) {
        if (interfaces[i].getElementName().equals(simpleName)) {
            IType in = interfaces[i];
            IType[] types = typeHierarchy.getImplementingClasses(in);
            for (int j = 0; j < types.length; j++) {
                if (!types[j].getFullyQualifiedName().equals(objectClass.getFullyQualifiedName())) {
                    return true;
                }
            }
            break;
        }
    }
    return false;
}
 
开发者ID:maximeAudrain,项目名称:jenerate,代码行数:23,代码来源:JavaInterfaceCodeAppenderImpl.java

示例3: hierarchyDeclaresMethodName

import org.eclipse.jdt.core.ITypeHierarchy; //导入方法依赖的package包/类
final static IMethod[] hierarchyDeclaresMethodName(IProgressMonitor pm, ITypeHierarchy hierarchy, IMethod method, String newName) throws CoreException {
	try {
		Set<IMethod> result= new HashSet<IMethod>();
		IType type= method.getDeclaringType();
		IMethod foundMethod= Checks.findMethod(newName, method.getParameterTypes().length, false, type);
		if (foundMethod != null)
			result.add(foundMethod);
		IMethod[] foundInHierarchyClasses= classesDeclareMethodName(hierarchy, Arrays.asList(hierarchy.getAllClasses()), method, newName);
		if (foundInHierarchyClasses != null)
			result.addAll(Arrays.asList(foundInHierarchyClasses));
		IType[] implementingClasses= hierarchy.getImplementingClasses(type);
		IMethod[] foundInImplementingClasses= classesDeclareMethodName(hierarchy, Arrays.asList(implementingClasses), method, newName);
		if (foundInImplementingClasses != null)
			result.addAll(Arrays.asList(foundInImplementingClasses));
		return result.toArray(new IMethod[result.size()]);
	} finally {
		if (pm != null) {
			pm.done();
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:RenameMethodProcessor.java

示例4: findTests

import org.eclipse.jdt.core.ITypeHierarchy; //导入方法依赖的package包/类
private List<ICompilationUnit> findTests(IProgressMonitor monitor) throws JavaModelException {
	List<ICompilationUnit> units =  new ArrayList<ICompilationUnit>();
	ITypeHierarchy th = testInterface.findPrimaryType().newTypeHierarchy(testInterface.getJavaProject(),monitor);
	IType[] types = th.getImplementingClasses(testInterface.findPrimaryType());
	for (int i = 0; i < types.length; i++) {
		units.add(types[i].getCompilationUnit());
	}
	return units;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:10,代码来源:TestConvertor.java


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