Package org.apache.uima.taeconfigurator.editors.ui.dialogs

Examples of org.apache.uima.taeconfigurator.editors.ui.dialogs.CommonInputDialog


      valueChanged = false;
      cpd.setDefaultGroupName(setValueChanged(defaultGroup.getText(), cpd.getDefaultGroupName()));
      if (valueChanged)
        setFileDirty();
    } else if (event.widget == addGroupButton) {
      CommonInputDialog dialog = new CommonInputDialog(
              this,
              "Add Group",
              "Specify one or more unique group names, separated by 1 space character, and press OK",
              CommonInputDialog.GROUP_NAMES);

      for (;;) { // stay in loop until get "true" return from add below
        // used for looping while group name set is duplicate
        if (dialog.open() == Window.CANCEL)
          return;
        if (addNewOrEditExistingGroup(dialog.getValue(), null))
          break;
      }
      commonActionFinish();
    } else if (event.widget == addButton) { // add parameter or add override action

      boolean valid = tree.getSelectionCount() == 1;
      if (isPrimitive())
        valid = valid && (isGroupSelection() || isParmSelection());
      else
        valid = valid && (isParmSelection() || isOverrideSelection());

      if (!valid) {
        if (isPrimitive())
          Utility.popMessage("Wrong item selected",
                  "Please first select the group under which to add a parameter",
                  MessageDialog.ERROR);
        else
          Utility.popMessage("Wrong item selected",
                  "Please first select the parameter under which to add an override",
                  MessageDialog.ERROR);
        return;
      }

      if (isPrimitive()) { // adding a parameter
        TreeItem parentGroup = tree.getSelection()[0];
        if (isParmSelection())
          parentGroup = parentGroup.getParentItem();

        AddParameterDialog dialog = new AddParameterDialog(this);
        if (dialog.open() == Window.CANCEL)
          return;

        addNewConfigurationParameter(dialog, parentGroup);

        if (null != parentGroup)
          parentGroup.setExpanded(true);
        commonActionFinish();
      } else { // is aggregate - add an override
        TreeItem parentParm = tree.getSelection()[0];
        if (isOverride(parentParm))
          parentParm = parentParm.getParentItem();
        addOrEditOverride(parentParm, -1);
      }
    } else if ((event.widget == editButton) || (event.type == SWT.MouseDoubleClick)) {

      TreeItem editItem = tree.getSelection()[0];
      if (isParameter(editItem) && isPrimitive()) {
        AddParameterDialog dialog = new AddParameterDialog(this,
                getCorrespondingModelParm(editItem));
        if (dialog.open() == Window.CANCEL)
          return;

        // update the existing item
        alterExistingConfigurationParameter(dialog, editItem);
        // TODO consequences of changes in rest of model?
        commonActionFinishDirtyIfChange();
      } else if (isParameter(editItem) && isAggregate()) {
        // can edit name and description, but not Type (set from override)
        ConfigurationParameter existingCP = getCorrespondingModelParm(editItem);

        AddParameterDialog dialog = new AddParameterDialog(this, existingCP);
        if (dialog.open() == Window.CANCEL)
          return;
        alterExistingConfigurationParameter(dialog, editItem);
        // TODO consequences of changes in rest of model?
        commonActionFinishDirtyIfChange();

      } else if (isOverride(editItem)) {
        TreeItem parent = editItem.getParentItem();
        int overrideIndex = getItemIndex(parent, editItem);
        addOrEditOverride(parent, overrideIndex);
      } else if (isGroup(editItem)) {
        String groupNames = getName(editItem.getText());
        if (groupNames.equals(COMMON_GROUP) || groupNames.equals(NOT_IN_ANY_GROUP))
          return; // can't change the name of these groups

        CommonInputDialog dialog = new CommonInputDialog(
                this,
                "Edit group",
                "Specify one or more unique group names, separated by 1 space character, and press OK",
                CommonInputDialog.GROUP_NAMES, groupNames);

        for (;;) {
          if (dialog.open() == Window.CANCEL)
            return;

          if (addNewOrEditExistingGroup(dialog.getValue(), editItem))
            break;
        }
        commonActionFinishDirtyIfChange();
      }
    } else if ((event.widget == removeButton)
View Full Code Here

TOP

Related Classes of org.apache.uima.taeconfigurator.editors.ui.dialogs.CommonInputDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.