I dug a little bit into the code. The reason that i thought that henshin does automatically add but not remove root objects is that in the application wizard in the UI there is a code clone (Henshination.java/runUnitApplication:230)
which does half of the work of InterpreterUtil.applyToResource(), namely adding new root objects to the resource. But the other half of it, removing deleted root objects from the resource is not there. This is were my misinterpretation came from during my
tests. The question is now whether to do both parts or none in the wizard. The current implementation seems to be awkward.
To your point about containment edges, is a containment relation between objects in the containment tree not similar to the containment relation between a resource and a root object?
While i probably still tend to disagree :-) with the decision not to add/remove root objects to/from the resource directly in the interpreter, i can live with it due the mentioned Utility class.
Hi Matthias,
Henshin itself does not add or remove objects to resources. If you explicitly create or delete a containment edge, the effect will be that the target object is added to / removed from the containment tree and hence to / from the resource. For
root objects, there is of course no containment edge, which is why Henshin does not add or remove root objects to resources.
You said that Henshin adds objects as roots to resources. I don't think that is actually true. (except for the helper InterpreterUtil.applyToResource() method).
Cheers,
Christian