Skip to main content



      Home
Home » Modeling » EMF » Philosophy behind empty CompoundCommands?
Philosophy behind empty CompoundCommands? [message #514557] Mon, 15 February 2010 13:39 Go to next message
Eclipse UserFriend
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 17:45 Go to previous message
Eclipse UserFriend
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
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: Tue Jul 08 10:59:39 EDT 2025

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

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

Back to the top