Retrieve point of selection in Eclipse GEF

229 Views Asked by At

I have an Eclipse GEF editor (started with the Shapes example) that includes a digram edit part (extends AbstractGraphicalEditPart). I'm implementing copy n paste of objects from editor instance to editor instance.

In the paste action (which extends SelectionAction and implements ISelectionChangedListener), is it possible to determine the point of selection?

The 'paste' action is only enabled after someone clicks in an open area of the diagram figure. The paste action receives a 'selectionChanged(SelectionChangedEvent event)' callback but I can't figure out from the event.source where the user clicked....

Any clues?

1

There are 1 best solutions below

0
On

It is logical for the action to be active only when there is an active editor (after a click on it), but I don't think it is possible to get the location of the mouse click. From the event you can extract what elements of your model are selected, but not a specific location.

You could work around this by listening to your draw2d roof figure, and always storing the location of the user's last click - small overhead, but would solve the problem.