Esempio n. 1
0
File: Z.java Progetto: 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;
   }
 }
Esempio n. 2
0
File: Z.java Progetto: 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();
   }
 }