// this update is always safe
  public final void updateSelectionAction() throws DbException {
    ApplicationDiagram diag = ApplicationContext.getFocusManager().getActiveDiagram();
    Object[] objects = ApplicationContext.getFocusManager().getSelectedSemanticalObjects();
    if ((diag == null) || (objects.length != 1) || !(objects[0] instanceof DbORAssociationEnd)) {
      setSelectedIndex(-1);
      setEnabled(false);
      return;
    }

    // update values
    dbos.clear();

    DbORAssociationEnd end = (DbORAssociationEnd) objects[0];
    DbORPrimaryUnique selKey = end.getReferencedConstraint();

    DbORAbsTable tableSo = (DbORAbsTable) end.getOppositeEnd().getClassifier();
    DbEnumeration dbEnum = tableSo.getComponents().elements(DbORPrimaryUnique.metaClass);
    while (dbEnum.hasMoreElements()) {
      DbORPrimaryUnique key = (DbORPrimaryUnique) dbEnum.nextElement();
      dbos.add(key);
    }
    dbEnum.close();

    int sizeadjustment = (dbos.size() == 0) ? 1 : 2; // adding a separator
    // and an item for
    // removing the
    // referenced
    // constraint
    // if no keys, do not add a separator
    Object[] items = new Object[dbos.size() + sizeadjustment];

    items[0] = kNoReferencedConstraint;
    if (sizeadjustment == 2) {
      items[1] = null;
    }

    String tableName = tableSo.getName();
    for (int i = 0; i < dbos.size(); i++) {
      String name = ((DbORPrimaryUnique) dbos.get(i)).getName();
      items[i + sizeadjustment] =
          MessageFormat.format(kKeyNamePatern, new Object[] {tableName, name});
    }
    setDomainValues(items);

    if (selKey == null) setSelectedIndex(0);
    else setSelectedIndex(dbos.indexOf(selKey) + sizeadjustment);

    setEnabled(true);
  }
  private DbORTable findParentTable(DbORTable t1) throws DbException {
    DbORTable parent = null;
    DbRelationN relN = t1.getAssociationEnds();
    DbEnumeration enu = relN.elements(DbORAssociationEnd.metaClass);
    while (enu.hasMoreElements()) {
      DbORAssociationEnd end = (DbORAssociationEnd) enu.nextElement();
      int mult = end.getMultiplicity().getValue();
      if (mult == SMSMultiplicity.EXACTLY_ONE) {
        DbORAssociationEnd oppEnd = end.getOppositeEnd();
        DbORAbsTable t = oppEnd.getClassifier();

        if (t instanceof DbORTable) {
          parent = (DbORTable) t;
          break;
        }
      } // end if
    } // end while
    enu.close();

    return parent;
  }