コード例 #1
0
  /**
   * This method is invoked when the user presses the space bar. It toggles the selection of the
   * EditPart that currently has focus.
   */
  protected void processSelect(KeyEvent event) {
    EditPart part = getViewer().getFocusEditPart();
    if ((event.stateMask & SWT.CONTROL) != 0 && part.getSelected() != EditPart.SELECTED_NONE)
      getViewer().deselect(part);
    else getViewer().appendSelection(part);

    getViewer().setFocus(part);
  }
コード例 #2
0
  /**
   * Refreshes the visual aspects of this, based upon the model (Wire). It changes the wire color
   * depending on the state of Wire.
   */
  protected void updateSelected() {

    final EditPart source = getSource();
    if (source != null) {

      final int sel = source.getSelected();
      final Polyline line = (Polyline) getFigure();
      if (sel != SELECTED_NONE) {
        line.setLineWidth(2);

      } else {
        line.setLineWidth(1);
      }
    }
  }