List of usage examples for org.eclipse.jdt.internal.core CreateTypeHierarchyOperation getResult
public ITypeHierarchy getResult()
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
/** * @see IJavaProject// ww w. j av a 2s . co m */ public ITypeHierarchy newTypeHierarchy(IRegion region, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException { if (region == null) { throw new IllegalArgumentException(Messages.hierarchy_nullRegion); } ICompilationUnit[] workingCopies = JavaModelManager.getJavaModelManager().getWorkingCopies(owner, true/*add primary working copies*/); CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation(region, workingCopies, null, true); op.runOperation(monitor); return op.getResult(); }
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
/** * @see IJavaProject// ww w . java 2 s . c o m */ public ITypeHierarchy newTypeHierarchy(IType type, IRegion region, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException { if (type == null) { throw new IllegalArgumentException(Messages.hierarchy_nullFocusType); } if (region == null) { throw new IllegalArgumentException(Messages.hierarchy_nullRegion); } ICompilationUnit[] workingCopies = JavaModelManager.getJavaModelManager().getWorkingCopies(owner, true/*add primary working copies*/); CreateTypeHierarchyOperation op = new CreateTypeHierarchyOperation(region, workingCopies, type, true/*compute subtypes*/); op.runOperation(monitor); return op.getResult(); }
From source file:org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils.java
License:Open Source License
/** * Returns the hierarchy for the given type, or null if it could not be * 'computed'./*from w w w . j a v a2 s. co m*/ * * @param baseType * the base type for the hierarchy * @param includeLibraries * should the hierarchy include type from libraries * @param progressMonitor * a progress monitor (or null) * @return the SourceType Hierarchy for the base type * @throws CoreException * the underlying CoreException thrown by the manipulated JDT * APIs */ public static ITypeHierarchy resolveTypeHierarchy(final IType baseType, final IJavaElement scope, final boolean includeLibraries, final IProgressMonitor progressMonitor) throws CoreException { // create type hierarchy // FIXME : restrict operation scope to sources only, exclude application // libraries. int appLibs = 0; if (includeLibraries) { appLibs = IJavaSearchScope.APPLICATION_LIBRARIES; } IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new IJavaElement[] { scope }, IJavaSearchScope.SOURCES | appLibs | IJavaSearchScope.REFERENCED_PROJECTS); CreateTypeHierarchyOperation operation = new CreateTypeHierarchyOperation(baseType, null, searchScope, true); ITypeHierarchy hierarchy = operation.getResult(); if (hierarchy != null && hierarchy.exists()) { hierarchy.refresh(progressMonitor); return hierarchy; } Logger.warn("No type hierarchy found for " + baseType.getFullyQualifiedName()); return null; }