本文整理了Java中org.eclipse.jdt.core.dom.Annotation.getParent()
方法的一些代码示例,展示了Annotation.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Annotation.getParent()
方法的具体详情如下:
包路径:org.eclipse.jdt.core.dom.Annotation
类名称:Annotation
方法名:getParent
暂无
代码示例来源:origin: forge/roaster
@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);
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private boolean isInTypeDeclarationAnnotation(ASTNode node) throws JavaModelException {
Annotation enclosingAnnotation= ASTNodes.getParent(node, Annotation.class);
return enclosingAnnotation != null && enclosingAnnotation.getParent() == getContainingTypeDeclarationNode();
}
代码示例来源:origin: org.jboss.forge/roaster-jdt
@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);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
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();
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
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();
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
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();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
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();
}
代码示例来源:origin: io.spring.javaformat/spring-javaformat-formatter-eclipse
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();
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
ASTNode parent= annotation.getParent();
if (parent instanceof MethodDeclaration) {
MethodDeclaration methodDeclaration= (MethodDeclaration) parent;
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
private void handleAnnotation(Annotation node) {
ASTNode parentNode = node.getParent();
boolean breakAfter = false;
boolean isTypeAnnotation = this.declarationModifierVisited;
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
private void handleAnnotation(Annotation node) {
ASTNode parentNode = node.getParent();
boolean breakAfter = false;
boolean isTypeAnnotation = this.declarationModifierVisited;
代码示例来源:origin: io.spring.javaformat/spring-javaformat-formatter-eclipse
private void handleAnnotation(Annotation node) {
ASTNode parentNode = node.getParent();
boolean breakAfter = false;
boolean isTypeAnnotation = this.declarationModifierVisited;
代码示例来源:origin: feenkcom/jdt2famix
private void addTypeAnnotationSourceAnchor(Annotation node) {
ASTNode parent = node.getParent();
NamedEntity namedEntity = null;
if ((parent instanceof AbstractTypeDeclaration)
内容来源于网络,如有侵权,请联系作者删除!