Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [GEF4] Selection handles for different actions
[GEF4] Selection handles for different actions [message #1732753] Thu, 19 May 2016 21:42 Go to next message
Colin Sharples is currently offline Colin SharplesFriend
Messages: 96
Registered: July 2009
Location: Wellington, New Zealand
Member

For some of my parts, I would like to be able to generate a different set of selection handles depending on the action the user wants to perform.

For example, I have a part that manages a GeometricNode<Polyline>. The default action is to manipulate the shape of the line, so the selection handle factory creates handles to move each line segment and to create new segments. That's all working fine.

Now I want to add an action that lets the user split the line into two at one of the bendpoints in the line, so I want a different set of selection handles, only on the bendpoints, that will indicate which bendpoint is to be used to split the line. Triggering that mode would be either by a gesture (e.g. ctrl+click) or from a context menu button.

Looking at FXDefaultSelectionHandlePartFactory, I can't see any way that I can indicate what mode it should create handles for - it only accepts a SelectionBehavior, and as far as I can see the contextMap is always hardcoded as an empty map. Does that mean I need to create a different type of handle part factory, and invoke that from a custom policy? I'd like something reasonably generic, as I have several different scenarios that have a similar mechanism.


Colin Sharples
CTG Games Ltd
Wellington, New Zealand
Re: [GEF4] Selection handles for different actions [message #1732781 is a reply to message #1732753] Fri, 20 May 2016 08:14 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Colin,

I would use a viewer model to store the handle mode, e.g. HandleModeModel. Then, you can subclass SelectionBehavior and add listeners to the HandleModeModel so that the selection handles are updated when the handle mode changes. The handle mode can be put into the context map so that it is available within the handle part factory.

Best regards,
Matthias
Previous Topic:[GEF4] Menu bar on right click
Next Topic:[GEF4] Multiple parts/visuals for the same model object
Goto Forum:
  


Current Time: Fri Apr 19 17:10:35 GMT 2024

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

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

Back to the top