public void performExecution() { if (compoundCommand != null) { try { actualCommandStack.execute(compoundCommand); } finally { compoundCommand = null; } } }
/** * Execute a command directly on the command stack */ public void executeViaStack(Command command) { getCommandStack().execute(command); }
protected void executeCommand(Command command) throws ModelManipulationException { if (command.canExecute()) { domain.getCommandStack().execute(command); } else { throw new ModelManipulationException("Cannot execute command"); } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyServiceInterfaceText command = new CommandModifyServiceInterfaceText(null, null, eObject_, text_.getText()); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyHandlerClassText command = new CommandModifyHandlerClassText(null, null, eObject_, text_.getText()); if (artifactEdit != null) { artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, text_.getText(), nillable_); if (artifactEdit != null) { artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { //Handle PortComponentRef_ServiceEndpointInterface feature in a special way. String SEIFeatureName = Webservice_clientPackage.eINSTANCE.getPortComponentRef_ServiceEndpointInterface().getName(); if ((eObject_ instanceof PortComponentRef) && (feature_.getName().equals(SEIFeatureName))) { CommandModifySEI command = new CommandModifySEI(null, null, (PortComponentRef) eObject_, text_.getText(), nillable_); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } else { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, text_.getText(), nillable_); artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } }
/** * Sets the property value. If an editing domain can be obtained, the command returned by {@link #createSetCommand * createSetcommand} is executed; otherwise, {@link #setValue setValue} is called to set the value. */ @Override public void setPropertyValue(Object object, Object value) { EObject eObject = (EObject)owner; EditingDomain editingDomain = getEditingDomain(owner); if (editingDomain == null) { setValue(eObject, feature, value); } else { editingDomain.getCommandStack().execute(createSetCommand(editingDomain, eObject, feature, value)); } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { //Handle QName_NamespaceURI feature in a special way. String namespaceFeatureName = CommonPackage.eINSTANCE.getQName_NamespaceURI().getName(); if ((eObject_ instanceof QName) && (feature_.getName().equals(namespaceFeatureName))) { CommandModifyNSURI command = new CommandModifyNSURI(null, null, (QName) eObject_, text_.getText(), nillable_); if (artifactEdit != null) { artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } else { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, text_.getText(), nillable_); if (artifactEdit != null) { artifactEdit.getContentModelRoot().eResource().setModified(true); artifactEdit.getCommandStack().execute(command); } } } } }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, text_.getText(), nillable_); artifactEdit_.getContentModelRoot().eResource().setModified(true); artifactEdit_.getCommandStack().execute(command); } }
/** * Execute this modifier by creating a Command that is executed on the CommandStack. If this * modifier cannot execute commands, the execution will not take place. Return true if the * execution was attempted. * * @see canExecuteCommand() */ public boolean execute() { boolean result = false; if (canExecuteCommand()) { try { Command command = createCommand(); result = command != null; if (result) { getCommandStack().execute(command); } } finally { release(); } } else { setStatus(ERROR); } return result; }
public void modifyText(ModifyEvent e) { if (syncTextAndModel()) { CommandModifyText command = new CommandModifyText(null, null, eObject_, feature_, expires(), nillable_); artifactEdit_.getContentModelRoot().eResource().setModified(true); artifactEdit_.getCommandStack().execute(command); } }
@Override public void setPropertyValue(Object object, Object value) { EObject eObject = (EObject)object; EditingDomain editingDomain = getEditingDomain(object); value = normalizeInstanceTypeName(stripToNull((String)value)); if (editingDomain == null) { eObject.eSet(EcorePackage.Literals.ECLASSIFIER__INSTANCE_CLASS_NAME, value); } else { // Set the instance type name instead, since that will also set the instance class name // but this way will make undo restore the current instance type name correctly // editingDomain.getCommandStack().execute (SetCommand.create(editingDomain, getCommandOwner(eObject), EcorePackage.Literals.ECLASSIFIER__INSTANCE_TYPE_NAME, value)); } } });
eGenericType.setETypeParameter((ETypeParameter)value); editingDomain.getCommandStack().execute (SetCommand.create(editingDomain, object, EcorePackage.Literals.ETYPED_ELEMENT__EGENERIC_TYPE, eGenericType));
editingDomain.getCommandStack().execute (SetCommand.create (editingDomain,
@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); }
@Override public void setPropertyValue(Object o, Object value) { XSDAttributeDeclaration xsdAttributeDeclaration = (XSDAttributeDeclaration)o; if (xsdAttributeDeclaration.isAttributeDeclarationReference()) { XSDAttributeDeclaration newResolvedAttributeDeclaration = xsdAttributeDeclaration.resolveAttributeDeclaration(xsdAttributeDeclaration.getTargetNamespace(), (String)value); EditingDomain editingDomain = getEditingDomain(xsdAttributeDeclaration); if (editingDomain == null) { xsdAttributeDeclaration.setResolvedAttributeDeclaration(newResolvedAttributeDeclaration); } else { editingDomain.getCommandStack().execute (SetCommand.create (editingDomain, xsdAttributeDeclaration, xsdPackage.getXSDAttributeDeclaration_ResolvedAttributeDeclaration(), newResolvedAttributeDeclaration)); } } else { super.setPropertyValue(o, value); } } });
@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); }
@Override public void setPropertyValue(Object o, Object value) { XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration)o; if (xsdElementDeclaration.isElementDeclarationReference()) { XSDElementDeclaration newResolvedElementDeclaration = xsdElementDeclaration.resolveElementDeclaration(xsdElementDeclaration.getTargetNamespace(), (String)value); EditingDomain editingDomain = getEditingDomain(xsdElementDeclaration); if (editingDomain == null) { xsdElementDeclaration.setResolvedElementDeclaration(newResolvedElementDeclaration); } else { editingDomain.getCommandStack().execute (SetCommand.create (editingDomain, xsdElementDeclaration, xsdPackage.getXSDElementDeclaration_ResolvedElementDeclaration(), newResolvedElementDeclaration)); } } else { super.setPropertyValue(o, value); } } });
command.append (SetCommand.create(editingDomain, object, EcorePackage.Literals.EGENERIC_TYPE__ETYPE_PARAMETER, value)); editingDomain.getCommandStack().execute(command);