예제 #1
0
  public void setActiveTool(ToolEntry tool) {
    EditPart part = getFocusEditPart();
    if (part instanceof GraphicalEditPart) {
      IFigure fig = ((GraphicalEditPart) part).getFigure();
      if (fig instanceof Clickable) {
        part.setSelected(EditPart.SELECTED_NONE);
        ((Clickable) fig).getModel().setArmed(false);
        ((Clickable) fig).getModel().setPressed(false);
        ((Clickable) fig).getModel().setSelected(false);
      }
    }
    super.setActiveTool(null);

    if (tool instanceof PaletteItem && !listener.isDragging()) {
      insertIntoEditor((PaletteItem) tool);
    }
  }
예제 #2
0
  private void setCategoryEnabled(EditPart part, boolean enabled) {
    List v = part.getChildren();
    if (v != null) {
      int max = v.size();
      for (int i = 0; i < max; i++) {
        Object obj = v.get(i);
        if (obj instanceof GraphicalEditPart) {
          IFigure fig = ((GraphicalEditPart) obj).getFigure();

          if (fig instanceof Clickable) {
            ((Clickable) fig).setEnabled(enabled);
          }
        }
      }
    }
  }
예제 #3
0
 public void addButton(Clickable button) {
   button.setPreferredSize(BUTTON_SIZE, BUTTON_SIZE);
   add(button);
 }