From f5c983b57d4bfd467cb7c45de7eea4a4adf88c61 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 10 Mar 2005 17:25:09 +0000 Subject: [PATCH] DeclareAnnotation: formatting code for declare annotation nodes. --- .../core/builder/AsmElementFormatter.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java index 5a765c0e0..33716d45a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java @@ -28,6 +28,7 @@ import org.aspectj.weaver.AdviceKind; import org.aspectj.weaver.ResolvedTypeX; import org.aspectj.weaver.TypeX; import org.aspectj.weaver.patterns.AndPointcut; +import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.DeclareErrorOrWarning; import org.aspectj.weaver.patterns.DeclareParents; import org.aspectj.weaver.patterns.DeclarePrecedence; @@ -159,7 +160,20 @@ public class AsmElementFormatter { node.setName(name + DECLARE_PRECEDENCE); node.setDetails(genPrecedenceListLabel(ds.getPatterns())); - + } else if (declare.declareDecl instanceof DeclareAnnotation) { + DeclareAnnotation deca = (DeclareAnnotation)declare.declareDecl; + node.setName(name + deca.getKind()); + if (deca.getKind()==DeclareAnnotation.AT_CONSTRUCTOR) { + node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_CONSTRUCTOR); + } else if (deca.getKind()==DeclareAnnotation.AT_FIELD) { + node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_FIELD); + } else if (deca.getKind()==DeclareAnnotation.AT_METHOD) { + node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_METHOD); + } else if (deca.getKind()==DeclareAnnotation.AT_TYPE) { + node.setKind(IProgramElement.Kind.DECLARE_ANNOTATION_AT_TYPE); + } + node.setDetails(genDecaLabel(deca)); + } else { node.setKind(IProgramElement.Kind.ERROR); node.setName(DECLARE_UNKNONWN); @@ -209,6 +223,13 @@ public class AsmElementFormatter { } } + private String genDecaLabel(DeclareAnnotation deca) { + StringBuffer sb = new StringBuffer(""); + sb.append(deca.getPatternAsString()); + sb.append(" : "); + sb.append(deca.getAnnotationString()); + return sb.toString(); + } private String genPrecedenceListLabel(TypePatternList list) { String tpList = ""; -- 2.39.5