Skip to main content



      Home
Home » Eclipse Projects » GEF » [GEF4] Recreate selection handles after operation
[GEF4] Recreate selection handles after operation [message #1732853] Sat, 21 May 2016 01:48 Go to next message
Eclipse UserFriend
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?
Re: [GEF4] Recreate selection handles after operation [message #1732875 is a reply to message #1732853] Sat, 21 May 2016 08:09 Go to previous messageGo to next message
Eclipse UserFriend
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 08:17] by Moderator

Re: [GEF4] Recreate selection handles after operation [message #1732885 is a reply to message #1732875] Sun, 22 May 2016 02:01 Go to previous message
Eclipse UserFriend
Perfect - updateHandles is what I was after. Thanks again for the help.
Previous Topic:[GEF4] Multiple parts/visuals for the same model object
Next Topic:[GEF4] Rotation using wrong angle
Goto Forum:
  


Current Time: Wed Jul 23 16:04:06 EDT 2025

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

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

Back to the top