public final void updateSelectionAction() throws DbException {

    // Disable action not exactly one object is selected
    DbObject[] selObjs = ORActionFactory.getActiveObjects();
    if (selObjs == null || selObjs.length > 1 || selObjs.length == 0) {
      setEnabled(false);
      return;
    }

    // Get db
    boolean forwardEnabled = true;
    DbORDatabase db = null;
    if (selObjs[0] instanceof DbORDatabase) {
      db = (DbORDatabase) selObjs[0];
    } else {
      selObjs[0].getDb().beginReadTrans();
      DbORModel model =
          (selObjs[0] instanceof DbORModel)
              ? (DbORModel) selObjs[0]
              : (DbORModel) selObjs[0].getCompositeOfType(DbORModel.metaClass);
      selObjs[0].getDb().commitTrans();
      if (model == null) {
        forwardEnabled = false;
      } else {
        model.getDb().beginReadTrans();
        if (model instanceof DbORDataModel) {
          db = ((DbORDataModel) model).getDeploymentDatabase();
        } else if (model instanceof DbORDomainModel) {
          db = ((DbORDomainModel) model).getDeploymentDatabase();
        } else if (model instanceof DbOROperationLibrary) {
          db = ((DbOROperationLibrary) model).getDeploymentDatabase();
        } else {
          forwardEnabled = false;
        } // end if
        model.getDb().commitTrans();
      } // end if
    } // end if

    if (db == null) {
      setEnabled(
          forwardEnabled); // let it enable to allow doActionPerformed() to inform user of why the
      // operation cannot be archieved
    } else {
      db.getDb().beginReadTrans();
      ForwardToolkitPlugin.setActiveDiagramTarget(db.getTargetSystem().getID().intValue());
      forwardEnabled = ForwardToolkitPlugin.getToolkit().forwardEnabled();
      setEnabled(forwardEnabled);
      db.getDb().commitTrans();
    } // end if

    // Disable for ER module
    if (true == forwardEnabled) {
      TerminologyUtil terminologyUtil = TerminologyUtil.getInstance();
      Object obj = ApplicationContext.getFocusManager().getFocusObject();
      if (obj instanceof ApplicationDiagram) {
        if (obj != null) {
          DbObject semObj = ((ApplicationDiagram) obj).getSemanticalObject();
          if (semObj != null) {
            if (semObj instanceof DbORDataModel) {
              DbORDataModel model = (DbORDataModel) semObj;
              model.getDb().beginReadTrans();
              if (terminologyUtil.getModelLogicalMode(model)
                  == TerminologyUtil.LOGICAL_MODE_ENTITY_RELATIONSHIP) setEnabled(false);
              model.getDb().commitTrans();
            }
          } else setEnabled(false);
        }
      } else if (terminologyUtil.validateSelectionModel()
          == TerminologyUtil.LOGICAL_MODE_ENTITY_RELATIONSHIP) setEnabled(false);
    }
  } // end updateSelectionAction()
 private void setDefaultInitialValues() throws DbException {
   DbORDataModel dataModel = (DbORDataModel) getCompositeOfType(DbORDataModel.metaClass);
   TerminologyUtil terminologyUtil = TerminologyUtil.getInstance();
   Terminology term = terminologyUtil.findModelTerminology(dataModel);
   setName(term.getTerm(metaClass));
 }