@Override protected boolean prepare() { copyCommand = CopyCommand.create(domain, sourceObjects); return copyCommand.canExecute(); }
/** * This creates a primitive {@link org.eclipse.emf.edit.command.CopyCommand}. */ protected Command createCopyCommand(EditingDomain domain, EObject owner, CopyCommand.Helper helper) { return new CopyCommand(domain, owner, helper, domain.getOptimizeCopy()); }
addCreateCopyCommands(createCommand, owner); append(createCommand.unwrap()); append(initializeCommand); append(IdentityCommand.INSTANCE);
protected void addCreateCopyCommands(CompoundCommand compoundCommand, EObject object) { // Create a command to create a copy of the object. // Command createCopyCommand = CreateCopyCommand.create(domain, object, copyHelper); compoundCommand.append(createCopyCommand); if (createCopyCommand instanceof ChildrenToCopyProvider && createCopyCommand.canExecute()) { for (Object child : ((ChildrenToCopyProvider)createCopyCommand).getChildrenToCopy()) { addCreateCopyCommands(compoundCommand, (EObject)child); } } else { // Create commands to create copies of the children. // for (EObject child : object.eContents()) { addCreateCopyCommands(compoundCommand, child); } } }
@Override protected boolean prepare() { // Since input objects are read-only, we don't need to make a copy of them for the clipboard. // We can just put a pointer to the original object(s) on the clipboard. // copyCommand = new IdentityCommand(inputObjects); // Do we also have some non-input objects to copy? // if (sourceObjects.size() > 0) { copyCommand = copyCommand.chain(CopyCommand.create(domain, sourceObjects)); } return copyCommand.canExecute(); }
@Override protected boolean prepare() { // Since input objects are read-only, we don't need to make a copy of them for the clipboard. // We can just put a pointer to the original object(s) on the clipboard. // copyCommand = new IdentityCommand(inputObjects); // Do we also have some non-input objects to copy? // if (sourceObjects.size() > 0) { copyCommand = copyCommand.chain(CopyCommand.create(domain, sourceObjects)); } return copyCommand.canExecute(); }
@Override public void setPropertyValue(Object thisObject, final Object value) { final MappingDomain domain = mapping.getMappingRoot().getDomain(); final Object feature = itemPropertyDescriptor.getFeature(value); CompoundCommand compound = new StrictCompoundCommand(); final Command copyCommand = CopyCommand.create(domain, typeMappingHelper); compound.append(copyCommand); compound.append (new CommandWrapper() { @Override protected Command createCommand() { return SetCommand.create(domain, copyCommand.getResult().iterator().next(), feature, value); } }); compound.append (new CommandWrapper() { @Override protected Command createCommand() { return SetCommand.create(domain, mapping, MappingPackage.eINSTANCE.getMapping_Helper(), copyCommand.getResult().iterator().next()); } }); domain.getCommandStack().execute(compound); }
final Command copyCommand = CopyCommand.create(domain, domain.getClipboard()); command.append(copyCommand);
@Override public void setPropertyValue(Object thisObject, final Object value) { final MappingDomain domain = mapping.getMappingRoot().getDomain(); final Object feature = itemPropertyDescriptor.getFeature(value); CompoundCommand compound = new StrictCompoundCommand(); final Command copyCommand = CopyCommand.create(domain, typeMappingHelper); compound.append(copyCommand); compound.append (new CommandWrapper() { @Override protected Command createCommand() { return SetCommand.create(domain, copyCommand.getResult().iterator().next(), feature, value); } }); compound.append (new CommandWrapper() { @Override protected Command createCommand() { return SetCommand.create(domain, mapping, MappingPackage.eINSTANCE.getMapping_Helper(), copyCommand.getResult().iterator().next()); } }); domain.getCommandStack().execute(compound); }
dragCommand = CopyCommand.create(domain, collection);
dragCommand = CopyCommand.create(domain, collection);