@Override
  public void actionPerformed(final ActionEvent event) {
    final TreePath path = jtree.getSelectionPath();

    final boolean isRoot = path.getPathCount() == 1;
    if (!isRoot
        && ((AbstractCriterionTreeNode) path.getLastPathComponent()).getCriterion().getType()
            == CriterionType.CONDITION) {
      jtree.setCurrentCriterionPath(path.getParentPath());
    } else {
      jtree.setCurrentCriterionPath(path);
    }

    new AddConditionAction(selectionBox, actionProvider).actionPerformed(event);
  }
Listener class that handles clicks on the Add Condition button.
java/ui/src/main/java/com/google/security/zynamics/bindiff/gui/dialogs/criteriadialog/AddConditionButtonListener.java