Package org.aspectj.asm

Examples of org.aspectj.asm.IProgramElement$Modifiers


    }
  }

  private void removeSourceFileIfNoMoreTypeDeclarationsInside(AspectJElementHierarchy hierarchy, IProgramElement typeElement,
      IProgramElement sourceFileNode) {
    IProgramElement compilationUnit = sourceFileNode;
    boolean anyOtherTypeDeclarations = false;
    for (IProgramElement child : compilationUnit.getChildren()) {
      IProgramElement.Kind k = child.getKind();
      if (k.isType()) {
        anyOtherTypeDeclarations = true;
        break;
      }
    }
    // If the compilation unit node contained no
    // other types, there is no need to keep it
    if (!anyOtherTypeDeclarations) {
      IProgramElement cuParent = compilationUnit.getParent();
      if (cuParent != null) {
        compilationUnit.setParent(null);
        cuParent.removeChild(compilationUnit);
      }
      // need to update some caches and structures too?
      hierarchy.forget(sourceFileNode, typeElement);
    } else {
      hierarchy.forget(null, typeElement);
View Full Code Here


    List constDeclaredOn = StructureUtil.getDeclareInterTypeTargets(node, IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR);
    if (fieldsDeclaredOn != null && !constDeclaredOn.isEmpty()) {
      insertDeclarationsSummary(fileBuffer, constDeclaredOn, ITD_CONSTRUCTOR_SUMMARY, index);
    }
    for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
      IProgramElement member = (IProgramElement) it.next();
      if (member.getKind().equals(IProgramElement.Kind.POINTCUT)) {
        pointcuts.add(member);
      } else if (member.getKind().equals(IProgramElement.Kind.ADVICE)) {
        advice.add(member);
      } else if (member.getKind().isDeclare() || member.getKind().isInterTypeMember()) {
        declares.add(member);
      }
    }
    if (declares.size() > 0) {
      insertDeclarationsDetails(fileBuffer, declares, DECLARE_DETAIL, index);
View Full Code Here

    fileBuffer.insert(insertIndex, tableHead);
    insertIndex += tableHead.length();

    // insert the body of the table
    for (int i = 0; i < decls.size(); i++) {
      IProgramElement decl = (IProgramElement) decls.get(i);
      if (isAboveVisibility(decl)) {
        // insert the table row accordingly
        String comment = generateSummaryComment(decl);
        String entry = "";
        if (kind.equals(ADVICE_SUMMARY)) {
          entry += "<TR><TD>" + "<A HREF=\"#" + generateHREFName(decl) + "\">" + "<TT>" + generateSignatures(decl)
              + "</TT></A><BR>&nbsp;";
          if (!comment.equals("")) {
            entry += comment + "<P>";
          }
          entry += generateAffects(decl) + "</TD>" + "</TR><TD>\n";
        } else if (kind.equals(POINTCUT_SUMMARY)) {
          entry += "<TR><TD WIDTH=\"1%\">" + "<FONT SIZE=-1><TT>" + genAccessibility(decl) + "</TT></FONT>" + "</TD>\n"
              + "<TD>" + "<TT><A HREF=\"#" + generateHREFName(decl) + "\">" + decl.toLabelString()
              + "</A></TT><BR>&nbsp;";
          if (!comment.equals("")) {
            entry += comment + "<P>";
          }
          entry += "</TR></TD>\n";
        } else if (kind.equals(DECLARE_SUMMARY)) {
          entry += "<TR><TD WIDTH=\"1%\">" + "<FONT SIZE=-1><TT>" + generateModifierInformation(decl, false)
              + "</TT></FONT>" + "</TD>" + "<TD>" + "<A HREF=\"#" + generateHREFName(decl) + "\">" + "<TT>"
              + decl.toLabelString() + "</TT></A><P>" + generateAffects(decl);
        } else if (kind.equals(ITD_FIELD_SUMMARY) || kind.equals(ITD_METHOD_SUMMARY)) {
          entry += "<TR><TD WIDTH=\"1%\">" + "<FONT SIZE=-1><TT>" + generateModifierInformation(decl, false)
              + "</TT></FONT>" + "</TD>" + "<TD>" + "<A HREF=\"#" + generateHREFName(decl) + "\">" + "<TT>"
              + decl.toLabelString() + "</TT></A><P>" + generateDeclaredBy(decl);
        } else if (kind.equals(ITD_CONSTRUCTOR_SUMMARY)) {
          entry += "<TD>" + "<A HREF=\"#" + generateHREFName(decl) + "\">" + "<TT>" + decl.toLabelString()
              + "</TT></A><P>" + generateDeclaredBy(decl);
        }

        // insert the entry
        fileBuffer.insert(insertIndex, entry);
View Full Code Here

  }

  private static boolean declsAboveVisibilityExist(List decls) {
    boolean exist = false;
    for (Iterator it = decls.iterator(); it.hasNext();) {
      IProgramElement element = (IProgramElement) it.next();
      if (isAboveVisibility(element))
        exist = true;
    }
    return exist;
  }
View Full Code Here

    fileBuffer.insert(insertIndex, detailsHeading);
    insertIndex += detailsHeading.length();

    // insert the details
    for (int i = 0; i < decls.size(); i++) {
      IProgramElement decl = (IProgramElement) decls.get(i);
      if (isAboveVisibility(decl)) {
        String entry = "";

        // insert the table row accordingly
        entry += "<A NAME=\"" + generateHREFName(decl) + "\"><!-- --></A>\n";
        if (kind.equals(ADVICE_DETAIL)) {
          entry += "<H3>" + decl.getName() + "</H3><P>";
          entry += "<TT>" + generateSignatures(decl) + "</TT>\n" + "<P>" + generateDetailsComment(decl) + "<P>"
              + generateAffects(decl);
        } else if (kind.equals(POINTCUT_DETAIL)) {
          entry += "<H3>" + decl.toLabelString() + "</H3><P>" + generateDetailsComment(decl);
        } else if (kind.equals(DECLARE_DETAIL)) {
          entry += "<H3>" + decl.toLabelString() + "</H3><P>" + generateModifierInformation(decl, true);
          if (!decl.getKind().equals(IProgramElement.Kind.INTER_TYPE_CONSTRUCTOR)) {
            entry += "&nbsp;&nbsp;";
          }
          // if we're not a declare statement then we need to generate the signature.
          // If we did this for declare statements we get two repeated lines
          if (!decl.getKind().isDeclare()) {
            String sigs = generateSignatures(decl);
            entry += sigs + "<P>";
          }
          entry += generateAffects(decl) + generateDetailsComment(decl);
        }
View Full Code Here

      String relativePackagePath = getRelativePathFromHere(node.getPackageName().replace('.', '/') + Config.DIR_SEP_CHAR);

      List addedNames = new ArrayList();
      for (Iterator it = targets.iterator(); it.hasNext();) {
        Object o = it.next();
        IProgramElement currDecl = null;
        if (o instanceof String) {
          String currHandle = (String) o;
          currDecl = node.getModel().getHierarchy().findElementForHandle(currHandle);
        } else if (o instanceof IProgramElement) {
          currDecl = (IProgramElement) o;
        } else {
          return;
        }

        String packagePath = "";
        if (currDecl.getPackageName() != null && !currDecl.getPackageName().equals("")) {
          packagePath = currDecl.getPackageName().replace('.', '/') + Config.DIR_SEP_CHAR;
        }

        String hrefName = "";
        String hrefLink = "";

        // Start the hRefLink with the relative path based on where
        // *this* type (i.e. the advised) is in the package structure.
        hrefLink = relativePackagePath + packagePath;

        if (currDecl.getPackageName() != null) {
          hrefName = currDecl.getPackageName().replace('.', '/');
        }

        // in the case of nested classes, in order for the links to work,
        // need to have the correct file name which is something of the
        // form parentClass.nestedAspect.html
        List names = new ArrayList();
        IProgramElement parent = currDecl;
        while (parent != null
            && parent.getParent() != null
            && (!parent.getParent().getKind().equals(IProgramElement.Kind.FILE_JAVA) && !parent.getParent().getKind()
                .equals(IProgramElement.Kind.FILE_ASPECTJ))) {
          parent = parent.getParent();
          names.add(parent.toLinkLabelString());
        }
        StringBuffer sbuff = new StringBuffer();
        for (int i = names.size() - 1; i >= 0; i--) {
          String element = (String) names.get(i);
          if (i == 0) {
View Full Code Here

    String relativePackagePath = getRelativePathFromHere(decl.getPackageName().replace('.', '/') + Config.DIR_SEP_CHAR);

    List addedNames = new ArrayList(); // for ensuring that we don't add duplciates
    for (Iterator it = targets.iterator(); it.hasNext();) {
      String currHandle = (String) it.next();
      IProgramElement currDecl = decl.getModel().getHierarchy().findElementForHandle(currHandle);
      if (currDecl.getKind().equals(IProgramElement.Kind.CODE)) {
        currDecl = currDecl.getParent(); // promote to enclosing
      }
      if (currDecl != null && !StructureUtil.isAnonymous(currDecl.getParent())) {
        String packagePath = "";
        if (currDecl.getPackageName() != null && !currDecl.getPackageName().equals("")) {
          packagePath = currDecl.getPackageName().replace('.', '/') + Config.DIR_SEP_CHAR;
        }

        String typeSignature = constructNestedTypeName(currDecl);

        String hrefName = packagePath + typeSignature;

        // Start the hRefLink with the relative path based on where
        // *this* type (i.e. the advisor) is in the package structure.
        String hrefLink = relativePackagePath + packagePath + typeSignature + ".html";

        if (!currDecl.getKind().isType()) {
          hrefName += '.' + currDecl.getName();
          hrefLink += "#" + currDecl.toLabelString();
        }

        if (!addedNames.contains(hrefName)) {
          entry += "<A HREF=\"" + hrefLink + "\"><tt>" + hrefName.replace('/', '.') + "</tt></A>"; // !!! don't replace
          if (it.hasNext())
View Full Code Here

    return formattedComment;
  }

  static public IProgramElement[] getProgramElements(AsmManager model, String filename) {

    IProgramElement file = (IProgramElement) model.getHierarchy().findElementForSourceFile(filename);
    final List nodes = new ArrayList();
    HierarchyWalker walker = new HierarchyWalker() {
      public void preProcess(IProgramElement node) {
        IProgramElement p = (IProgramElement) node;
        if (accept(node))
          nodes.add(p);
      }
    };
View Full Code Here

        matches.add(node);
      }
    }
    if (node != null && node.getChildren() != null) {
      for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
        IProgramElement nextNode = (IProgramElement) it.next();
        if (nextNode != null) {
          findMatchesHelper(nextNode, pattern, kind, matches);
        }
      }
    }
View Full Code Here

  public IProgramElement findElementForSignature(IProgramElement parent, IProgramElement.Kind kind, String signature) {
    for (IProgramElement node : parent.getChildren()) {
      if (node.getKind() == kind && signature.equals(node.toSignatureString())) {
        return node;
      } else {
        IProgramElement childSearch = findElementForSignature(node, kind, signature);
        if (childSearch != null) {
          return childSearch;
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.aspectj.asm.IProgramElement$Modifiers

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.