Package org.aspectj.asm

Examples of org.aspectj.asm.IProgramElement$Accessibility


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


    synchronized (this) {
      // Build a cache key and check the cache
      StringBuffer keyb = (packageName == null) ? new StringBuffer() : new StringBuffer(packageName);
      keyb.append(".").append(typeName);
      String key = keyb.toString();
      IProgramElement cachedValue = typeMap.get(key);
      if (cachedValue != null) {
        return cachedValue;
      }

      List<IProgramElement> packageNodes = findMatchingPackages(packageName);

      for (IProgramElement pkg : packageNodes) {
        // this searches each file for a class
        for (IProgramElement fileNode : pkg.getChildren()) {
          IProgramElement cNode = findClassInNodes(fileNode.getChildren(), typeName, typeName);
          if (cNode != null) {
            typeMap.put(key, cNode);
            return cNode;
          }
        }
View Full Code Here

      } else if (name.equals(classNode.getName())) {
        return classNode;
      } else if (typeName.equals(classNode.getBytecodeSignature())) {
        return classNode;
      } else if (classNode.getChildren() != null && !classNode.getChildren().isEmpty()) {
        IProgramElement node = findClassInNodes(classNode.getChildren(), name, typeName);
        if (node != null) {
          return node;
        }
      }
    }
View Full Code Here

      if (!isValid() || sourceFile == null) {
        return IHierarchy.NO_STRUCTURE;
      } else {
        String correctedPath = asm.getCanonicalFilePath(new File(sourceFile));
        // StructureNode node = (StructureNode)getFileMap().get(correctedPath);//findFileNode(filePath, model);
        IProgramElement node = (IProgramElement) findInFileMap(correctedPath);// findFileNode(filePath, model);
        if (node != null) {
          return node;
        } else {
          return createFileStructureNode(correctedPath);
        }
View Full Code Here

            IStructureViewNode relNode = createRelationship(rel, iconRegistry.getIcon(rel.getKind()));
            if (relNode != null) {
              svNode.add(relNode, 0);
              for (Iterator it2 = rel.getTargets().iterator(); it2.hasNext();) {
                String handle = (String) it2.next();
                IProgramElement link = Ajde.getDefault().getModel().getHierarchy().findElementForHandle(handle);
                if (link != null) {
                  IStructureViewNode linkNode = createLink(link, iconRegistry.getStructureIcon(link.getKind(),
                      link.getAccessibility()));
                  relNode.add(linkNode);
                }
              }
            }
          }
View Full Code Here

    String canonicalSFP = asm.getCanonicalFilePath(new File(sourceFilePath));
    // Used to do this:
    // IProgramElement node2 = findNodeForSourceLineHelper(root, canonicalSFP, lineNumber, -1);

    // Find the relevant source file node first
    IProgramElement node = findNodeForSourceFile(root, canonicalSFP);
    if (node == null) {
      return createFileStructureNode(sourceFilePath);
    }

    // Check if there is a more accurate child node of that source file node:
    IProgramElement closernode = findCloserMatchForLineNumber(node, lineNumber);
    if (closernode == null) {
      return node;
    } else {
      return closernode;
    }
View Full Code Here

      }
      return null; // no need to search children of a source file node
    } else {
      // check the children
      for (IProgramElement child : node.getChildren()) {
        IProgramElement foundit = findNodeForSourceFile(child, sourcefilePath);
        if (foundit != null) {
          return foundit;
        }
      }
      return null;
View Full Code Here

    }
  }

  public IProgramElement findElementForOffSet(String sourceFilePath, int lineNumber, int offSet) {
    String canonicalSFP = asm.getCanonicalFilePath(new File(sourceFilePath));
    IProgramElement node = findNodeForSourceLineHelper(root, canonicalSFP, lineNumber, offSet);
    if (node != null) {
      return node;
    } else {
      return createFileStructureNode(sourceFilePath);
    }
View Full Code Here

    if (i > lastSlash && i != -1 && j != -1) {
      // we are a binary aspect in the default package
      lastSlash = i;
    }
    String fileName = sourceFilePath.substring(lastSlash + 1);
    IProgramElement fileNode = new ProgramElement(asm, fileName, IProgramElement.Kind.FILE_JAVA, new SourceLocation(new File(
        sourceFilePath), 1, 1), 0, null, null);
    // fileNode.setSourceLocation();
    fileNode.addChild(NO_STRUCTURE);
    return fileNode;
  }
View Full Code Here

    for (IProgramElement child : node.getChildren()) {
      ISourceLocation childLoc = child.getSourceLocation();
      if (childLoc != null) {
        if (childLoc.getLine() <= lineno && childLoc.getEndLine() >= lineno) {
          // This child is a better match for that line number
          IProgramElement evenCloserMatch = findCloserMatchForLineNumber(child, lineno);
          if (evenCloserMatch == null) {
            return child;
          } else {
            return evenCloserMatch;
          }
        } else if (child.getKind().isType()) { // types are a bit clueless about where they are... do other nodes have
          // similar problems??
          IProgramElement evenCloserMatch = findCloserMatchForLineNumber(child, lineno);
          if (evenCloserMatch != null) {
            return evenCloserMatch;
          }
        }
      }
View Full Code Here

TOP

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

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.