@Override
  public void configure(IParametrizableTrigger parametrizableTrigger) {

    Assert.isTrue(
        parametrizableTrigger instanceof TableConstraintInitializerTrigger, "Invalid Trigger Type");

    TableConstraintInitializerTrigger trigger =
        (TableConstraintInitializerTrigger) parametrizableTrigger;

    // Se está creando una nueva FK
    if (trigger.getNewConstraint() instanceof EForeignKey) {
      EForeignKey foreignKey = (EForeignKey) trigger.getNewConstraint();
      EBaseTable referencedTable = foreignKey.getParentTable();

      // Si la tabla origen tiene mas de una UK, el usuario deberá elegir una (Bugzilla #20280)
      if (referencedTable.getUniqueConstraints().size() > 1) {
        String msg = TriggerOptionsMessages.TableConstraintInitializerTriggerConfigurator_Select_UK;

        String[] ukNames = new String[referencedTable.getUniqueConstraints().size()];
        int[] ukIds = new int[referencedTable.getUniqueConstraints().size()];

        for (int i = 0; i < referencedTable.getUniqueConstraints().size(); i++) {
          EUniqueConstraint uk = referencedTable.getUniqueConstraints().get(i);
          ukNames[i] = uk.getName();
          String members = uk.getMembers().get(0) == null ? "" : uk.getMembers().get(0).getName();
          for (int j = 1; j < uk.getMembers().size(); j++) {
            members = members + ", " + uk.getMembers().get(j).getName();
          }
          ukNames[i] = uk.getName() + " (" + members + ")";
          ukIds[i] = i;
        }

        EUniqueConstraint defaultUK = null;

        if (referencedTable.getPrimaryKey() != null) defaultUK = referencedTable.getPrimaryKey();
        else
          defaultUK =
              referencedTable
                  .getUniqueConstraints()
                  .get(0); // Si llegamos aca, al menos una UK debe existir

        int defaultOption = referencedTable.getUniqueConstraints().indexOf(defaultUK);

        int selectedOption =
            openOptionsDialog(NEW_FOREIGN_KEY, msg, ukNames, ukIds, defaultOption, -1);

        // EL usuario puede haber cerrado el dialogo con la X. En ese caso no se selecciona ninguna
        // UK y la FK quedará sin UK.
        if (selectedOption != -1)
          trigger.setForeignKeyUniqueConstraint(
              referencedTable.getUniqueConstraints().get(selectedOption));

      } else if (referencedTable.getUniqueConstraints().size() == 1) {
        trigger.setForeignKeyUniqueConstraint(referencedTable.getUniqueConstraints().get(0));
      }
    }
  }
  private void setPrimaryKey(EColumn owner, boolean newValue) {
    boolean oldValue = isPrimaryKey(owner);

    if (oldValue == newValue) return;

    EBaseTable baseTable = (EBaseTable) owner.getTable();

    EPrimaryKey pk = baseTable.getPrimaryKey();

    if (newValue) {
      if (pk == null) {
        pk = EConstraintsFactory.eINSTANCE.createPrimaryKey();
        baseTable.getConstraints().add(pk);
      }

      if (!pk.getMembers().contains(owner)) pk.getMembers().add(owner);
    } else if (pk != null) {
      if (pk.getMembers().contains(owner)) pk.getMembers().remove(owner);
    }
  }