|
Re: Philosophy behind empty CompoundCommands? [message #514606 is a reply to message #514557] |
Mon, 15 February 2010 22:45 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Hauke,
A no-op command on the command stack would be kind of pointless. In any
case, even if the design is less than idea, after eight years being that
way, it's not something that ought to be changed.
Hauke Fuhrmann wrote:
> Dear EMF folks,
>
> I do not understand the philosophy behind CompoundCommands in EMF,
> especially their behavior when they are empty. Maybe someone could
> enlighten me?
>
> An empty CompoundCommand will not prepare, is not executable and
> unwrap() will result an UnexecutableCommand. I think this is quite
> odd; I would expect it would still be able to execute but do nothing.
>
> The effect is quite severe, as an empty CompoundCommand will let a
> transaction fail or put into another CompoundCommand the latter will
> also be unexecutable:
>
> CompoundCommand c1 = new CompoundCommand();
> ...
> CompoundCommand c2 = new CompoundCommand();
> if(condition)
> c2.append(someOtherCommand);
> c1.append(c2.unwrap());
>
>
> The scheme around c2 is explicitly encouraged by the Javadoc of the
> unwrap() method. Here the executable state of c1 depends on the
> condition that should only influence c2. Is this really desired
> behavior? Am I using these CompoundCommands maybe in a strange way?
>
> It's like appending an empty String to a String or an Empty List to a
> List. I would expect the original item to be unchanged of such action...
>
> Cheers,
> Hauke
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02366 seconds