예제 #1
0
  private ObjectEditor createNewObjectEditor(final EnvObjectLogic o) {
    final ObjectEditor oe = new ObjectEditor(o);
    oe.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            try {
              objEditorPanels.remove(o);
            } catch (Exception ex) {
              LOG.error("Cannot unload object editor frame", ex);
            }
          }

          @Override
          public void windowClosed(WindowEvent e) {
            try {
              if (objEditorPanels.containsKey(o)) {
                objEditorPanels.remove(o);
              }
            } catch (Exception ex) {
              LOG.error("Cannot unload object editor frame", ex);
            }
          }
        });
    return oe;
  }
예제 #2
0
  /**
   * Opens object editor GUI.
   *
   * @param obj the object to edit
   */
  public void openObjEditor(EnvObjectLogic obj) {
    if (objEditorPanels.containsKey(obj)) {
      if (objEditorPanels.get(obj) == null) {
        objEditorPanels.remove(obj);
        objEditorPanels.put(obj, createNewObjectEditor(obj));
      }
    } else {
      objEditorPanels.put(obj, createNewObjectEditor(obj));
    }

    final ObjectEditor currEditorPanel = objEditorPanels.get(obj);
    currEditorPanel.setVisible(true);
    currEditorPanel.toFront();
  }
예제 #3
0
 @Override
 public void notifyChanged(Notification notification) {
   super.notifyChanged(notification);
   if (this.object == notification.getNotifier() && this.feature == notification.getFeature()) {
     button.setSelection((Boolean) object.eGet(feature));
   }
 }
예제 #4
0
 public void setVisible(boolean visible) {
   super.setVisible(visible);
   button.setVisible(visible);
   GridData data = (GridData) button.getLayoutData();
   data.exclude = !visible;
 }