private ITypeHierarchy getTypeHierarchy() throws JavaModelException { if (fTypeHierarchy == null) { fTypeHierarchy = SuperTypeHierarchyCache.getTypeHierarchy(fStartingType); } return fTypeHierarchy; }
/** * Get a hierarchy for the given type */ public static ITypeHierarchy getTypeHierarchy(IType type) throws JavaModelException { return getTypeHierarchy(type, null); }
private ITypeHierarchy getTypeHierarchy() throws JavaModelException { if (fTypeHierarchy == null) fTypeHierarchy= SuperTypeHierarchyCache.getTypeHierarchy(fStartingType); return fTypeHierarchy; }
private ITypeHierarchy getTypeHierarchy() throws JavaModelException { if (fTypeHierarchy == null) fTypeHierarchy= SuperTypeHierarchyCache.getTypeHierarchy(fStartingType); return fTypeHierarchy; }
/** * Returns a super type hierarchy that contains the given type. * The returned hierarchy may actually be based on a subtype of the * requested type. Therefore, queries such as {@link ITypeHierarchy#getAllClasses()} * or {@link ITypeHierarchy#getRootInterfaces()} may return more types than the same * queries on a type hierarchy for just the given type. * * @param type the focus type * @return a supertype hierarchy that contains <code>type</code> * @throws JavaModelException if a problem occurs */ public static ITypeHierarchy getTypeHierarchy(IType type) throws JavaModelException { return getTypeHierarchy(type, null); }
/** * Returns a super type hierarchy that contains the given type. * The returned hierarchy may actually be based on a subtype of the * requested type. Therefore, queries such as {@link ITypeHierarchy#getAllClasses()} * or {@link ITypeHierarchy#getRootInterfaces()} may return more types than the same * queries on a type hierarchy for just the given type. * * @param type the focus type * @return a supertype hierarchy that contains <code>type</code> * @throws JavaModelException if a problem occurs */ public static ITypeHierarchy getTypeHierarchy(IType type) throws JavaModelException { return getTypeHierarchy(type, null); }
private ITypeHierarchy getSuperTypeHierarchy(IType type) { ITypeHierarchy th= (ITypeHierarchy)fTypeHierarchies.get(type); if (th == null) { try { th= SuperTypeHierarchyCache.getTypeHierarchy(type, getProgressMonitor()); } catch (JavaModelException e) { return null; } fTypeHierarchies.put(type, th); } return th; }
private ITypeHierarchy getSuperTypeHierarchy(IType type) { ITypeHierarchy th= (ITypeHierarchy)fTypeHierarchies.get(type); if (th == null) { try { th= SuperTypeHierarchyCache.getTypeHierarchy(type, getProgressMonitor()); } catch (JavaModelException e) { return null; } catch (OperationCanceledException e) { return null; } fTypeHierarchies.put(type, th); } return th; }
private ITypeHierarchy getSuperTypeHierarchy(IType type) { ITypeHierarchy th= fTypeHierarchies.get(type); if (th == null) { IProgressMonitor monitor = getProgressMonitor(); try { th= SuperTypeHierarchyCache.getTypeHierarchy(type, monitor); } catch (JavaModelException e) { return null; } catch (OperationCanceledException e) { return null; } finally { monitor.done(); } fTypeHierarchies.put(type, th); } return th; }
private ITypeHierarchy getSuperTypeHierarchy(IType type) { ITypeHierarchy th= fTypeHierarchies.get(type); if (th == null) { IProgressMonitor monitor = getProgressMonitor(); try { th= SuperTypeHierarchyCache.getTypeHierarchy(type, monitor); } catch (JavaModelException e) { return null; } catch (OperationCanceledException e) { return null; } finally { monitor.done(); } fTypeHierarchies.put(type, th); } return th; }
public static MethodOverrideTester getMethodOverrideTester(IType type) throws JavaModelException { MethodOverrideTester test= null; synchronized (fgMethodOverrideTesterCache) { test= (MethodOverrideTester) fgMethodOverrideTesterCache.get(type); } if (test == null) { ITypeHierarchy hierarchy= getTypeHierarchy(type); // don't nest the locks synchronized (fgMethodOverrideTesterCache) { test= (MethodOverrideTester) fgMethodOverrideTesterCache.get(type); // test again after waiting a long time for 'getTypeHierarchy' if (test == null) { test= new MethodOverrideTester(type, hierarchy); fgMethodOverrideTesterCache.put(type, test); } } } return test; }
public static MethodOverrideTester getMethodOverrideTester(IType type) throws JavaModelException { MethodOverrideTester test= null; synchronized (fgMethodOverrideTesterCache) { test= fgMethodOverrideTesterCache.get(type); } if (test == null) { ITypeHierarchy hierarchy= getTypeHierarchy(type); // don't nest the locks synchronized (fgMethodOverrideTesterCache) { test= fgMethodOverrideTesterCache.get(type); // test again after waiting a long time for 'getTypeHierarchy' if (test == null) { test= new MethodOverrideTester(type, hierarchy); fgMethodOverrideTesterCache.put(type, test); } } } return test; }
public static IType[] getAllSuperTypes(IType type, IProgressMonitor pm) throws JavaModelException { // workaround for 23656 IType[] superTypes= SuperTypeHierarchyCache.getTypeHierarchy(type).getAllSupertypes(type); if (type.isInterface()) { IType objekt= type.getJavaProject().findType("java.lang.Object");//$NON-NLS-1$ if (objekt != null) { IType[] superInterfacesAndObject= new IType[superTypes.length + 1]; System.arraycopy(superTypes, 0, superInterfacesAndObject, 0, superTypes.length); superInterfacesAndObject[superTypes.length]= objekt; return superInterfacesAndObject; } } return superTypes; }
public static IType[] getAllSuperTypes(IType type, IProgressMonitor pm) throws JavaModelException { try { // workaround for 23656 IType[] superTypes= SuperTypeHierarchyCache.getTypeHierarchy(type).getAllSupertypes(type); if (type.isInterface()) { IType objekt= type.getJavaProject().findType("java.lang.Object");//$NON-NLS-1$ if (objekt != null) { IType[] superInterfacesAndObject= new IType[superTypes.length + 1]; System.arraycopy(superTypes, 0, superInterfacesAndObject, 0, superTypes.length); superInterfacesAndObject[superTypes.length]= objekt; return superInterfacesAndObject; } } return superTypes; } finally { if (pm != null) pm.done(); } }
public static IType[] getAllSuperTypes(IType type, IProgressMonitor pm) throws JavaModelException { try { // workaround for 23656 IType[] superTypes= SuperTypeHierarchyCache.getTypeHierarchy(type).getAllSupertypes(type); if (type.isInterface()) { IType objekt= type.getJavaProject().findType("java.lang.Object");//$NON-NLS-1$ if (objekt != null) { IType[] superInterfacesAndObject= new IType[superTypes.length + 1]; System.arraycopy(superTypes, 0, superInterfacesAndObject, 0, superTypes.length); superInterfacesAndObject[superTypes.length]= objekt; return superInterfacesAndObject; } } return superTypes; } finally { if (pm != null) pm.done(); } }
private String createMethodComment(IMethod meth, String lineDelimiter) throws CoreException { IType declaringType= meth.getDeclaringType(); IMethod overridden= null; if (!meth.isConstructor()) { ITypeHierarchy hierarchy= SuperTypeHierarchyCache.getTypeHierarchy(declaringType); MethodOverrideTester tester= new MethodOverrideTester(declaringType, hierarchy); overridden= tester.findOverriddenMethod(meth, true); } return CodeGeneration.getMethodComment(meth, overridden, lineDelimiter); }
private void setReceiverToSupertype() { try { final IMethod m = ctx.getEnclosingMethod().orNull(); if (m == null || JdtFlags.isStatic(m)) { return; } final IType type = m.getDeclaringType(); final ITypeHierarchy hierarchy = SuperTypeHierarchyCache.getTypeHierarchy(type); receiverType = hierarchy.getSuperclass(type); } catch (final Exception e) { RecommendersPlugin.logError(e, "Failed to resolve super type of %s", ctx.getEnclosingElement()); } }
private void setReceiverToSupertype() { try { final IMethod m = ctx.getEnclosingMethod().orNull(); if (m == null || JdtFlags.isStatic(m)) { return; } final IType type = m.getDeclaringType(); final ITypeHierarchy hierarchy = SuperTypeHierarchyCache.getTypeHierarchy(type); receiverType = hierarchy.getSuperclass(type); } catch (final Exception e) { RecommendersPlugin.logError(e, "Failed to resolve super type of %s", ctx.getEnclosingElement()); } }
private String createMethodComment(IMethod meth, String lineDelimiter) throws CoreException { IType declaringType= meth.getDeclaringType(); IMethod overridden= null; if (!meth.isConstructor()) { ITypeHierarchy hierarchy= SuperTypeHierarchyCache.getTypeHierarchy(declaringType); MethodOverrideTester tester= new MethodOverrideTester(declaringType, hierarchy); overridden= tester.findOverriddenMethod(meth, true); } return CodeGeneration.getMethodComment(meth, overridden, lineDelimiter); }
private String createMethodComment(IMethod meth, String lineDelimiter) throws CoreException { IType declaringType= meth.getDeclaringType(); IMethod overridden= null; if (!meth.isConstructor()) { ITypeHierarchy hierarchy= SuperTypeHierarchyCache.getTypeHierarchy(declaringType); MethodOverrideTester tester= new MethodOverrideTester(declaringType, hierarchy); overridden= tester.findOverriddenMethod(meth, true); } return CodeGeneration.getMethodComment(meth, overridden, lineDelimiter); }