boolean isIconSet = false;
int i = 1;
GTIngredientList list = attribute.getIngredientList();
for (GTIngredient ingredient : list) {
if (ingredient instanceof PortCriterion) {
PortCriterion criterion = (PortCriterion) ingredient;
String portID = criterion.getPortID(list);
preservedPortNames.add(portID);
TypedIOPort port = (TypedIOPort)
((ComponentEntity) entity).getPort(portID);
boolean isInput = criterion.isInput();
boolean isOutput = criterion.isOutput();
boolean isMultiport = !criterion.isMultiportEnabled()
|| criterion.isMultiport();
if (port != null) {
if (port instanceof PortMatcher) {
port.setInput(isInput);
port.setOutput(isOutput);
} else {
MoMLChangeRequest request =
new MoMLChangeRequest(entity, (NamedObj) entity,
"<deletePort name=\"" + port.getName()
+ "\"/>");
request.setUndoable(true);
request.setMergeWithPreviousUndo(true);
request.execute();
port = new PortMatcher(criterion,
(ComponentEntity) entity, portID, isInput,
isOutput);
port.setPersistent(false);
}
} else {
port = new PortMatcher(criterion,
(ComponentEntity) entity, portID, isInput,
isOutput);
port.setPersistent(false);
}
port.setMultiport(isMultiport);
} else if (ingredient instanceof SubclassCriterion
&& !isIconSet) {
SubclassCriterion criterion = (SubclassCriterion) ingredient;
final String superclass = criterion.getSuperclass();
((NamedObj) entity).requestChange(new ChangeRequest(entity,
"Deferred load actor icon action.") {
protected void _execute() throws Exception {
_loadActorIcon(entity, superclass);
}