Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Problems in deleting pictogram elements and model elements
Problems in deleting pictogram elements and model elements [message #665781] Fri, 15 April 2011 21:08 Go to next message
Daniele is currently offline DanieleFriend
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 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
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
Re: Problems in deleting pictogram elements and model elements [message #667090 is a reply to message #666124] Tue, 26 April 2011 16:51 Go to previous messageGo to next message
Daniele is currently offline DanieleFriend
Messages: 45
Registered: August 2010
Member
Thank you Michael (and sorry for the delay in my answer)!

I will try to do that. If I have understood well I need to create my own Default Delete Feature.

Thanks
D.

UPDATES ---->
see http://www.eclipse.org/forums/index.php?t=msg&goto=66711 0&S=e5076500deb344fa440d19b9942c0af7#msg_667110 for the solution I adopted. Thanks

[Updated on: Tue, 26 April 2011 19:10]

Report message to a moderator

Re: Problems in deleting pictogram elements and model elements [message #667175 is a reply to message #667090] Wed, 27 April 2011 08:37 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Yes, you need to create your own delete feature deriving from
DefaultDeleteFeature and register this at your feature provider.

Michael

"Daniele" wrote in message news:ip6snr$i51$1@news.eclipse.org...

Thank you Michael (and sorry for the delay in my answer)!

I will try to do that. If I have understood well I need to create my own
Default Delete Feature.

Thanks
D.
Previous Topic:delete with deletion of connections to nested shapes
Next Topic:Notification of reconnection "abort"
Goto Forum:
  


Current Time: Sat Apr 20 02:56:20 GMT 2024

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

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

Back to the top