예제 #1
0
 public void mouseDragged(MouseEvent e) {
   Point p = e.getLocation();
   Dimension d = p.getDifference(start);
   start = p;
   Figure f = ((Figure) e.getSource());
   f.setBounds(f.getBounds().getTranslated(d.width, d.height));
 }
    @Override
    public void mousePressed(MouseEvent me) {
      if (me.getSource() instanceof ExpandCollapseFigure) {
        ExpandCollapseFigure ecFigure = (ExpandCollapseFigure) me.getSource();
        EntitySelectManager manager = EntitySelectManager.getManager();
        if (ecFigure.getParent().getParent() instanceof TableEntityElement) {
          TableEntityElement rowFigure = (TableEntityElement) ecFigure.getParent().getParent();
          manager.setSelection(rowFigure); // select first
          TableTreeEntityFigure treeNodeFigure = ecFigure.getParent().getEntityFigure();
          if (treeNodeFigure != null) {
            expanded = treeNodeFigure.isExpanded();
            treeNodeFigure.doExpandCollapse();
          }
        }
      }

      MapperTablePart tablePart = MapperUtils.getMapperTablePart((TableEntityPart) getHost());
      if (tablePart instanceof OutputTablePart) {
        TableEntityPart host = (TableEntityPart) getHost();
        host.refreshChildrenTargetConnections(host, expanded);
      } else if (getHost() instanceof InputTablePart) {
        TableEntityPart host = (TableEntityPart) getHost();
        host.refreshChildrenSourceConnections(host, expanded);
      }
    }
예제 #3
0
 public void mouseReleased(MouseEvent me) {
   if (armed) {
     armed = false;
     updateROIBounds(me);
     fireROIUpdated();
     me.consume();
   }
 }
 @Override
 public void mouseReleased(MouseEvent me) {
   if (ctrlPressRequired) {
     if ((me.getState() & SWT.CONTROL) == 0) {
       return;
     }
   }
   showButtonSelected();
   fireButtonClicked();
 }
예제 #5
0
 private void createContextMenu(MouseEvent me) throws TermInstantiationException {
   System.out.println("Right button click");
   Display display = context.getCanvas().getDisplay();
   Menu menu = new Menu(context.getCanvas().getShell(), SWT.POP_UP);
   try {
     Variable varAction = new Variable("Action");
     Iterator<Map<Variable, Object>> results =
         PrologProxy.instance()
             .getSolutions(Compound.createCompound("cpi#contextMenuEntry", descriptor, varAction));
     int count = 0;
     while (results.hasNext()) {
       Map<Variable, Object> result = (Map<Variable, Object>) results.next();
       Compound action = (Compound) result.get(varAction);
       TermInstantiator.instance().instantiate(action, menu, context);
       if (count++ > MAX_MENU_ENTRIES) {
         MenuItem errItem = new MenuItem(menu, SWT.NONE);
         errItem.setText("<too many results>");
         break;
       }
     }
   } catch (PrologException e1) {
     e1.printStackTrace();
   }
   Point absLocation = me.getLocation().getCopy();
   translateToAbsolute(absLocation);
   org.eclipse.swt.graphics.Point point =
       display.map(
           context.getCanvas(),
           null,
           new org.eclipse.swt.graphics.Point(absLocation.x, absLocation.y));
   menu.setLocation(point);
   menu.setVisible(true);
   while (!menu.isDisposed() && menu.isVisible()) {
     if (!display.readAndDispatch()) display.sleep();
   }
 }
예제 #6
0
 @Override
 public void mousePressed(MouseEvent me) {
   Point pt = new Point(me.x, me.y);
   ((IFigure) me.getSource()).translateFromParent(pt);
   fMousePosition = pt;
 }
예제 #7
0
 public void mousePressed(MouseEvent e) {
   start = e.getLocation();
 }
예제 #8
0
 @Override
 public void mouseDragged(MouseEvent me) {
   armed = true;
   updateROIBounds(me);
   me.consume();
 }
예제 #9
0
 public void mousePressed(MouseEvent me) {
   start = me.getLocation();
   startROIBounds = roiGeoBounds.getCopy();
   me.consume();
 }