Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Deletion of reference does also delete containment
Deletion of reference does also delete containment [message #222873] Thu, 26 March 2009 14:24 Go to next message
Daniel Rippel is currently offline Daniel RippelFriend
Messages: 29
Registered: July 2009
Junior Member
Hi everyone.

I have a model where my objects A are stored as containments under the
diagram root node.
Also contained in the root node are some objects B which hold references
to some of the elements A.

My problem: Each time I delete a reference in B the original element A
which is contained in the root node is also deleted. The same happens if
I delete one of the B's. All of the referenced A's are also deleted.

Does anybody know a way how this could be bypassed? The optimal solution
would be, that on deletion of a reference, a check would be triggerd if
there is still another reference to A. If there is one, A would stay
untouched, but if this was the last reference, A would also be deleted
from the containment (and thus from the model)

Thanks in advance,
Daniel
Re: Deletion of reference does also delete containment [message #223379 is a reply to message #222873] Mon, 30 March 2009 17:08 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

Are you sure reference from B to A is not a containment one?
By default only reference should be removed on deleting B instance - A should
stay on a diagram.

-----------------
Alex Shatalin
Re: Deletion of reference does also delete containment [message #223473 is a reply to message #223379] Tue, 31 March 2009 07:11 Go to previous messageGo to next message
Daniel Rippel is currently offline Daniel RippelFriend
Messages: 29
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------060608000205090301040001
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

I have set conmaintent to false in the ecore definition of the model.
Unfortunately I'm rather sure, that gmf doesn't make any difference
between the containment->True relation in the diagram node, and the
containment->False relation in B. It uses the following code to create
the property (which is A in the example):

public class Property2CreateCommand extends EditElementCommand {
....
ProductStructureDiagram.Property newElement =
ProductStructureDiagram.ProductStructureDiagramFactory.eINST ANCE
.createProperty();

ProductStructureDiagram.ProductStructureModel owner =
(ProductStructureDiagram.ProductStructureModel)
getElementToEdit().eContainer();
owner.getPSD_Property_Containment().add(newElement);
ProductStructureDiagram.Node_Object childHolder =
(ProductStructureDiagram.Node_Object) getElementToEdit();
childHolder.getProperties().add(newElement);
....

whereas the .eContainer in the owner statement is added manually because
the generated code tries to cast getElementToEdit first to model
(resulting in an exception) and then to the Node_Object where a
reference should be placed...

I couldn't find any other way to express an reference, than to set
eCores containment flag to false. (Attached a picture from the ecore
diagram)

Alex Shatalin schrieb:
> Hello Daniel,
>
> Are you sure reference from B to A is not a containment one? By default
> only reference should be removed on deleting B instance - A should stay
> on a diagram.
>
> -----------------
> Alex Shatalin
>
>


--------------060608000205090301040001
Content-Type: image/png;
name="PartOfTheECore.PNG"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="PartOfTheECore.PNG"

iVBORw0KGgoAAAANSUhEUgAAAlkAAAC+CAIAAACJRI0DAAAAAXNSR0IArs4c 6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgA ABdwnLpRPAAA
GlJJREFUeF7tndtzFce1h33+Jx6TSogNwYbEIa+88AfkgYpjjFJgBERg7LIr URwJndgCyQiS
4wv4AUMloYLkTSWpckBIQgoYW/CYvTegLVAs8cIZscN4mOnbXHdP90dNuWSp L2t9a+3+zepp
af7n8ePHz/EPAhCAAAQg4DOBQAv5BwEIQAACEPCZwHM+O4/vEIAABCAAgfX9 UShAAAIQgAAE
PCeAFnqeALgPAQhAAALUheQABCAAAQh4T4C60PsUAAAEIAAB7wmghd6nAAAg AAEIeE8ALfQ+
BQAAAQhAwHsCaKH3KQAACEAAAt4TQAu9TwEAPH78aHVltjF25eJw7IINBCDg CQG00JNA46aK
wMpy6/TRF84Obb8wvjN5fTa640T/hjsLl4CoJXD27FltGxpAwEICaKGFQcGk qgl0tfCr2ROr
a9eS1/27k6eOfq9ULQz+DGQZPpc0rMJUtLCMODJmBQRK+QRWYDdTQKBAAoEW ThzddGt2TKaF
J9/4vlALZWKTVoTSto/5Hv2LytEfqYfNOamQP1pYYFoyVJUE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001--
Re: Deletion of reference does also delete containment [message #223572 is a reply to message #223473] Tue, 31 March 2009 10:46 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

Looks like Property is described as a child element of Node_Object in your
..gmfmap model (otherwise why generated Property2CreateCommand casting element
to edit to Node_Object..)

Can you please briefly explain me a structure of mapping model in this situation?
In general if you are describing a node and child elements/links from this
node then corresponding children/link domain model element should be deleted
from morel on deleting the node…

Looking on your model structure I propose following mapping:
- TopNodeMapping for Node_Object
- TopNodeMapping for Property
- LinkMapping with LinkMetaFeature set to a reference from Node_Object to
Property
In this case Property should not be removed on deleting a link from Node_Object
to Property or NodeObject itself..

-----------------
Alex Shatalin
Re: Deletion of reference does also delete containment [message #223651 is a reply to message #223572] Tue, 31 March 2009 12:28 Go to previous messageGo to next message
Daniel Rippel is currently offline Daniel RippelFriend
Messages: 29
Registered: July 2009
Junior Member
Hi Alex,

yes you are right, acutally I use a ChildReference to access the
Properties, and to put them in the according compartment. The
ChildReference has set Containment on the DiagramRoots containment and
ChildrenFeature on the Node_Objects non-containment-reference.

My actual Model looks like:
TopNode Node_Object
|- Compartment
|- ChildReference Property (Containment:
DiagramRoot.PropertyContainment/ChildrenFeature: Node_Object.Properties)

There are some other TopNodes (witch are rather similar to the
Node_Object) and one Link Maping for the associations that could be
drawn in the model.

I have tried to use a Top Node Reference to define the Properties, but
then I'm not sure how to create them correctly (using Node_Objects
childreference and setting Referenced Child to the top node does only
create the property in the Root-Containment and then crashes when trying
to add it to the Node_Object (again it tries to cast to both from
getElementToEdit() )

I'm not sure how I could create a Link Maping, using the non containment
relationship as containment feature, or how i could include a link in an
compartment. My situation is the following: I want to create something
that looks similar to the uml class. Box (Node_Object) with an
compartment of referenced Properties (Each displayed in a shared
WrappingLabel). These properties are contained in the DiagramRoot
because I need to have a complete list of all of them, and because the
Node_Object should only use references to the object, so that changing
one of them also influences and updates the other references (this works
fine)

Alex Shatalin schrieb:
> Hello Daniel,
>
> Looks like Property is described as a child element of Node_Object in
> your .gmfmap model (otherwise why generated Property2CreateCommand
> casting element to edit to Node_Object..)
>
> Can you please briefly explain me a structure of mapping model in this
> situation? In general if you are describing a node and child
> elements/links from this node then corresponding children/link domain
> model element should be deleted from morel on deleting the node…
> Looking on your model structure I propose following mapping:
> - TopNodeMapping for Node_Object
> - TopNodeMapping for Property
> - LinkMapping with LinkMetaFeature set to a reference from Node_Object
> to Property
> In this case Property should not be removed on deleting a link from
> Node_Object to Property or NodeObject itself..
>
> -----------------
> Alex Shatalin
>
>
>
Re: Deletion of reference does also delete containment [message #223729 is a reply to message #223651] Tue, 31 March 2009 17:09 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

So, you have really a little bit modified use case – by default GMF generates
code supposing that all child nodes are contained in a parent node and should
be removed together with parent node.

I suppose you’ve already modified generated code a little bit to support
this situation, so I suggest you to fix this very problem – deletion of Property
nodes on deleting parent diagram node. I suggest you to modify generated
NodeItemSemanticEditPolicy.getDestroyElementCommand() and skip (comment out)
child element deletion there.

With the link (non-containment reference from Node to Property) deletion
everything should be ok – I mean I do not see a reason for removing Property
object in this situation. Can you please describe me a way you are using
to delete this link? Are you deleting it from the diagram or from properties
view?

-----------------
Alex Shatalin
Re: Deletion of reference does also delete containment [message #223805 is a reply to message #223729] Wed, 01 April 2009 07:39 Go to previous messageGo to next message
Daniel Rippel is currently offline Daniel RippelFriend
Messages: 29
Registered: July 2009
Junior Member
Hi Alex,,

thank you! Editing the SemanticItemEditPolicy prevents deletion of the
properties on node deletion.

The problem remaines when on the diagram clicking on a property in a
compartment, and pressing the DEL-Key on the keyboard. Then the original
property object is destroyed as well and all other references are
pointing to nowhere, displaying sometihing like ...Propert@d4rv2323 and
some empty boxes as title (reference to a type and memory adress where
nothing is stored anymore). It works fine using the property sheets
selection mechanism to remove properties from the list).

Is there any way to disable the deletion of properties in a compartment?
If so the user could use the property sheets mechanism do remove them.
(I'd love to leave them selectable because its the only way to edit them
by selecting in the compartment :) )

To the link: I'm not sure what exacly you mean with it I can't create a
link mapping for this reference or can I? I've tried, but Link Mappings
always require to have a class and a containment feature for the link.
Alex Shatalin schrieb:
> Hello Daniel,
>
> So, you have really a little bit modified use case – by default GMF
> generates code supposing that all child nodes are contained in a parent
> node and should be removed together with parent node.
>
> I suppose you’ve already modified generated code a little bit to support
> this situation, so I suggest you to fix this very problem – deletion of
> Property nodes on deleting parent diagram node. I suggest you to modify
> generated NodeItemSemanticEditPolicy.getDestroyElementCommand() and skip
> (comment out) child element deletion there.
>
> With the link (non-containment reference from Node to Property) deletion
> everything should be ok – I mean I do not see a reason for removing
> Property object in this situation. Can you please describe me a way you
> are using to delete this link? Are you deleting it from the diagram or
> from properties view?
>
> -----------------
> Alex Shatalin
>
>
Re: Deletion of reference does also delete containment [message #223890 is a reply to message #223805] Wed, 01 April 2009 12:16 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

> The problem remaines when on the diagram clicking on a property in a
> compartment, and pressing the DEL-Key on the keyboard. Then the
> original property object is destroyed as well and all other
> references are pointing to nowhere, displaying sometihing like
> ...Propert@d4rv2323 and some empty boxes as title (reference to a type
Try .. modifying PropertyItemSemanticEditPolicy.getDestroyElementCommand()
and write some custom code deleting the property from it's container only
in the situation then there are no other references to this property object.
:-)

> Is there any way to disable the deletion of properties in a
> compartment? If so the user could use the property sheets mechanism do
There should be a way to "decontribute" delete action from the particular
diagram element - see generated plugin.xml as a hint (we are "decontributing"
some actions there).

> To the link: I'm not sure what exacly you mean with it I can't create
> a link mapping for this reference or can I? I've tried, but Link
> Mappings always require to have a class and a containment feature for
> the link.
There are two types of links supported by GMF: Type-based and Feature-based.
First one is a diagram link associated with domain model element. This domain
model element should be contained in a link source domain model element and
point to the link destination one.
Second is just a reference drom source domain model element to the target
one.

To use second approach you should leave all teh fields blank in a link mapping
(domain element, containment feature) and specify only link feature (target
feature) and link diagram element. Using this approach you can link Node
diagram element with top-level Properties. This will be a different diagram
notation - you are representing association from Node to Property by a link
instead of visualizing corresponding properties in a Node's compartment,
but i can understand that sometimes requirements are a little bit different.

-----------------
Alex Shatalin
Previous Topic:Connecting only one Link between nodes
Next Topic:Can't drag link to superclass of the destination
Goto Forum:
  


Current Time: Thu Apr 25 06:13:14 GMT 2024

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

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

Back to the top