1 | if (collection == null)↵ | | 1 | if (collection == null)↵
|
2 | {↵ | | 2 | {↵
|
3 | return false;↵ | | 3 | return false;↵
|
4 | }↵ | | 4 | }↵
|
|
5 | // We'll try adding a shallow copy of the clipboard contents, instead of a full copy.↵ | | 5 | // We'll try adding a shallow copy of the clipboard contents, instead of a full copy.↵
|
6 | // Note: we can't just try adding the clipboard contents itself, because the copy may be a↵ | | 6 | // Note: we can't just try adding the clipboard contents itself, because the copy may be a↵
|
7 | // different type then what's on the clipboard (e.g. EJB Field -> RDB Column).↵ | | 7 | // different type then what's on the clipboard (e.g. EJB Field -> RDB Column).↵
|
8 | //↵ | | 8 | //↵
|
9 | CopyCommand.Helper copyHelper = new CopyCommand.Helper();↵ | | 9 | CopyCommand.Helper copyHelper = new CopyCommand.Helper();↵
|
10 | CompoundCommand shallowCopyCommand = new CompoundCommand(CompoundCommand.MERGE_COMMAND_ALL);↵ | | 10 | CompoundCommand shallowCopyCommand = new CompoundCommand(CompoundCommand.MERGE_COMMAND_ALL);↵
|
11 | for (Object object : collection)↵ | | 11 | for (Object object : collection)↵
|
12 | {↵ | | 12 | {↵
|
13 | if (!shallowCopyCommand.appendAndExecute(CreateCopyCommand.create(domain, object, copyHelper)))↵ | | 13 | if (!shallowCopyCommand.appendAndExecute(CreateCopyCommand.create(domain, object, copyHelper)))↵
|
14 | {↵ | | 14 | {↵
|
15 | shallowCopyCommand.dispose();↵ | | 15 | shallowCopyCommand.dispose();↵
|
16 | return false;↵ | | 16 | return false;↵
|
17 | }↵ | | 17 | }↵
|
18 | }↵ | | 18 | }↵
|
|
19 | Command addCommand = AddCommand.create(domain, owner, null, shallowCopyCommand.getResult());↵ | | 19 | Command addCommand = AddCommand.create(domain, owner, feature, shallowCopyCommand.getResult());↵
|
20 | boolean result = addCommand.canExecute();↵ | | 20 | boolean result = addCommand.canExecute();↵
|
|
21 | shallowCopyCommand.dispose();↵ | | 21 | shallowCopyCommand.dispose();↵
|
22 | addCommand.dispose();↵ | | 22 | addCommand.dispose();↵
|
|
23 | return result; | | 23 | return result;
|