protected final boolean isAnonymous(IType type) { try { return type.isAnonymous(); } catch (JavaModelException e) { return false; } }
@Override public boolean isAnonymous() { try { return this.handle.isAnonymous(); } catch (JavaModelException e) { return false; } } /*
private static boolean hasAnonymousClassDeclarations(IJavaElement[] javaElements) throws JavaModelException { for (int i= 0; i < javaElements.length; i++) { if (javaElements[i] instanceof IType) { IType type= (IType) javaElements[i]; if (type.isAnonymous()) { return true; } } } return false; }
@Override public boolean isAnonymous() { try { return this.handle.isAnonymous(); } catch (JavaModelException e) { return false; } } /*
private static boolean isAnonymousType(IMember member) throws JavaModelException { return member.getElementType() == IJavaElement.TYPE && ((IType)member).isAnonymous(); }
private ITypeBinding typeToBinding(IType type, CompilationUnit root) throws JavaModelException { ASTNode typeNode= typeToDeclaration(type, root); if (type.isAnonymous()) { return ((AnonymousClassDeclaration) typeNode).resolveBinding(); } else { return ((AbstractTypeDeclaration) typeNode).resolveBinding(); } }
private boolean isInnerOrAnonymousClass(IType res) { try { if (res.isClass() && (res.isAnonymous() || (Flags.isPrivate(res.getFlags())) || res.getFullyQualifiedName().indexOf("$") > 0)) //must be better way to discover if it is an inner class //$NON-NLS-1$ return true; } catch (JavaModelException e) { //ignore } return false; }
public static boolean isConvertAnonymousAvailable(final IType type) throws JavaModelException { if (Checks.isAvailable(type)) { final IJavaElement element = type.getParent(); if (element instanceof IField && JdtFlags.isEnum((IMember) element)) { return false; } return type.isAnonymous(); } return false; }
public static boolean isConvertAnonymousAvailable(final IType type) throws JavaModelException { if (Checks.isAvailable(type)) { final IJavaElement element= type.getParent(); if (element instanceof IField && JdtFlags.isEnum((IMember) element)) return false; return type.isAnonymous(); } return false; }
public static boolean isExtractClassAvailable(IType type) throws JavaModelException { if (type == null) { return false; } if (!type.exists()) { return false; } return ReorgUtils.isInsideCompilationUnit(type) && type.isClass() && !type.isAnonymous() && !type.isLambda(); } }
private ASTNode typeToDeclaration(IType type, CompilationUnit root) throws JavaModelException { Name intermediateName= (Name) NodeFinder.perform(root, type.getNameRange()); if (type.isAnonymous()) { return ASTNodes.getParent(intermediateName, AnonymousClassDeclaration.class); } else { return ASTNodes.getParent(intermediateName, AbstractTypeDeclaration.class); } }
private ASTNode typeToDeclaration(IType type, CompilationUnit root) throws JavaModelException { Name intermediateName= (Name) NodeFinder.perform(root, type.getNameRange()); if (type.isAnonymous()) { return ASTNodes.getParent(intermediateName, AnonymousClassDeclaration.class); } else { return ASTNodes.getParent(intermediateName, AbstractTypeDeclaration.class); } }
public static boolean isExtractClassAvailable(IType type) throws JavaModelException { if (type == null) return false; if (!type.exists()) return false; return ReorgUtils.isInsideCompilationUnit(type) && type.isClass() && !type.isAnonymous() && !type.isLambda(); } }
public static List<BodyDeclaration> getBodyDeclarationList(IType iType, CompilationUnit cuNode) throws JavaModelException { if (iType.isAnonymous()) { return getClassInstanceCreationNode(iType, cuNode).getAnonymousClassDeclaration().bodyDeclarations(); } else { return getAbstractTypeDeclarationNode(iType, cuNode).bodyDeclarations(); } }
public static List<BodyDeclaration> getBodyDeclarationList(IType iType, CompilationUnit cuNode) throws JavaModelException { if (iType.isAnonymous()) return getClassInstanceCreationNode(iType, cuNode).getAnonymousClassDeclaration().bodyDeclarations(); else return getAbstractTypeDeclarationNode(iType, cuNode).bodyDeclarations(); }
private boolean canEnable(IStructuredSelection selection) throws JavaModelException { if (getSelectedFields(selection) != null) return true; if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) { IType type= (IType) selection.getFirstElement(); return type.getCompilationUnit() != null && !type.isInterface() && !type.isAnonymous(); } if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit)) return true; return false; }
private boolean canEnable(IStructuredSelection selection) throws JavaModelException { if (getSelectedFields(selection) != null) return true; if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) { IType type= (IType) selection.getFirstElement(); return type.getCompilationUnit() != null && !type.isInterface() && !type.isAnonymous(); } if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit)) return true; return false; }
private boolean canEnable(IStructuredSelection selection) throws JavaModelException { if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) { IType type= (IType) selection.getFirstElement(); return type.getCompilationUnit() != null && !type.isInterface() && !type.isEnum() && !type.isAnonymous(); } if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit)) return true; return false; }
private boolean canEnable(IStructuredSelection selection) throws JavaModelException { if (getSelectedFields(selection) != null) return true; if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) { IType type= (IType) selection.getFirstElement(); return type.getCompilationUnit() != null && !type.isInterface() && !type.isAnonymous(); } if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit)) return true; return false; }
private boolean canEnable(IStructuredSelection selection) throws JavaModelException { if (getSelectedFields(selection) != null) return true; if ((selection.size() == 1) && (selection.getFirstElement() instanceof IType)) { IType type= (IType) selection.getFirstElement(); return type.getCompilationUnit() != null && !type.isInterface() && !type.isAnnotation() && !type.isAnonymous(); } if ((selection.size() == 1) && (selection.getFirstElement() instanceof ICompilationUnit)) return true; return false; }