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, getCorrespondingModelGroup(parentGroup));
                //getName(parentGroup));
        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


        }
        finishAction();
        break;
      }
      case LANG_ITEM: {
        CommonInputDialog dialog = new CommonInputDialog(
                this,
                "Edit Language",
                "Enter a two letter ISO-639 language code, followed optionally by a two-letter ISO-3166 country code (Examples: fr or fr-CA)",
                CommonInputDialog.LANGUAGE, editItem.getText(NAME_COL));
        if (dialogForLanguage(c, dialog) == Window.CANCEL)
          return;
        c.getLanguagesSupported()[getIndex(editItem)] = dialog.getValue();
        // update GUI
        editItem.setText(NAME_COL, dialog.getValue());
        finishAction();
        break;
      }

      case FEAT: {
        TableTreeItem typeItem = editItem.getParentItem();
        String typeName = getFullyQualifiedName(typeItem);

        // using the CAS to get all the inherited features
        Type type = editor.getCurrentView().getTypeSystem().getType(typeName);

        AddCapabilityFeatureDialog dialog = new AddCapabilityFeatureDialog(this, type, c);
        if (dialog.open() == Window.CANCEL)
          return;

        addOrEditFeature(dialog, typeName, typeItem, c);
        break;
      }
View Full Code Here

    else if (itemKind == TYPE || itemKind == SOFA)
      selItem = selItem.getParentItem().getItems()[0];
    else if (itemKind == FEAT || itemKind == SOFA_ITEM)
      selItem = selItem.getParentItem().getParentItem().getItems()[0];
    Capability c = getCapabilityFromTableTreeItem(selItem.getParentItem());
    CommonInputDialog dialog = new CommonInputDialog(
            this,
            "Add Language",
            "Enter a two letter ISO-639 language code, followed optionally by a two-letter ISO-3166 country code (Examples: fr or fr-CA)",
            CommonInputDialog.LANGUAGE);
    if (dialogForLanguage(c, dialog) == Window.CANCEL)
      return;

    c.setLanguagesSupported(stringArrayAdd(c.getLanguagesSupported(), dialog.getValue()));

    // update GUI
    TableTreeItem lItem = new TableTreeItem(selItem, SWT.NONE);
    lItem.setData(LANG_TITLE);
    lItem.setText(NAME_COL, dialog.getValue());
    selItem.setExpanded(true);
    pack04();
    finishAction();
  }
View Full Code Here

      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, getCorrespondingModelGroup(parentGroup));
                //getName(parentGroup));
        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

        }
        finishAction();
        break;
      }
      case LANG_ITEM: {
        CommonInputDialog dialog = new CommonInputDialog(
                this,
                "Edit Language",
                "Enter a two letter ISO-639 language code, followed optionally by a two-letter ISO-3166 country code (Examples: fr or fr-CA)",
                CommonInputDialog.LANGUAGE, editItem.getText(NAME_COL));
        if (dialogForLanguage(c, dialog) == Window.CANCEL)
          return;
        c.getLanguagesSupported()[getIndex(editItem)] = dialog.getValue();
        // update GUI
        editItem.setText(NAME_COL, dialog.getValue());
        finishAction();
        break;
      }

      case FEAT: {
        TableTreeItem typeItem = editItem.getParentItem();
        String typeName = getFullyQualifiedName(typeItem);

        // using the CAS to get all the inherited features
        Type type = editor.getCurrentView().getTypeSystem().getType(typeName);

        AddCapabilityFeatureDialog dialog = new AddCapabilityFeatureDialog(this, type, c);
        if (dialog.open() == Window.CANCEL)
          return;

        addOrEditFeature(dialog, typeName, typeItem, c);
        break;
      }
View Full Code Here

    else if (itemKind == TYPE || itemKind == SOFA)
      selItem = selItem.getParentItem().getItems()[0];
    else if (itemKind == FEAT || itemKind == SOFA_ITEM)
      selItem = selItem.getParentItem().getParentItem().getItems()[0];
    Capability c = getCapabilityFromTableTreeItem(selItem.getParentItem());
    CommonInputDialog dialog = new CommonInputDialog(
            this,
            "Add Language",
            "Enter a two letter ISO-639 language code, followed optionally by a two-letter ISO-3166 country code (Examples: fr or fr-CA)",
            CommonInputDialog.LANGUAGE);
    if (dialogForLanguage(c, dialog) == Window.CANCEL)
      return;

    c.setLanguagesSupported(stringArrayAdd(c.getLanguagesSupported(), dialog.getValue()));

    // update GUI
    TableTreeItem lItem = new TableTreeItem(selItem, SWT.NONE);
    lItem.setData(LANG_TITLE);
    lItem.setText(NAME_COL, dialog.getValue());
    selItem.setExpanded(true);
    pack04();
    finishAction();
  }
View Full Code Here

    finishImportChangeAction();
    setFileDirty();
  }

  private void handleSetDataPath() {
    CommonInputDialog dialog = new CommonInputDialog(
            this,
            "Set DataPath",
            "The DataPath is a series of locations which will be used when looking up imports and external resources.\nEnter a series of absolute path names, separated by the character used to separate classpath names on this platform.",
            CommonInputDialog.ALLOK, CDEpropertyPage.getDataPath(editor.getProject()));
    if (dialog.open() == Window.CANCEL)
      return;
    CDEpropertyPage.setDataPath(editor.getProject(), dialog.getValue());
  }
View Full Code Here

      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

    finishImportChangeAction();
    setFileDirty();
  }

  private void handleSetDataPath() {
    CommonInputDialog dialog = new CommonInputDialog(
            this,
            "Set DataPath",
            "The DataPath is a series of locations which will be used when looking up imports and external resources.\nEnter a series of absolute path names, separated by the character used to separate classpath names on this platform.",
            CommonInputDialog.ALLOK, CDEpropertyPage.getDataPath(editor.getProject()));
    if (dialog.open() == Window.CANCEL)
      return;
    CDEpropertyPage.setDataPath(editor.getProject(), dialog.getValue());
  }
View Full Code Here

      String dataType = selectedCP.getType();
      int validationFilter = "Boolean".equals(dataType) ? CommonInputDialog.TRUE_FALSE : "Integer"
              .equals(dataType) ? CommonInputDialog.INTEGER
              : "Float".equals(dataType) ? CommonInputDialog.FLOAT : CommonInputDialog.ALLOK;

      CommonInputDialog dialog = new CommonInputDialog(this, "Add value", "Enter a value",
              validationFilter);

      if (dialog.open() == Window.CANCEL)
        return;
      TableItem item = new TableItem(valueTable, SWT.NONE);
      item.setText(dialog.getValue());
      // update model
      setCurrentParameterValue(valueTable.getItems());
    }

    else if (event.widget == editButton) {
      // open dialog to enter value
      TableItem item = valueTable.getItems()[valueTable.getSelectionIndex()];
      CommonInputDialog dialog = new CommonInputDialog(this, "Add value", "Enter a value",
              CommonInputDialog.ALLOK, item.getText());

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

      item.setText(dialog.getValue());
      // update model
      setCurrentParameterValue(valueTable.getItems());
    }

    else if (event.widget == upButton) {
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.