Esempio n. 1
0
  /** Handles mouse down events and starts the corresponding tracker. */
  public void mouseDown(MouseEvent e, int x, int y) {
    // on MS-Windows NT: AWT generates additional mouse down events
    // when the left button is down && right button is clicked.
    // To avoid dead locks we ignore such events
    if (fChild != null) {
      return;
    }

    view().freezeView();

    Handle handle = view().findHandle(e.getX(), e.getY());
    if (handle != null) {
      fChild = createHandleTracker(view(), handle);
    } else {
      Figure figure = drawing().findFigure(e.getX(), e.getY());
      if (figure != null) {
        fChild = createDragTracker(figure);
      } else {
        if (!e.isShiftDown()) {
          view().clearSelection();
        }
        fChild = createAreaTracker();
      }
    }
    fChild.mouseDown(e, x, y);
    fChild.activate();
  }
 /**
  * Called when the mouse button has been pressed on a Viewer.
  *
  * @param mouseEvent The SWT mouse event
  * @param viewer The source of the event.
  */
 public void mouseDown(MouseEvent mouseEvent, EditPartViewer viewer) {
   Tool tool = getActiveTool();
   if (tool != null) tool.mouseDown(mouseEvent, viewer);
 }