Skip to main content



      Home
Home » Eclipse Projects » GEF » Create general handler for creating/deleting parts
Create general handler for creating/deleting parts [message #1802903] Mon, 18 February 2019 13:42 Go to next message
Eclipse UserFriend
I'm wondering how to make a global Handler (not an IOnClickHandler !! ).

And why do I need a handler extending AbstractHandler for this? When 3 events happen I need to create/delete some parts and as far as I can see the init() and commit() functions are part of the AbstractHandler.

Am I looking at this in the wrong way and do I need an operation instead of a handler? Any feedback is deeply appreciated

[Updated on: Mon, 18 February 2019 13:42] by Moderator

Re: Create general handler for creating/deleting parts [message #1802908 is a reply to message #1802903] Mon, 18 February 2019 14:48 Go to previous messageGo to next message
Eclipse UserFriend
Hi Joao,

a handler may implement any number of interfaces. Hence, you can react to all gestures using just a single handler. Note that an open transaction is only closed when all active gestures are finished, though.

Furthermore, a handler implementation does not need to extend AbstractHandler. That is just convenience (e.g. init(), commit() methods that you already use).

Each policy provides init() and commit() methods that can be used to initialise and commit a policy, respectively. This can also be seen from the AbstractHandler implementation.

Best regards,
Matthias
Re: Create general handler for creating/deleting parts [message #1802988 is a reply to message #1802908] Wed, 20 February 2019 05:22 Go to previous messageGo to next message
Eclipse UserFriend
Ok understood!

Just one question though. If I do creationPolict.init() and creationPolicy.commit() instead of init(creationPolicy) and commit(creationPolicy) (methods inherited from AbstractHandler) I can't undo the newly create operation. Can you explain why and how to I work around this?

Thanls

[Updated on: Wed, 20 February 2019 05:22] by Moderator

Re: Create general handler for creating/deleting parts [message #1802989 is a reply to message #1802988] Wed, 20 February 2019 05:44 Go to previous messageGo to next message
Eclipse UserFriend
I can answer my own doubt :P

Looking at the AbstractHandler.commit and init I found out that I was missing some stuff in order to create an ITransactionalOperation.
Re: Create general handler for creating/deleting parts [message #1803080 is a reply to message #1802989] Thu, 21 February 2019 16:38 Go to previous message
Eclipse UserFriend
Ah yes, that is an important detail, indeed!

Thank you for pointing it out.

[Updated on: Thu, 21 February 2019 16:39] by Moderator

Previous Topic:How to correctly delete Part
Next Topic:Bug In GEF MVC Tutorial
Goto Forum:
  


Current Time: Mon Apr 28 13:09:27 EDT 2025

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

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

Back to the top