Пример #1
0
 public void actionPerformed(ActionEvent e) {
   Operator selectedOperator = this.operatorTree.getSelectedOperator();
   if (selectedOperator != null) {
     NewOperatorDialog dialog = new NewOperatorDialog(this.operatorTree);
     dialog.setVisible(true);
   }
 }
  @Override
  public void apply() {
    try {
      Operator oldOperator = inputPort.getPorts().getOwner().getOperator();
      Operator newOperator =
          NewOperatorDialog.selectMatchingOperator(
              RapidMinerGUI.getMainFrame().getActions(), null, neededClass, null, null);

      if (newOperator != null) {
        ExecutionUnit unit = inputPort.getPorts().getOwner().getConnectionContext();
        int index = unit.getIndexOfOperator(oldOperator);
        if (index == -1) {
          unit.addOperator(newOperator);
        } else {
          unit.addOperator(newOperator, unit.getIndexOfOperator(oldOperator));
        }
        if (RapidMinerGUI.getMainFrame().VALIDATE_AUTOMATICALLY_ACTION.isSelected()) {
          unit.autoWireSingle(newOperator, CompatibilityLevel.VERSION_5, true, true);
        }
      }
    } catch (OperatorCreationException e) {
    }
  }