// type is always local; could be merging with import(s) or built-in
private void editType(TableTreeItem item) {
boolean mergeAndRefreshNeeded = false;
boolean refreshNeeded = false;
TypeDescription td = getTypeDescriptionFromTableTreeItem(item);
AddTypeDialog dialog = new AddTypeDialog(this, td);
if (dialog.open() == Window.CANCEL)
return;
// dialog disallows supertype specs inconsistent with existing features or allowed values
// dialog has already checked for dup type name
String newTypeName = dialog.typeName;
String oldTypeName = td.getName();
String[] typesRequiringThisOne = stringArray0;
if (!oldTypeName.equals(newTypeName)) {
typesRequiringThisOne = showTypesRequiringThisOneMessage(oldTypeName, ALLOWED);
if (null == typesRequiringThisOne) // null is cancel signal
return;
if (isImportedType(oldTypeName)
&& MessageDialog.CANCEL == Utility
.popOkCancel(
"Type define via Import",
"The type '"
+ oldTypeName
+ "' is also defined in 1 or more imports. Changing the type name here will not change it in the imported type file, causing both types to be in the type system, together. Please confirm this is what you intend.",
MessageDialog.WARNING))
return;
if (isBuiltInType(oldTypeName)
&& MessageDialog.CANCEL == Utility
.popOkCancel(
"Type was extending a built-in",
"The type '"
+ oldTypeName
+ "' was extending a builtin type of the same name. Changing the type name here will not change the built-in type, causing both types to be in the type system, together. Please confirm this is what you intend.",
MessageDialog.WARNING))
return;
if (isImportedType(oldTypeName) || isImportedType(newTypeName) || isBuiltInType(oldTypeName)
|| isBuiltInType(newTypeName))
mergeAndRefreshNeeded = true;
}
valueChanged = false;
// guaranteed non-null because otherwise edit not allowed
TypeDescription localTd = getLocalTypeDefinition(td);
typeUpdate(localTd, dialog);
if (!valueChanged)
return;
if (mergeAndRefreshNeeded) {
rebuildMergedTypeSystem();