protected void mapOutputObject(Object outputObject, Object originatingInput, CompoundCommand subcommands) { subcommands.appendAndExecute(CreateMappingCommand.create(mappingDomain, originatingInput, outputObject)); }
protected void mapOutputObject(Object outputObject, Object originatingInput, CompoundCommand subcommands) { subcommands.appendAndExecute(CreateMappingCommand.create(mappingDomain, originatingInput, outputObject)); }
subcommands.appendAndExecute(commands.previous());
subcommands.appendAndExecute(commands.previous());
public void execute() { // This will deal with all the subcommands to modifying the root mapping tree. // CompoundCommand subcommands = new CompoundCommand(); // For each mapping being removed... // for (Object object : collection) { Mapping mapping = (Mapping)object; Mapping parentMapping = mapping.getNestedIn(); // Make sure the back pointers to this mapping from the mapped objects is set. // domain.getMappingRoot().deregister(mapping); // Create a command to do parentMapping.getNested().remove(mapping). // //subcommands.appendAndExecute(new RemoveCommand(domain, parentMapping, parentMapping.ePackageMapping().getMapping_Nested(), mapping)); subcommands.appendAndExecute(new RemoveCommand(domain, parentMapping, MappingPackage.eINSTANCE.getMapping_Nested(), mapping)); Collection<Mapping> nestedMappings = new ArrayList<Mapping>(mapping.getNested()); if (!nestedMappings.isEmpty()) { //subcommands.appendAndExecute(new RemoveCommand(domain, mapping, mapping.ePackageMapping().getMapping_Nested(), nestedMappings)); //subcommands.appendAndExecute(new AddCommand(domain, parentMapping, parentMapping.ePackageMapping().getMapping_Nested(), nestedMappings)); subcommands.appendAndExecute(new RemoveCommand(domain, mapping, MappingPackage.eINSTANCE.getMapping_Nested(), nestedMappings)); subcommands.appendAndExecute(new AddCommand(domain, parentMapping, MappingPackage.eINSTANCE.getMapping_Nested(), nestedMappings)); } } subcommand = subcommands.unwrap(); }
public void execute() { // This will deal with all the subcommands to modifying the root mapping tree. // CompoundCommand subcommands = new CompoundCommand(); // For each mapping being removed... // for (Object object : collection) { Mapping mapping = (Mapping)object; Mapping parentMapping = mapping.getNestedIn(); // Make sure the back pointers to this mapping from the mapped objects is set. // domain.getMappingRoot().deregister(mapping); // Create a command to do parentMapping.getNested().remove(mapping). // //subcommands.appendAndExecute(new RemoveCommand(domain, parentMapping, parentMapping.ePackageMapping().getMapping_Nested(), mapping)); subcommands.appendAndExecute(new RemoveCommand(domain, parentMapping, MappingPackage.eINSTANCE.getMapping_Nested(), mapping)); Collection<Mapping> nestedMappings = new ArrayList<Mapping>(mapping.getNested()); if (!nestedMappings.isEmpty()) { //subcommands.appendAndExecute(new RemoveCommand(domain, mapping, mapping.ePackageMapping().getMapping_Nested(), nestedMappings)); //subcommands.appendAndExecute(new AddCommand(domain, parentMapping, parentMapping.ePackageMapping().getMapping_Nested(), nestedMappings)); subcommands.appendAndExecute(new RemoveCommand(domain, mapping, MappingPackage.eINSTANCE.getMapping_Nested(), nestedMappings)); subcommands.appendAndExecute(new AddCommand(domain, parentMapping, MappingPackage.eINSTANCE.getMapping_Nested(), nestedMappings)); } } subcommand = subcommands.unwrap(); }
if (subcommands.appendAndExecute(new AddCommand(domain, parentMapping, MappingPackage.eINSTANCE.getMapping_Nested(), mapping))) subcommands.appendAndExecute subcommands.appendAndExecute
if (subcommands.appendAndExecute(new AddCommand(domain, parentMapping, MappingPackage.eINSTANCE.getMapping_Nested(), mapping))) subcommands.appendAndExecute subcommands.appendAndExecute
@Override protected boolean optimizedCanExecute() { if (collection == null) { return false; } // We'll try adding a shallow copy of the clipboard contents, instead of a full copy. // Note: we can't just try adding the clipboard contents itself, because the copy may be a // different type then what's on the clipboard (e.g. EJB Field -> RDB Column). // CopyCommand.Helper copyHelper = new CopyCommand.Helper(); CompoundCommand shallowCopyCommand = new CompoundCommand(CompoundCommand.MERGE_COMMAND_ALL); for (Object object : collection) { if (!shallowCopyCommand.appendAndExecute(CreateCopyCommand.create(domain, object, copyHelper))) { shallowCopyCommand.dispose(); return false; } } Command addCommand = AddCommand.create(domain, owner, null, shallowCopyCommand.getResult()); boolean result = addCommand.canExecute(); shallowCopyCommand.dispose(); addCommand.dispose(); return result; }
@Override protected boolean optimizedCanExecute() { if (collection == null) { return false; } // We'll try adding a shallow copy of the clipboard contents, instead of a full copy. // Note: we can't just try adding the clipboard contents itself, because the copy may be a // different type then what's on the clipboard (e.g. EJB Field -> RDB Column). // CopyCommand.Helper copyHelper = new CopyCommand.Helper(); CompoundCommand shallowCopyCommand = new CompoundCommand(CompoundCommand.MERGE_COMMAND_ALL); for (Object object : collection) { if (!shallowCopyCommand.appendAndExecute(CreateCopyCommand.create(domain, object, copyHelper))) { shallowCopyCommand.dispose(); return false; } } Command addCommand = AddCommand.create(domain, owner, null, shallowCopyCommand.getResult()); boolean result = addCommand.canExecute(); shallowCopyCommand.dispose(); addCommand.dispose(); return result; }
@Override protected boolean optimizedCanExecute() { Collection<?> collection = domain.getClipboard(); if (collection == null) { return false; } // We'll try adding a shallow copy of the clipboard contents, instead of a full copy. // Note: we can't just try adding the clipboard contents itself, because the copy may be a // different type then what's on the clipboard (e.g. EJB Field -> RDB Column). // CopyCommand.Helper copyHelper = new CopyCommand.Helper(); CompoundCommand shallowCopyCommand = new CompoundCommand(CompoundCommand.MERGE_COMMAND_ALL); for (Object object : collection) { if (!shallowCopyCommand.appendAndExecute(CreateCopyCommand.create(domain, object, copyHelper))) { shallowCopyCommand.dispose(); return false; } } Command addCommand = AddCommand.create(domain, owner, feature, shallowCopyCommand.getResult()); boolean result = addCommand.canExecute(); shallowCopyCommand.dispose(); addCommand.dispose(); return result; }
@Override protected boolean optimizedCanExecute() { Collection<?> collection = domain.getClipboard(); if (collection == null) { return false; } // We'll try adding a shallow copy of the clipboard contents, instead of a full copy. // Note: we can't just try adding the clipboard contents itself, because the copy may be a // different type then what's on the clipboard (e.g. EJB Field -> RDB Column). // CopyCommand.Helper copyHelper = new CopyCommand.Helper(); CompoundCommand shallowCopyCommand = new CompoundCommand(CompoundCommand.MERGE_COMMAND_ALL); for (Object object : collection) { if (!shallowCopyCommand.appendAndExecute(CreateCopyCommand.create(domain, object, copyHelper))) { shallowCopyCommand.dispose(); return false; } } Command addCommand = AddCommand.create(domain, owner, feature, shallowCopyCommand.getResult()); boolean result = addCommand.canExecute(); shallowCopyCommand.dispose(); addCommand.dispose(); return result; }