Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Implementing additional operations before a delete and deleting references.
Implementing additional operations before a delete and deleting references. [message #33861] Wed, 30 August 2006 04:44 Go to next message
Eclipse UserFriend
Originally posted by: khai.n.situvista.com

I need to prompt the user before deleting a certain element and cancel
the delete operation if the user desires. It has been suggested that
this be handled by implementing:

XXXEditHelperAdvice.getBeforeDestroyElementCommand()

Additionally I need to do some cleaning up of dangling relationships
by implementing

XXXEditHelper.getDestroyDependentsCommand():


I have implemented these two methods but they are never called when I
delete an element using the "Delete from Model" menu item (my delete key
binding is not working so I can't test that... but that's a whole
different can of worm:-P)


The plugin.xml contribution for
org.eclipse.gmf.runtime.emf.type.core.elementTypes is what was
generated.


What must I do to ensure that these are called?

Or where should I put a break point to check why they are not being called?

Thank you for any hints:-)

-- Khai --
Re: Implementing additional operations before a delete and deleting references. (resolved) [message #34487 is a reply to message #33861] Wed, 30 August 2006 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khai.n.situvista.com

Oops! I feel silly now... the methods were implemented in the wrong
level of containment; I had implemented them for the element being
deleted but it should have been in the container of the element being
deleted.

Just confused myself a bit there.

-- Khai --



Khai M Nguyen wrote:
> I need to prompt the user before deleting a certain element and cancel
> the delete operation if the user desires. It has been suggested that
> this be handled by implementing:
>
> XXXEditHelperAdvice.getBeforeDestroyElementCommand()
>
> Additionally I need to do some cleaning up of dangling relationships
> by implementing
>
> XXXEditHelper.getDestroyDependentsCommand():
>
>
> I have implemented these two methods but they are never called when I
> delete an element using the "Delete from Model" menu item (my delete key
> binding is not working so I can't test that... but that's a whole
> different can of worm:-P)
>
>
> The plugin.xml contribution for
> org.eclipse.gmf.runtime.emf.type.core.elementTypes is what was
> generated.
>
>
> What must I do to ensure that these are called?
>
> Or where should I put a break point to check why they are not being called?
>
> Thank you for any hints:-)
>
> -- Khai --
Re: Implementing additional operations before a delete and deleting references. [message #34793 is a reply to message #33861] Wed, 30 August 2006 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Hello Khai,

One thing to keep in mind is that the generated
xxxBaseEditHelper#getDestroyElementCommand overrides the template method
in AbstractEditHelper so that the request for dependents is never made.
You could try removing the override method.

Another thing to note is that the
XXXEditHelperAdvice.getBeforeDestroyElementCommand() will be consulted
on the type of the _container_ of the element being destroyed. So you
have to make sure that your advice is bound to the container's element type.

Hope that helps,
Linda



Khai M Nguyen wrote:
> I need to prompt the user before deleting a certain element and cancel
> the delete operation if the user desires. It has been suggested that
> this be handled by implementing:
>
> XXXEditHelperAdvice.getBeforeDestroyElementCommand()
>
> Additionally I need to do some cleaning up of dangling relationships
> by implementing
>
> XXXEditHelper.getDestroyDependentsCommand():
>
>
> I have implemented these two methods but they are never called when I
> delete an element using the "Delete from Model" menu item (my delete key
> binding is not working so I can't test that... but that's a whole
> different can of worm:-P)
>
>
> The plugin.xml contribution for
> org.eclipse.gmf.runtime.emf.type.core.elementTypes is what was
> generated.
>
>
> What must I do to ensure that these are called?
>
> Or where should I put a break point to check why they are not being called?
>
> Thank you for any hints:-)
>
> -- Khai --
Re: Implementing additional operations before a delete and deleting references. [message #35005 is a reply to message #34793] Wed, 30 August 2006 23:34 Go to previous message
Eclipse UserFriend
Originally posted by: khai.n.situvista.com

Thanks, Linda.

I did notice the generated helper overriding the AbstractEditHelper
and was going to post a question about removing the override but
you've just answered that:-)

BTW, why is it overridden by default?

Another theme that I'm not too clear on is how ItemSemanticEditPolicies
and EditHelpers fit together because they both have similar
getDestroyElementCommand() and others. Can you shed some light on how
they relate to each other?


I'm curious why the EditHelperAdvice for the canvas root element is not
automatically generated. This seems to be a common place for any
diagram to override getBeforeDestroyElementCommand() and such.

It took me a while to figure out how to even contribute an Advice that
is not a specialization type; and that's by stumbling into an answer you
gave to a different topic(thanks for that answer too:-)).


Lastly, if I have a model where an element X(the one being deleted)
can be contained by any elements A, B, C, D, etc... would I have to
implement getBeforeDestroyElementCommand() in each of A, B, C, D,
etc...EditHelperAdvice? Or is there a more elegant solution that
I'm overlooking?


Thanks Again!!!

-- Khai --



Linda Damus wrote:
> Hello Khai,
>
> One thing to keep in mind is that the generated
> xxxBaseEditHelper#getDestroyElementCommand overrides the template method
> in AbstractEditHelper so that the request for dependents is never made.
> You could try removing the override method.
>
> Another thing to note is that the
> XXXEditHelperAdvice.getBeforeDestroyElementCommand() will be consulted
> on the type of the _container_ of the element being destroyed. So you
> have to make sure that your advice is bound to the container's element
> type.
>
> Hope that helps,
> Linda
>
>
>
> Khai M Nguyen wrote:
>> I need to prompt the user before deleting a certain element and cancel
>> the delete operation if the user desires. It has been suggested that
>> this be handled by implementing:
>>
>> XXXEditHelperAdvice.getBeforeDestroyElementCommand()
>>
>> Additionally I need to do some cleaning up of dangling relationships
>> by implementing
>>
>> XXXEditHelper.getDestroyDependentsCommand():
>>
>>
>> I have implemented these two methods but they are never called when I
>> delete an element using the "Delete from Model" menu item (my delete key
>> binding is not working so I can't test that... but that's a whole
>> different can of worm:-P)
>>
>>
>> The plugin.xml contribution for
>> org.eclipse.gmf.runtime.emf.type.core.elementTypes is what was
>> generated.
>>
>>
>> What must I do to ensure that these are called?
>>
>> Or where should I put a break point to check why they are not being
>> called?
>>
>> Thank you for any hints:-)
>>
>> -- Khai --
Previous Topic:OCL constrains
Next Topic:Getting eContainer in OCL expression
Goto Forum:
  


Current Time: Sat Jul 12 17:28:16 EDT 2025

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

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

Back to the top