private Command createCopyCommand(List selectedObjects) {
if (selectedObjects == null || selectedObjects.isEmpty()) {
return null;
}
CopyRecordCommand cmd = new CopyRecordCommand();
Object o;
Iterator it = selectedObjects.iterator();
while (it.hasNext()) {
o = it.next();
if (!(o instanceof EditPart))
continue;
EditPart ep = (EditPart) o;
LayoutElementRecord node = (LayoutElementRecord) ep.getModel();
if (!cmd.isCopyableNode(node)) // TODO only copy others?
return null;
cmd.addElement(node);
}
return cmd;
}