/** Adds a new constraint. */
  private void addConstraint() {
    IDecisionVariable variable = getVariable();
    ConstraintEditorDialog dlg = new ConstraintEditorDialog(getShell(), variable, null);
    if (ConstraintEditorDialog.OK == dlg.open()) {
      String constraint = dlg.getConstraintText();
      if (constraint.length() > 0) {
        try {
          if (null == variableValue) {
            variableValue =
                (ContainerValue)
                    ValueFactory.createValue(
                        variable.getDeclaration().getType(), ValueFactory.EMPTY);
            variable.setValue(variableValue, AssignmentState.ASSIGNED);
          }
          if (null != variableValue) {
            Value val = createConstraintValue(constraint);
            checkForDuplicates(val, -1);
            variableValue.addElement(val);

            TableItem item = new TableItem(tableViewer.getTable(), SWT.NULL);
            item.setText(constraint);
            setDirty();
          }
        } catch (ValueDoesNotMatchTypeException e) {
          exceptionDialog(e);
        } catch (ConfigurationException e) {
          exceptionDialog(e);
        }
      }
    }
  }