finishAction();
pack04();
break;
}
case TYPE: {
AddCapabilityTypeDialog dialog = new AddCapabilityTypeDialog(this, c, editItem);
if (dialog.open() == Window.CANCEL)
return;
TypeOrFeature typeInput = getTypeOrFeature(c.getInputs(), getFullyQualifiedName(editItem));
if (dialog.inputs[0]) {
if (null == typeInput) {
c.addInputType(dialog.types[0], true);
// add all-features
getOrCreateAllFeatItem(editItem, INPUT_COL, INPUT);
}
} else if (null != typeInput) { // check for any input features done in dialog
c.setInputs(typeOrFeatureArrayRemove(c.getInputs(), typeInput));
removeAllFeatItemGui(editItem, INPUT_COL);
}
TypeOrFeature typeOutput = getTypeOrFeature(c.getOutputs(), getFullyQualifiedName(editItem));
if (dialog.outputs[0]) {
if (null == typeOutput) {
c.addOutputType(dialog.types[0], true);
getOrCreateAllFeatItem(editItem, OUTPUT_COL, OUTPUT);
}
} else if (null != typeOutput) {
c.setOutputs(typeOrFeatureArrayRemove(c.getOutputs(), typeOutput));
removeAllFeatItemGui(editItem, OUTPUT_COL);
}
if (dialog.inputs[0] || dialog.outputs[0]) {
editItem.setText(INPUT_COL, dialog.inputs[0] ? INPUT : "");
editItem.setText(OUTPUT_COL, dialog.outputs[0] ? OUTPUT : "");
} else {
editItem.dispose();
pack04();
}
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;
}