| Summary: | [Papyrus Model Explorer] Undo does not work after move (inside model explorer) | ||
|---|---|---|---|
| Product: | [Modeling] Papyrus | Reporter: | Yann Tanguy <yann.tanguy> |
| Component: | Core | Assignee: | Patrick Tessier <Patrick.Tessier> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Yann Tanguy
Done in the revision 3383
The emf set command when it is used in the context of a change of container
create only an add command. So during the undo there was no add in the old container and we see only as a remove.
So to solve it, I had explicitly a remove command before. For the do it is unuseful but for the undo it is useful to add into the old container
//before modification the code was:
commandList.add(SetCommand.create(domain, targetOwner, eStructuralFeature, tmp));
//after modification it is:
Command emfCommand= RemoveCommand.create(domain, childElement);
emfCommand=emfCommand.chain( SetCommand.create(domain, targetOwner, eStructuralFeature, tmp));
commandList.add(emfCommand);
Moreover Set command can return unoable command see the comment of this class
/**
* The set command logically acts upon an owner object to set a particular feature to a specified value or to unset a feature.
* The static create methods delegate command creation to {@link EditingDomain#createCommand EditingDomain.createCommand},
* which may or may not result in the actual creation of an instance of this class.
*
* <p>
* The implementation of this class is low-level and EMF specific;
* it allows a value to be set to a single-valued feature of an owner,
* i.e., it is equivalent of the call
* <pre>
* ((EObject)object).eSet((EStructuralFeature)feature, value);
* </pre>
* or to
* <pre>
* ((EObject)object).eUnset((EStructuralFeature)feature);
* </pre>
* if the value is {@link #UNSET_VALUE}.
* <p>
* Setting a feature that is a bidirectional reference with a multiplicity-many reverse or with a
* multiplicity-1 reverse that is already set (on value), is not undoable.
* In this case, the SetCommand static create function will not return an instance of this class, but
* instead will return a compound command (e.g., a {@link RemoveCommand} followed by an {@link AddCommand}
* for the other end of the relation) which could not be undone.
* <p>
* The exception to the above is when an empty list is being set to empty or unset. Such commands are undoable
* and represent the only way to toggle whether the feature is set.
* <p>
* When setting a containment (or container) feature, we always assume that the object that will be
* contained is not already in a container, but take no action in this class to ensure this is the case.
* <p>
* A set command is an {@link OverrideableCommand}.
*/
|