Problems in deleting pictogram elements and model elements [message #665781] |
Fri, 15 April 2011 21:08 |
Daniele Messages: 45 Registered: August 2010 |
Member |
|
|
Hi guys, I have some problems for deleting graphic elements and associated model elements, and I hope you can help me out.
Given that:
1) Pictogram Element (PE) --> a graphic shape on the diagram
2) Pictogram Link (PL) --> a graphic link on the diagram
3) Model Element (ME) --> a model element stored in the model domain
4) Model Link (ML) --> a model link stored in the model domain
And:
5) (PE= "Shape-A", ME= "Element-A") --> the shape "Shape-A" is associated with the model element "Element-A"
6) (PE= "Shape-B", ME= "Element-B") --> the shape "Shape-B" is associated with the model element "Element-B"
7) (PL= "Graphic link between shapes A-and-B", ML= "Link between elements A-and-B") --> the graphic link "Graphic link between shapes A-and-B" is associated with the model link "Link between elements A-and-B"
8) I delete from the diagram PE= "Shape-B"
Now, the Graphiti behavior is to:
1) delete the graphic shape PE= "Shape-B" from the diagram
2) delete the model element ME= "Element-B" from the domain model
3) delete the graphic link PL= "Graphic link between shapes A-and-B" from the diagram
4) DO NOT DELETE the model link ML= "Link between elements A-and-B") from the domain model BUT ONLY DELETE the attribute in the ML which points to the ME= "Element-B"
what I want:
That not ONLY the PL= "Graphic link between shapes A-and-B" is deleted from the diagram BUT also the corresponding ML= "Link between elements A-and-B"
I found a similar behavior in the Graphiti tutorial, in fact:
1) you can create an EClass "A"
2) you can create an EClass "B"
3) you can create an EReference "Link" between "A" and "B"
Now, if you delete the EClass "B", the graphical representation of the EReference "Link" and the EClass "B" are deleted as well as the model element EClass "B". What is not deleted is the attribute in the EClass "A" which contains the value that was pointing to the deleted EClass "B".
My questions:
Should I create my own DefaulDeleteFeature? Is this a bug? Is this the intended behavior?
Thank you very much for your consideration and for the great work you guys are doing.
Daniele
[Updated on: Fri, 15 April 2011 21:12] Report message to a moderator
|
|
|
Re: Problems in deleting pictogram elements and model elements [message #666124 is a reply to message #665781] |
Tue, 19 April 2011 08:26 |
Michael Wenz Messages: 1931 Registered: July 2009 Location: Walldorf, Germany |
Senior Member |
|
|
Daniele,
I was able to reproduce what you describe for the tutorial. Graphiti uses
the EcoreUtil.delete method to delete the domain object linked to ECLass B.
This method also processes all references to the deleted object. In this
case it removes the reference to the EClass B from the EReference object
Link in EClass A, but not the EReference object itself. You can check that
by saving the diagram resource and opening it in a text editor.
This is standard EMF behavior, but it can be changed by providing a specific
delete feature for your case.
Michael
"Daniele" wrote in message news:ioablf$259$1@news.eclipse.org...
Hi guys, I have some problems for deleting graphic elements and associated
model elements, and I hope you can help me out.
Given that:
1) Pictogram Element (PE) --> a graphic shape on the diagram
2) Pictogram Link (PL) --> a graphic link on the diagram
3) Model Element (ME) --> a model element stored in the model domain
4) Model Link (ML) --> a model link stored in the model domain
And:
5) (PE= "Shape-A", ME= "Element-A") --> the shape "Shape-A" is associated
with the model element "Element-A"
6) (PE= "Shape-B", ME= "Element-B") --> the shape "Shape-B" is associated
with the model element "Element-B"
7) (PL= "Graphic link between shapes A-and-B", ML= "Link between elements
A-and-B") --> the graphic link "Graphic link between shapes A-and-B" is
associated with the model link "Link between elements A-and-B"
8) I delete from the diagram PE= "Shape-B"
Now, the Graphiti behavior is to:
1) delete the graphic shape PE= "Shape-B" from the diagram
2) delete the model element ME= "Element-B" from the domain model
3) delete the graphic link PL= "Graphic link between shapes A-and-B" from
the diagram
DO NOT DELETE the model link ML= "Link between elements A-and-B") from the
domain model BUT ONLY DELETE the attribute in the ML which points to the ME=
"Element-B"
what I want:
That not ONLY the PL= "Graphic link between shapes A-and-B" is delete from
the diagram BUT also the corresponding ML= "Link between elements A-and-B"
I found a similar behavior in the Graphiti tutorial, in fact:
1) you can create an EClass "A"
2) you can create an EClass "B"
3) you can create an EReference "Link" between "A" and "B"
Now, if you delete the EClass "B", the graphical representation of the
EReference "Link" and the EClass "B" are deleted as well as the model
element EClass "B". What is not deleted is the attribute in the EClass B
which contains the value that was pointing to the deleted EClass "B".
My questions:
Should I create my own DefaulDeleteFeature? Is this a bug? Is this the
intended behavior?
Thank you very much for your consideration and for the great work you guys
are doing.
Daniele
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03582 seconds