Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Complete Delete
Complete Delete [message #470956] Tue, 20 February 2007 16:56 Go to next message
John Gilbert is currently offline John GilbertFriend
Messages: 33
Registered: July 2009
Member
I have created my own uml2 editor. When I delete an element from a model
it deletes everything under it accordingly. However, there are somethings
that get orphaned:
- applied stereotypes are not unapplied
- associations are not deleted
- when deleting an associations navigable properties are not deleted from
class elements

Is there already some utility code for handling this? I have started to
write code for doing this, but it is very verbose and I thought there
might be a better way.

Thanks!
Re: Complete Delete [message #470957 is a reply to message #470956] Tue, 20 February 2007 18:07 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
John,

Element#destroy() will destroy the stereotype applications (and all
incoming/outgoing references). However, destruction of "indirectly" related
elements like associations of which navigable members end are part is
application-specific and thus something you'll need to provide your own
mechanism for...

Kenn

"John Gilbert" <jgilbert01@yahoo.com> wrote in message
news:9c3664a852dc982cd25f2652f04a0e5a$1@www.eclipse.org...
>I have created my own uml2 editor. When I delete an element from a model it
>deletes everything under it accordingly. However, there are somethings that
>get orphaned:
> - applied stereotypes are not unapplied
> - associations are not deleted
> - when deleting an associations navigable properties are not deleted from
> class elements
>
> Is there already some utility code for handling this? I have started to
> write code for doing this, but it is very verbose and I thought there
> might be a better way.
>
> Thanks!
>
Re: Complete Delete [message #470958 is a reply to message #470957] Tue, 20 February 2007 19:15 Go to previous messageGo to next message
John Gilbert is currently offline John GilbertFriend
Messages: 33
Registered: July 2009
Member
Hmmm. Even with the out of the box uml tree editor the stereotypes are not
unapplied on delete. They still show up at the bottom of the file when
opened with a text editor.

Any suggestions on a graceful way to handle the associations?
Re: Complete Delete [message #470959 is a reply to message #470958] Wed, 21 February 2007 03:53 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
John,

Are you using the 'Element > Destroy' action? It should unapply the
stereotypes as well.

With respect to the associations, and other similar semantic relationships,
you could consider using the transaction functionality provided by EMFT and
register a post-commit listener that does this kind of clean-up when
transactions are closed...

Kenn

"John Gilbert" <jgilbert01@yahoo.com> wrote in message
news:de67f9b6ba248edacd4b701f3504277e$1@www.eclipse.org...
> Hmmm. Even with the out of the box uml tree editor the stereotypes are not
> unapplied on delete. They still show up at the bottom of the file when
> opened with a text editor.
>
> Any suggestions on a graceful way to handle the associations?
>
Re: Complete Delete [message #470963 is a reply to message #470959] Wed, 21 February 2007 16:39 Go to previous messageGo to next message
John Gilbert is currently offline John GilbertFriend
Messages: 33
Registered: July 2009
Member
Yes, Element/Destroy does do more than a simple right-click delete.

I will look into the transaction listeners.

Thanks.
Re: Complete Delete [message #470964 is a reply to message #470959] Wed, 21 February 2007 20:20 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Kenn, John,

Actually, that would be a pre-commit listener :-)

Post-commit listeners are not permitted to make changes to the model (though
they may read; they are invoked within read-only transactions).

Pre-commit listeners provide commands that will be executed before the
transaction commit completes. This is important, because these changes
also need to be validated by the transaction, and if necessary rolled back.

Cheers,

Christian


Kenn Hussey wrote:

> John,
>
> Are you using the 'Element > Destroy' action? It should unapply the
> stereotypes as well.
>
> With respect to the associations, and other similar semantic
> relationships, you could consider using the transaction functionality
> provided by EMFT and register a post-commit listener that does this kind
> of clean-up when transactions are closed...
>

<snip>
Re: Complete Delete [message #588947 is a reply to message #470956] Tue, 20 February 2007 18:07 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
John,

Element#destroy() will destroy the stereotype applications (and all
incoming/outgoing references). However, destruction of "indirectly" related
elements like associations of which navigable members end are part is
application-specific and thus something you'll need to provide your own
mechanism for...

Kenn

"John Gilbert" <jgilbert01@yahoo.com> wrote in message
news:9c3664a852dc982cd25f2652f04a0e5a$1@www.eclipse.org...
>I have created my own uml2 editor. When I delete an element from a model it
>deletes everything under it accordingly. However, there are somethings that
>get orphaned:
> - applied stereotypes are not unapplied
> - associations are not deleted
> - when deleting an associations navigable properties are not deleted from
> class elements
>
> Is there already some utility code for handling this? I have started to
> write code for doing this, but it is very verbose and I thought there
> might be a better way.
>
> Thanks!
>
Re: Complete Delete [message #588959 is a reply to message #470957] Tue, 20 February 2007 19:15 Go to previous message
John Gilbert is currently offline John GilbertFriend
Messages: 33
Registered: July 2009
Member
Hmmm. Even with the out of the box uml tree editor the stereotypes are not
unapplied on delete. They still show up at the bottom of the file when
opened with a text editor.

Any suggestions on a graceful way to handle the associations?
Re: Complete Delete [message #588971 is a reply to message #470958] Wed, 21 February 2007 03:53 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
John,

Are you using the 'Element > Destroy' action? It should unapply the
stereotypes as well.

With respect to the associations, and other similar semantic relationships,
you could consider using the transaction functionality provided by EMFT and
register a post-commit listener that does this kind of clean-up when
transactions are closed...

Kenn

"John Gilbert" <jgilbert01@yahoo.com> wrote in message
news:de67f9b6ba248edacd4b701f3504277e$1@www.eclipse.org...
> Hmmm. Even with the out of the box uml tree editor the stereotypes are not
> unapplied on delete. They still show up at the bottom of the file when
> opened with a text editor.
>
> Any suggestions on a graceful way to handle the associations?
>
Re: Complete Delete [message #589033 is a reply to message #470959] Wed, 21 February 2007 16:39 Go to previous message
John Gilbert is currently offline John GilbertFriend
Messages: 33
Registered: July 2009
Member
Yes, Element/Destroy does do more than a simple right-click delete.

I will look into the transaction listeners.

Thanks.
Re: Complete Delete [message #589052 is a reply to message #470959] Wed, 21 February 2007 20:20 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Kenn, John,

Actually, that would be a pre-commit listener :-)

Post-commit listeners are not permitted to make changes to the model (though
they may read; they are invoked within read-only transactions).

Pre-commit listeners provide commands that will be executed before the
transaction commit completes. This is important, because these changes
also need to be validated by the transaction, and if necessary rolled back.

Cheers,

Christian


Kenn Hussey wrote:

> John,
>
> Are you using the 'Element > Destroy' action? It should unapply the
> stereotypes as well.
>
> With respect to the associations, and other similar semantic
> relationships, you could consider using the transaction functionality
> provided by EMFT and register a post-commit listener that does this kind
> of clean-up when transactions are closed...
>

<snip>
Previous Topic:Inputs to StructuredActivityNode
Next Topic:GettingStartedWithUML source code
Goto Forum:
  


Current Time: Sun Mar 29 19:54:02 GMT 2020

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

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

Back to the top