Examples of IProgramElement


Examples of org.aspectj.asm.IProgramElement

  static void decorateHTMLFromIPEs(IProgramElement[] decls, String base, String docModifier, boolean exceededNestingLevel)
      throws IOException {
    if (decls != null) {
      for (int i = 0; i < decls.length; i++) {
        IProgramElement decl = decls[i];
        decorateHTMLFromIPE(decl, base, docModifier, exceededNestingLevel);
      }
    }
  }
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

      line = reader.readLine();
    }

    boolean isSecond = false;
    int index = 0;
    IProgramElement decl;
    while (true) {

      // ---this next part is an inlined procedure that returns two values---
      // ---the next declaration and the index at which that declaration's---
      // ---DeclID sits in the .html file ---
      String contents = fileContents.toString();
      int start = contents.indexOf(Config.DECL_ID_STRING, index);
      int end = contents.indexOf(Config.DECL_ID_TERMINATOR, index);
      if (start == -1)
        decl = null;
      else if (end == -1)
        throw new Error("Malformed DeclID.");
      else {
        String tid = contents.substring(start + Config.DECL_ID_STRING.length(), end);
        decl = (IProgramElement) declIDTable.get(tid);
        index = start;
      }
      // --- ---
      // --- ---

      if (decl == null)
        break;
      fileContents.delete(start, end + Config.DECL_ID_TERMINATOR.length());
      if (decl.getKind().isType()) {
        isSecond = true;
        String fullname = "";
        if (decl.getParent().getKind().equals(IProgramElement.Kind.ASPECT)
            || decl.getParent().getKind().equals(IProgramElement.Kind.CLASS)) {
          fullname += decl.getParent().toSignatureString().concat(".").concat(decl.toSignatureString());
        } else {
          fullname += decl.toSignatureString();
        }
        // only add aspect documentation if we're in the correct
        // file for the given IProgramElement
        if (file.getName().indexOf(fullname + ".html") != -1) {
          addAspectDocumentation(decl, fileContents, index);
        }
      } else {
        decorateMemberDocumentation(decl, fileContents, index);
      }
      // Change "Class" to "Aspect"
      // moved this here because then can use the IProgramElement.Kind
      // rather than checking to see if there's advice - this fixes
      // the case with an inner aspect not having the title "Aspect"
      if (decl.getKind().equals(IProgramElement.Kind.ASPECT) && file.getName().indexOf(decl.toSignatureString()) != -1) {
        // only want to change "Class" to "Aspect" if we're in the
        // file corresponding to the IProgramElement
        String fullname = "";
        if (decl.getParent().getKind().equals(IProgramElement.Kind.ASPECT)
            || decl.getParent().getKind().equals(IProgramElement.Kind.CLASS)) {
          fullname += decl.getParent().toSignatureString().concat(".").concat(decl.toSignatureString());
        } else {
          fullname += decl.toSignatureString();
        }
        if (file.getName().indexOf(fullname + ".html") == -1) {
          // we're still in the file for a parent IPE
          continue;
        }

        boolean br = true;
        int classStartIndex = fileContents.toString().indexOf("<BR>\nClass ");
        if (classStartIndex == -1) {
          classStartIndex = fileContents.toString().indexOf("<H2>\nClass ");
          br = false;
        }
        if (classStartIndex != -1) {
          int classEndIndex = fileContents.toString().indexOf("</H2>", classStartIndex);
          if (classStartIndex != -1 && classEndIndex != -1) {
            String classLine = fileContents.toString().substring(classStartIndex, classEndIndex);
            String aspectLine = "";
            if (br) {
              aspectLine += "<BR>\n" + "Aspect " + classLine.substring(11, classLine.length());
            } else {
              aspectLine += "<H2>\n" + "Aspect " + classLine.substring(11, classLine.length());
            }
            fileContents.delete(classStartIndex, classEndIndex);
            fileContents.insert(classStartIndex, aspectLine);
          }
        }
        int secondClassStartIndex = fileContents.toString().indexOf("class <B>");
        if (secondClassStartIndex != -1) {
          String name = decl.toSignatureString();
          int classEndIndex = fileContents.toString().indexOf(name + "</B><DT>");
          if (secondClassStartIndex != -1 && classEndIndex != -1) {
            StringBuffer sb = new StringBuffer(fileContents.toString().substring(secondClassStartIndex, classEndIndex));
            sb.replace(0, 5, "aspect");
            fileContents.delete(secondClassStartIndex, classEndIndex);
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

    List rels = node.getModel().getRelationshipMap().get(node);
    if (rels != null) {
      relations.addAll(rels);
    }
    for (Iterator iter = node.getChildren().iterator(); iter.hasNext();) {
      IProgramElement child = (IProgramElement) iter.next();
      // if we're not a type, or if we are and the child is code, then
      // we want to get the relationships for this child - this means that the
      // correct relationships appear against the type in the ajdoc
      if (!node.getKind().isType() || child.getKind().equals(IProgramElement.Kind.CODE)) {
        List childRelations = node.getModel().getRelationshipMap().get(child);
        if (childRelations != null) {
          for (Iterator iterator = childRelations.iterator(); iterator.hasNext();) {
            IRelationship rel = (IRelationship) iterator.next();
            if (!relations.contains(rel)) {
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

    if (stringTargets == null) {
      return null;
    }
    for (Iterator iter = stringTargets.iterator(); iter.hasNext();) {
      String element = (String) iter.next();
      IProgramElement ipe = node.getModel().getHierarchy().findElementForHandle(element);
      if (ipe != null && ipe.getKind().equals(kind)) {
        targets.add(ipe);
      }
    }
    return targets;
  }
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

    }
    return targets;
  }

  public static String getPackageDeclarationFromFile(AsmManager model, File file) {
    IProgramElement fileNode = model.getHierarchy().findElementForSourceFile(file.getAbsolutePath());
    String packageName = ((IProgramElement) fileNode.getChildren().get(0)).getPackageName();
    return packageName;
  }
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

      if (packageName != null && packageName != "") {
        writer.println("package " + packageName + ";");
      }

      IProgramElement fileNode = model.getHierarchy().findElementForSourceFile(inputFile.getAbsolutePath());
      for (Iterator it = fileNode.getChildren().iterator(); it.hasNext();) {
        IProgramElement node = (IProgramElement) it.next();
        if (node.getKind().isPackageDeclaration()) {
          // skip
        } else if (node.getKind().equals(IProgramElement.Kind.IMPORT_REFERENCE)) {
          processImportDeclaration(node, writer);
        } else {
          try {
            processTypeDeclaration(node, writer);
          } catch (DocException d) {
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

  }

  private static void processImportDeclaration(IProgramElement node, PrintWriter writer) throws IOException {
    List imports = node.getChildren();
    for (Iterator i = imports.iterator(); i.hasNext();) {
      IProgramElement importNode = (IProgramElement) i.next();
      writer.println(importNode.getSourceSignature());
    }
  }
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

  }

  private static void processMembers(List/* IProgramElement */members, PrintWriter writer, boolean declaringTypeIsInterface)
      throws DocException {
    for (Iterator it = members.iterator(); it.hasNext();) {
      IProgramElement member = (IProgramElement) it.next();

      if (member.getKind().isType()) {
        if (!member.getParent().getKind().equals(IProgramElement.Kind.METHOD) && !StructureUtil.isAnonymous(member)) {// don't
          // print
          // anonymous
          // types
          // System.err.println(">>>>>>>>>>>>>" + member.getName() + "<<<<" + member.getParent());
          processTypeDeclaration(member, writer);
        }
      } else {
        String formalComment = addDeclID(member, member.getFormalComment());
        ;
        writer.println(formalComment);

        String signature = "";
        if (!member.getKind().equals(IProgramElement.Kind.POINTCUT)
            && !member.getKind().equals(IProgramElement.Kind.ADVICE)) {
          signature = member.getSourceSignature();// StructureUtil.genSignature(member);
          if (member.getKind().equals(IProgramElement.Kind.ENUM_VALUE)) {
            int index = members.indexOf(member);
            if ((index + 1 < members.size())
                && ((IProgramElement) members.get(index + 1)).getKind().equals(IProgramElement.Kind.ENUM_VALUE)) {
              // if the next member is also an ENUM_VALUE:
              signature = signature + ",";
            } else {
              signature = signature + ";";
            }
          }
        }

        if (member.getKind().isDeclare()) {
          // System.err.println("> Skipping declare (ajdoc limitation): " + member.toLabelString());
        } else if (signature != null && signature != "" && !member.getKind().isInterTypeMember()
            && !member.getKind().equals(IProgramElement.Kind.INITIALIZER) && !StructureUtil.isAnonymous(member)) {
          writer.print(signature);
        } else {
          // System.err.println(">> skipping: " + member.getKind());
        }

        if (member.getKind().equals(IProgramElement.Kind.METHOD)
            || member.getKind().equals(IProgramElement.Kind.CONSTRUCTOR)) {
          if (member.getParent().getKind().equals(IProgramElement.Kind.INTERFACE) || signature.indexOf("abstract ") != -1) {
            writer.println(";");
          } else {
            writer.println(" { }");
          }

        } else if (member.getKind().equals(IProgramElement.Kind.FIELD)) {
          // writer.println(";");
        }
      }
    }
  }
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

      AsmManager model = world.getModelAsAsmManager();
      if (world.isMinimalModel() && model != null && !classType.isAspect()) {
        AspectJElementHierarchy hierarchy = (AspectJElementHierarchy) model.getHierarchy();
        String pkgname = classType.getResolvedTypeX().getPackageName();
        String tname = classType.getResolvedTypeX().getSimpleBaseName();
        IProgramElement typeElement = hierarchy.findElementForType(pkgname, tname);
        if (typeElement != null && hasInnerType(typeElement)) {
          // Cannot remove it right now (has inner type), schedule it
          // for possible deletion later if all inner types are
          // removed
          candidatesForRemoval.add(typeElement);
        }
        if (typeElement != null && !hasInnerType(typeElement)) {
          IProgramElement parent = typeElement.getParent();
          // parent may have children: PACKAGE DECL, IMPORT-REFERENCE, TYPE_DECL
          if (parent != null) {
            // if it was the only type we should probably remove
            // the others too.
            parent.removeChild(typeElement);
            if (parent.getKind().isSourceFile()) {
              removeSourceFileIfNoMoreTypeDeclarationsInside(hierarchy, typeElement, parent);
            } else {
              hierarchy.forget(null, typeElement);
              // At this point, the child has been removed. We
              // should now check if the parent is in our
View Full Code Here

Examples of org.aspectj.asm.IProgramElement

    }
    // now typeThatHasChildRemoved points to the type or sourcefile that has
    // had something removed
    if (candidatesForRemoval.contains(typeThatHasChildRemoved) && !hasInnerType(typeThatHasChildRemoved)) {
      // now we can get rid of it
      IProgramElement parent = typeThatHasChildRemoved.getParent();
      if (parent != null) {
        parent.removeChild(typeThatHasChildRemoved);
        candidatesForRemoval.remove(typeThatHasChildRemoved);
        if (parent.getKind().isSourceFile()) {
          removeSourceFileIfNoMoreTypeDeclarationsInside(hierarchy, typeThatHasChildRemoved, parent);
          // System.out.println("Removed on second pass: " +
          // typeThatHasChildRemoved.getName());
        } else {
          // System.out.println("On later pass, parent of type " +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.