NamedObj entity = getEntity("blank");
Attribute attribute = getAttribute("blank");
NamedObj newModel;
if (entity != null) {
newModel = (NamedObj) entity.clone(new Workspace());
// The cloning process results an object that defers change
// requests. By default, we do not want to defer change
// requests, but more importantly, we need to execute
// any change requests that may have been queued
// during cloning. The following call does that.
newModel.setDeferringChangeRequests(false);
} else if (attribute != null) {
newModel = (NamedObj) attribute.clone(new Workspace());
// The cloning process results an object that defers change
// requests. By default, we do not want to defer change
// requests, but more importantly, we need to execute
// any change requests that may have been queued
// during cloning. The following call does that.
newModel.setDeferringChangeRequests(false);
} else {
newModel = new TypedCompositeActor(new Workspace());
}
// The model should have a parser associated with it
// so that undo works. The following method will create
// a parser, if there isn't one already.