示例#1
0
文件: Z.java 项目: adamldavis/z
 @Override
 public void mouseReleased(MouseEvent e) {
   log.info("released: " + e);
   if (point1 != null && point2 != null) {
     if (draggedNode == null) {
       ZNode z = findZNodeAt(e.getPoint());
       if (z == null) {
         createSubNode(e.getPoint());
       } else dragged(z);
     } else if (e.getPoint().y >= display.getHeight() - 40) {
       final ZTask task = taskList.getTaskAt(e.getPoint().x, 20);
       if (task == null) {
         // TODO: show confirmation?
         synchronized (zNodes) {
           zNodes.remove(draggedNode);
         }
       } else task.add(draggedNode);
       draggedNode = null;
     } else {
       draggedNode.getLocation().setLocation(translateToZNodePoint(point2));
       updateSubLocations(draggedNode, true, draggedNode.getLocation());
       draggedNode = null;
     }
     point1 = point2 = null;
   }
 }
示例#2
0
文件: Z.java 项目: adamldavis/z
 @Override
 public void keyPressed(KeyEvent e) {
   if (!links.isEmpty()) return;
   switch (e.getKeyChar()) {
     case 's':
       // TODO: Search!!!!
       String name = display.showInputDialog("Search", "Z");
       ZTask activeTask = taskList.getActiveTask();
       for (ZNode node : getZNodes()) {
         if (node.getName().startsWith(name)) {
           log.info("found {}", node.getName());
           if (activeTask != null) {
             activeTask.add(node);
           }
         }
       }
       break;
     case 'm':
       if (selectedNode.getNodeType() == ZNodeType.CLASS) {
         addMethodLinks();
       }
       break;
     case 'p':
       // TODO: add polymorphic links
     case 'i':
     case 'r':
       // TODO: add import/require links
     case 'h':
     case 'f':
       addFieldLinks();
   }
 }