@SuppressWarnings("unchecked") protected void replace(org.eclipse.jdt.core.dom.Annotation oldNode, org.eclipse.jdt.core.dom.Annotation newNode) { List<IExtendedModifier> modifiers; ASTNode parentNode = oldNode.getParent(); if (parentNode instanceof BodyDeclaration) { modifiers = ((BodyDeclaration) parentNode).modifiers(); } else if (parentNode instanceof SingleVariableDeclaration) { modifiers = ((SingleVariableDeclaration) parentNode).modifiers(); } else { throw new IllegalStateException("Cannot handle annotations attached to " + parentNode); } int pos = modifiers.indexOf(annotation); if (pos >= 0) { modifiers.set(pos, newNode); } }
private boolean isInTypeDeclarationAnnotation(ASTNode node) throws JavaModelException { Annotation enclosingAnnotation= ASTNodes.getParent(node, Annotation.class); return enclosingAnnotation != null && enclosingAnnotation.getParent() == getContainingTypeDeclarationNode(); }
@SuppressWarnings("unchecked") protected void replace(org.eclipse.jdt.core.dom.Annotation oldNode, org.eclipse.jdt.core.dom.Annotation newNode) { List<IExtendedModifier> modifiers; ASTNode parentNode = oldNode.getParent(); if (parentNode instanceof BodyDeclaration) { modifiers = ((BodyDeclaration) parentNode).modifiers(); } else if (parentNode instanceof SingleVariableDeclaration) { modifiers = ((SingleVariableDeclaration) parentNode).modifiers(); } else { throw new IllegalStateException("Cannot handle annotations attached to " + parentNode); } int pos = modifiers.indexOf(annotation); if (pos >= 0) { modifiers.set(pos, newNode); } }
private void handleAnnotation(Annotation node) { ASTNode parentNode = node.getParent(); boolean breakAfter = false; boolean isTypeAnnotation = this.declarationModifierVisited; if (isTypeAnnotation) { breakAfter = this.options.insert_new_line_after_type_annotation; } else if (parentNode instanceof PackageDeclaration) { breakAfter = this.options.insert_new_line_after_annotation_on_package; } else if (parentNode instanceof AbstractTypeDeclaration) { breakAfter = this.options.insert_new_line_after_annotation_on_type; } else if (parentNode instanceof EnumConstantDeclaration) { breakAfter = this.options.insert_new_line_after_annotation_on_enum_constant; } else if (parentNode instanceof FieldDeclaration) { breakAfter = this.options.insert_new_line_after_annotation_on_field; } else if (parentNode instanceof MethodDeclaration) { breakAfter = this.options.insert_new_line_after_annotation_on_method; } else if (parentNode instanceof AnnotationTypeMemberDeclaration) { breakAfter = this.options.insert_new_line_after_annotation_on_method && ((AnnotationTypeMemberDeclaration) parentNode).getDefault() != node; } else if (parentNode instanceof VariableDeclarationStatement || parentNode instanceof VariableDeclarationExpression) { breakAfter = this.options.insert_new_line_after_annotation_on_local_variable; } else if (parentNode instanceof SingleVariableDeclaration) { breakAfter = this.options.insert_new_line_after_annotation_on_parameter; if ((parentNode.getParent()) instanceof EnhancedForStatement) breakAfter = this.options.insert_new_line_after_annotation_on_local_variable; } if (breakAfter) this.tm.lastTokenIn(node, -1).breakAfter(); }
private void handleAnnotation(Annotation node, boolean handleParenthesis) { handleToken(node, TokenNameAT, false, this.options.insert_space_after_at_in_annotation); if (handleParenthesis) { handleToken(node, TokenNameLPAREN, this.options.insert_space_before_opening_paren_in_annotation, this.options.insert_space_after_opening_paren_in_annotation); if (this.options.insert_space_before_closing_paren_in_annotation) this.tm.lastTokenIn(node, TokenNameRPAREN).spaceBefore(); } ASTNode parent = node.getParent(); boolean skipSpaceAfter = parent instanceof Annotation || parent instanceof MemberValuePair || (parent instanceof AnnotationTypeMemberDeclaration && ((AnnotationTypeMemberDeclaration) parent).getDefault() == node) || parent instanceof ArrayInitializer; if (!skipSpaceAfter) this.tm.lastTokenIn(node, -1).spaceAfter(); }
private void handleAnnotation(Annotation node, boolean handleParenthesis) { handleToken(node, TokenNameAT, false, this.options.insert_space_after_at_in_annotation); if (handleParenthesis) { handleToken(node, TokenNameLPAREN, this.options.insert_space_before_opening_paren_in_annotation, this.options.insert_space_after_opening_paren_in_annotation); if (this.options.insert_space_before_closing_paren_in_annotation) this.tm.lastTokenIn(node, TokenNameRPAREN).spaceBefore(); } ASTNode parent = node.getParent(); boolean skipSpaceAfter = parent instanceof Annotation || parent instanceof MemberValuePair || (parent instanceof AnnotationTypeMemberDeclaration && ((AnnotationTypeMemberDeclaration) parent).getDefault() == node) || parent instanceof ArrayInitializer; if (!skipSpaceAfter) this.tm.lastTokenIn(node, -1).spaceAfter(); }
private void handleAnnotation(Annotation node, boolean handleParenthesis) { handleToken(node, TokenNameAT, false, this.options.insert_space_after_at_in_annotation); if (handleParenthesis) { handleToken(node, TokenNameLPAREN, this.options.insert_space_before_opening_paren_in_annotation, this.options.insert_space_after_opening_paren_in_annotation); if (this.options.insert_space_before_closing_paren_in_annotation) this.tm.lastTokenIn(node, TokenNameRPAREN).spaceBefore(); } ASTNode parent = node.getParent(); boolean skipSpaceAfter = parent instanceof Annotation || parent instanceof MemberValuePair || (parent instanceof AnnotationTypeMemberDeclaration && ((AnnotationTypeMemberDeclaration) parent).getDefault() == node) || parent instanceof ArrayInitializer; if (!skipSpaceAfter) this.tm.lastTokenIn(node, -1).spaceAfter(); }
private void handleAnnotation(Annotation node, boolean handleParenthesis) { handleToken(node, TokenNameAT, false, this.options.insert_space_after_at_in_annotation); if (handleParenthesis) { handleToken(node, TokenNameLPAREN, this.options.insert_space_before_opening_paren_in_annotation, this.options.insert_space_after_opening_paren_in_annotation); if (this.options.insert_space_before_closing_paren_in_annotation) this.tm.lastTokenIn(node, TokenNameRPAREN).spaceBefore(); } ASTNode parent = node.getParent(); boolean skipSpaceAfter = parent instanceof Annotation || parent instanceof MemberValuePair || (parent instanceof AnnotationTypeMemberDeclaration && ((AnnotationTypeMemberDeclaration) parent).getDefault() == node) || parent instanceof ArrayInitializer; if (!skipSpaceAfter) this.tm.lastTokenIn(node, -1).spaceAfter(); }
ASTNode parent= annotation.getParent(); if (parent instanceof MethodDeclaration) { MethodDeclaration methodDeclaration= (MethodDeclaration) parent;
private void handleAnnotation(Annotation node) { ASTNode parentNode = node.getParent(); boolean breakAfter = false; boolean isTypeAnnotation = this.declarationModifierVisited;
private void handleAnnotation(Annotation node) { ASTNode parentNode = node.getParent(); boolean breakAfter = false; boolean isTypeAnnotation = this.declarationModifierVisited;
private void handleAnnotation(Annotation node) { ASTNode parentNode = node.getParent(); boolean breakAfter = false; boolean isTypeAnnotation = this.declarationModifierVisited;
private void addTypeAnnotationSourceAnchor(Annotation node) { ASTNode parent = node.getParent(); NamedEntity namedEntity = null; if ((parent instanceof AbstractTypeDeclaration)