if (type.getParent().getElementType() == IJavaElement.FIELD) { final ISourceRange range= type.getSourceRange(); if (range != null) { final ASTNode node= ASTNodeSearchUtil.getAstNode(cuNode, range.getOffset(), range.getLength()); if (node instanceof AnonymousClassDeclaration) return new ASTNode[] { node}; } }
	private static ASTNode[] getNodesToDelete(IJavaElement element, CompilationUnit cuNode) throws JavaModelException {		// fields are different because you don't delete the whole declaration but only a fragment of it		if (element.getElementType() == IJavaElement.FIELD) {			if (JdtFlags.isEnum((IField) element))				return new ASTNode[] { ASTNodeSearchUtil.getEnumConstantDeclaration((IField) element, cuNode)};			else				return new ASTNode[] { ASTNodeSearchUtil.getFieldDeclarationFragmentNode((IField) element, cuNode)};		}		if (element.getElementType() == IJavaElement.TYPE && ((IType) element).isLocal()) {			IType type= (IType) element;			if (type.isAnonymous()) {				return new ASTNode[] { ASTNodeSearchUtil.getClassInstanceCreationNode(type, cuNode)};			} else {				ASTNode[] nodes= ASTNodeSearchUtil.getDeclarationNodes(element, cuNode);				// we have to delete the TypeDeclarationStatement				nodes[0]= nodes[0].getParent();				return nodes;			}		}		return ASTNodeSearchUtil.getDeclarationNodes(element, cuNode);	}