예제 #1
0
파일: Z.java 프로젝트: adamldavis/z
 private ZNode createNewZNode(Point point, ZNodeType type, String name) {
   if (name == null) {
     return null;
   }
   final Point2D.Float zp = translateToZNodePoint(point);
   final ZNode zNode = new ZNode(zp.x, zp.y, name.trim());
   zNode.setNodeType(type);
   zNode.setParentFile(selectedNode.getParentFile());
   if (type == ZNodeType.DEPENDENCY) {
     zNode.setCode(asList("artifactId=" + name, "groupId=" + name));
   }
   synchronized (zNodes) {
     zNodes.add(zNode);
   }
   if (type == ZNodeType.METHOD) {
     zNode.setParentFile(
         new File(
             selectedNode.getParentFile(),
             selectedNode.getName() + "." + selectedNode.getExtension()));
     int end = selectedNode.getEndLineNumber(apiFactory.getLanguageParser());
     for (ZNode method : selectedNode.getSubmodules()) {
       end += method.getCodeLineSize();
     }
     zNode.setExtension(String.valueOf(end));
     System.err.println("ext=" + zNode.getExtension());
   } else if (type == ZNodeType.CALLEE) {
     selectedNode.addCodeLine(zNode.getName());
   }
   new ZCodeSaver(apiFactory).save(zNode);
   return zNode;
 }
예제 #2
0
파일: Z.java 프로젝트: adamldavis/z
  public void activateGoUp() {
    File pFile = selectedNode.getParentFile();

    if (selectedNode.getNodeType() == ZNodeType.PACKAGE) {
      for (int i = 0; i < selectedNode.getName().split("\\.").length; i++) {
        pFile = pFile.getParentFile();
      }
    } else if (selectedNode.getNodeType() == ZNodeType.MODULE) {
      pFile = pFile.getParentFile();
    }
    selectedNode = new ZCodeLoader(apiFactory).load(pFile);
    clicked(selectedNode);
  }