Example #1
0
 public CommandResult execute(CommandContext context, Selection selection) {
   Clipboard.get(context).set(context.getScreen(), selection, this);
   return new BatchResult(
       new UpdateCommandsResult(),
       new NotificationResult(context, this)
           .setArgs(selection.size())
           .setDefaultMessage("{0,choice,1#Item|1<{0} items} put into the clipboard"));
 }
Example #2
0
 @Override
 public boolean isEnabled(CommandContext context, Selection selection) {
   if (selection.isEmpty()) {
     return false;
   }
   CopyAndPaste dao = getDao(context.getScreen());
   for (SelectionItem item : selection) {
     if (!dao.canCopy(item.getObject())) {
       return false;
     }
   }
   return true;
 }