protected void executeAddExtensions() { if (addExtensionsCommand != null && addExtensionsCommand.canExecute()) addExtensionsCommand.execute(); }
public void redo() { if (removeCommand != null) { removeCommand.redo(); } }
/** * Creates a decorator instance for the given command. * @param command the command to wrap. */ public CommandWrapper(Command command) { super(command.getLabel(), command.getDescription()); this.command = command; }
if (dragCommand.canExecute()) dragCommand.execute(); dropCommand = AddCommand.create(domain, optimizedDropCommandOwner, null, dragCommand.getResult()); dragCommand.execute(); if (dropCommand.canExecute()) dropCommand.execute();
if (dragCommand.canExecute() && dragCommand.canUndo()) dragCommand.execute(); isDragCommandExecuted = true; dropCommand = AddCommand.create(domain, owner, null, dragCommand.getResult()); if (analyzeForNonContainment(dropCommand)) dropCommand.dispose(); dropCommand = UnexecutableCommand.INSTANCE; dragCommand.undo(); dragCommand.dispose(); isDragCommandExecuted = false; dragCommand = IdentityCommand.INSTANCE; result = dragCommand.canExecute() && dropCommand.canExecute();
public void doExecute() { CMPAttribute cmpAttribute = (CMPAttribute) this.owner; JavaHelpers type = cmpAttribute.getType(); super.doExecute(); if (cmpAttribute.getType() != type) { setTypeCommand = SetCommand.create(this.domain, this.owner, EcorePackage.eINSTANCE.getETypedElement_EType(), type); if (setTypeCommand.canExecute()) { setTypeCommand.execute(); } else { setTypeCommand.dispose(); setTypeCommand = null; } } }
public boolean canExecute() { return baseCommand.canExecute(); }
protected boolean optimizedCanExecute() { // We'll assume that the copy command can execute and that adding a copy of the clipboard // is the same test as adding the clipboard contents itself. // Command addCommand = AddCommand.create(domain, owner, feature, domain.getClipboard()); boolean result = addCommand.canExecute(); addCommand.dispose(); return result; }
@Override public Collection<?> doGetResult() { return copyCommand.getResult(); }
@Override public Collection<?> doGetAffectedObjects() { return copyCommand.getAffectedObjects(); }
/** * Delegates to the execute method of the command. */ public void execute() { if (command != null) { command.execute(); } }
public String getLabel() { return baseCommand.getLabel(); }
public void execute() { // Remove all the mappings from the root. // MappingRoot mappingRoot = domain.getMappingRoot(); //removeCommand = RemoveCommand.create(domain, mappingRoot, mappingRoot.ePackageMapping().getMapping_Nested(), mappingRoot.getNested()); removeCommand = RemoveCommand.create(domain, mappingRoot, MappingPackage.eINSTANCE.getMapping_Nested(), mappingRoot.getNested()); if (removeCommand.canExecute()) { removeCommand.execute(); } else { removeCommand.dispose(); removeCommand = null; } // This is the tricky part where we set the encoding // that we'd like to have decoded as a series of commands to execute after this command has completed. // PersistentCommandStack commandStack = (PersistentCommandStack)domain.getCommandStack(); commandStack.setEncoding(domain, mappingRoot.getCommandStack()); }
@Override protected boolean prepare() { copyCommand = CopyCommand.create(domain, sourceObjects); return copyCommand.canExecute(); }
protected boolean optimizedCanExecute() { // We'll assume that the copy command can execute and that adding a copy of the clipboard // is the same test as adding the clipboard contents itself. // Command addCommand = AddCommand.create(domain, owner, null, collection); boolean result = addCommand.canExecute() && !analyzeForNonContainment(addCommand); addCommand.dispose(); return result; }