Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [GEF4] Recreate selection handles after operation
[GEF4] Recreate selection handles after operation [message #1732853] Sat, 21 May 2016 05:48 Go to next message
Colin Sharples is currently offline Colin SharplesFriend
Messages: 96
Registered: July 2009
Location: Wellington, New Zealand
Member

I have some interaction policies that modify the geometry of a part, which will therefore affect the selection handles once the operation is completed. I need to recreate the selection handles afterwards so that they reflect the new state of the model object.

At first I got hold of the SelectionModel in my IFXOnClickPolicy, and removed and re-added the host part to the selection. However, this creates separate operations in the undo history for the action, deselect and select, so that's not good (the user would have to ctrl-Z 3 times to undo what should be a single operation).

I then saw how some of the standard transaction policies would create a composite operation including a deselect and select, so I tried that. It took me a while to work out what was going on, as it appears that the operation gets executed more than one - I had to add a check in the operation to see if it had already been executed.

I have now got it so that the transaction policy creates a single ReverseUndoCompositeOperation with my operation, a DeselectOperation and a SelectOperation. However, this still does not work, because the SelectOperation always claims to be a no-op, as I am re-selecting the same part that was initially selected. The code runs okay, but now the part loses the selection after the operation is committed.

Is there a way that I can force the SelectOperation to run, or a way to reinvoke the creation of the selection handles without going through a SelectOperation?


Colin Sharples
CTG Games Ltd
Wellington, New Zealand
Re: [GEF4] Recreate selection handles after operation [message #1732875 is a reply to message #1732853] Sat, 21 May 2016 12:09 Go to previous messageGo to next message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Colin,

to update/recompute the handles you can use
selectedPart.getAdapter(SelectionBehavior.class).updateHandles(null, null);
.

Regarding the deselect/select, there is an open bug ticket for providing a ChangeSelectionOperation [1].

Best regards,
Matthias

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=493658

[Updated on: Sat, 21 May 2016 12:17]

Report message to a moderator

Re: [GEF4] Recreate selection handles after operation [message #1732885 is a reply to message #1732875] Sun, 22 May 2016 06:01 Go to previous message
Colin Sharples is currently offline Colin SharplesFriend
Messages: 96
Registered: July 2009
Location: Wellington, New Zealand
Member

Perfect - updateHandles is what I was after. Thanks again for the help.

Colin Sharples
CTG Games Ltd
Wellington, New Zealand
Previous Topic:[GEF4] Multiple parts/visuals for the same model object
Next Topic:[GEF4] Rotation using wrong angle
Goto Forum:
  


Current Time: Wed Apr 24 16:47:31 GMT 2024

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

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

Back to the top