Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 18:42 Go to next message
João Pedro is currently offline João PedroFriend
Messages: 52
Registered: December 2014
Member
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 18:42]

Report message to a moderator

Re: Create general handler for creating/deleting parts [message #1802908 is a reply to message #1802903] Mon, 18 February 2019 19:48 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
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 10:22 Go to previous messageGo to next message
João Pedro is currently offline João PedroFriend
Messages: 52
Registered: December 2014
Member
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 10:22]

Report message to a moderator

Re: Create general handler for creating/deleting parts [message #1802989 is a reply to message #1802988] Wed, 20 February 2019 10:44 Go to previous messageGo to next message
João Pedro is currently offline João PedroFriend
Messages: 52
Registered: December 2014
Member
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 21:38 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Ah yes, that is an important detail, indeed!

Thank you for pointing it out.

[Updated on: Thu, 21 February 2019 21:39]

Report message to a moderator

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


Current Time: Tue Sep 27 02:51:43 GMT 2022

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

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

Back to the top