/** * This creates a command to remove multiple objects. */ public static Command create(final EditingDomain domain, final Collection<?> collection) { return create(domain, null, null, collection); }
/** * This creates a command to remove an object. */ public static Command create(EditingDomain domain, Object value) { return create(domain, Collections.singleton(value)); }
/** * This creates a command to remove a particular value from the specified feature of the owner. */ public static Command create(EditingDomain domain, Object owner, Object feature, Object value) { return create(domain, owner, feature, Collections.singleton(value)); }
@Override protected void doRemove(EObject container, EReference reference, EObject element) throws ModelManipulationException { Command removeCommand = RemoveCommand.create(domain, container, reference, element); executeCommand(removeCommand); }
protected RemoveCommand createRemoveCommand(Collection elements) { return (RemoveCommand) RemoveCommand.create(getDomain(), elements); }
protected void prepareCommand() { append(RemoveCommand.create(domain, collection)); }
@Override protected void doRemove(EObject container, EStructuralFeature reference) throws ModelManipulationException { Collection<?> list = (Collection<?>) container.eGet(reference); Command removeCommand = RemoveCommand.create(domain, container, reference, list); executeCommand(removeCommand); }
@Override protected void doRemove(EObject container, EStructuralFeature feature, Object element) throws ModelManipulationException { Command removeCommand = RemoveCommand.create(domain, container, feature, element); // Do not throw exception for incorrect remove to ensure identical behavior to simple implementation if (removeCommand.canExecute()) { executeCommand(removeCommand); } }
@Override protected void doRemove(EObject container, EStructuralFeature reference) throws ModelManipulationException { Collection<?> list = (Collection<?>) container.eGet(reference); Command removeCommand = RemoveCommand.create(domain, container, reference, list); executeCommand(removeCommand); }
/** * This creates a command to remove an object * and set it to the clipboard. */ public static Command create(EditingDomain domain, Object value) { if (domain == null) { return new CutToClipboardCommand(domain, RemoveCommand.create(domain, value)); } else { return domain.createCommand(CutToClipboardCommand.class, new CommandParameter(null, null, Collections.singleton(value))); } }
/** * This creates a command to remove a particular value from the specified feature of the owner * and set it to the clipboard. */ public static Command create(EditingDomain domain, Object owner, Object feature, Object value) { if (domain == null) { return new CutToClipboardCommand(domain, RemoveCommand.create(domain, owner, feature, value)); } else { return domain.createCommand(CutToClipboardCommand.class, new CommandParameter(owner, feature, Collections.singleton(value))); } }
/** * This creates a command to remove multiple objects * and set it to the clipboard. */ public static Command create(EditingDomain domain, Collection<?> collection) { if (domain == null) { return new CutToClipboardCommand(domain, RemoveCommand.create(domain, collection)); } else { return domain.createCommand(CutToClipboardCommand.class, new CommandParameter(null, null, collection)); } }
/** * This creates a command to remove a collection of values from the specified feature of the owner * and set it to the clipboard. */ public static Command create(EditingDomain domain, Object owner, Object feature, Collection<?> collection) { if (domain == null) { return new CutToClipboardCommand(domain, RemoveCommand.create(domain, owner, feature, collection)); } else { return domain.createCommand(CutToClipboardCommand.class, new CommandParameter(owner, feature, collection)); } }
commandList.add(RemoveCommand.create(mappingDomain, mapping, MappingPackage.eINSTANCE.getMapping_Outputs(), object));
commandList.add(RemoveCommand.create(mappingDomain, mapping, MappingPackage.eINSTANCE.getMapping_Outputs(), object));
/** * Return a Remove Command that will be executed by a CommandStack. */ protected Command createRemoveCommand(ModifierHelper aHelper) { Object value = getValue(aHelper); Command command = null; EStructuralFeature feature = aHelper.getFeature(); if (valueChanged(aHelper.getOwner(), feature, value, true)) { if (isValueEqual(aHelper, value)) { command = RemoveCommand.create(getEditingDomain(), aHelper.getOwner(), feature, (Collection) value); } else { command = RemoveCommand.create(getEditingDomain(), aHelper.getOwner(), feature, value); } ((AbstractCommand) command).setLabel(createCommandLabel(REMOVE_PATTERN, feature)); setStatus(VALUE_CHANGE); } else { setStatus(NO_VALUE_CHANGE); } return command; }
/** * This attempts to prepare a drop move on operation. */ protected boolean prepareDropMoveOn() { if (isCrossDomain()) { dragCommand = IdentityCommand.INSTANCE; dropCommand = UnexecutableCommand.INSTANCE; } else { dropCommand = AddCommand.create(domain, owner, null, collection); if (analyzeForNonContainment(dropCommand)) { dropCommand.dispose(); dropCommand = UnexecutableCommand.INSTANCE; dragCommand = IdentityCommand.INSTANCE; } else { dragCommand = RemoveCommand.create(domain, collection); } } boolean result = dragCommand.canExecute() && dropCommand.canExecute(); return result; }
@Override protected void doRemove(EObject object) throws ModelManipulationException { Command removeCommand = null; if (object.eContainer() != null) { /* * We must explicitly use container and feature to make this work in non-OSGi environment, otherwise the * command creation tries to find the parent using item providers that are registered by extension points * (or manually be the user) */ removeCommand = RemoveCommand.create(domain, object.eContainer(), object.eContainingFeature(), object); } else { // DeleteCommand cannot deal with root objects removeCommand = new RemoveCommand(domain, object.eResource().getContents(), object); } executeCommand(removeCommand); }
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()); }
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()); }