Implementing additional operations before a delete and deleting references. [message #33861] |
Wed, 30 August 2006 04:44  |
Eclipse User |
|
|
|
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. [message #35005 is a reply to message #34793] |
Wed, 30 August 2006 23:34  |
Eclipse User |
|
|
|
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 --
|
|
|
Powered by
FUDForum. Page generated in 0.03339 seconds