Import imp = createImport(fullPathFileName, isImportByName);
// key is shortName plus a suffix if needed to make it unique.
// The set of existing keys is obtained from the model,
// not from the GUI table (as was the case in earlier design)
FlowControllerDeclaration oldFcd = getFlowControllerDeclaration();
setFlowControllerDeclaration(null);
String keyName = produceUniqueComponentKey(shortName);
if (null == keyName) {
setFlowControllerDeclaration(oldFcd); // revert
return;
}
XMLizable inputDescription = readImport(imp, fullPathFileName, isImportByName);
if (null == inputDescription) {
setFlowControllerDeclaration(oldFcd); // revert
return;
}
if (!(inputDescription instanceof FlowControllerDescription)) {
Utility.popMessage("Invalid kind of descriptor", MessageFormat.format(
"Operation cancelled: The descriptor ''{0}'' being added is not a FlowController.",
new Object[] { maybeShortenFileName(fullPathFileName) }), MessageDialog.ERROR);
setFlowControllerDeclaration(oldFcd); // revert
return;
}
FlowControllerDeclaration fcd = new FlowControllerDeclaration_impl();
fcd.setKey(keyName);
fcd.setImport(imp);
setFlowControllerDeclaration(fcd);
// before adding the import, see if the merge type system is OK
if (!isValidAggregateChange()) {
setFlowControllerDeclaration(oldFcd); // revert