Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Philosophy behind empty CompoundCommands?
Philosophy behind empty CompoundCommands? [message #514557] Mon, 15 February 2010 18:39 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
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
Re: Philosophy behind empty CompoundCommands? [message #514606 is a reply to message #514557] Mon, 15 February 2010 22:45 Go to previous message
Ed Merks is currently offline Ed MerksFriend
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/
Previous Topic:Re: model/TreeView synchronization problem.
Next Topic:Order of elements in many efeature changes during read of xml through Dynamic EMF
Goto Forum:
  


Current Time: Sat Apr 27 02:07:36 GMT 2024

Powered by FUDForum. Page generated in 0.02366 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top