DiagramEditor mouse over [message #902982] |
Tue, 21 August 2012 09:59  |
Eclipse User |
|
|
|
There is a way to have a mouselistener, to know when mouse is over the diagram ,or over some specific element?
I can't find a way to know if mouse is outside editor, or otherwise a way to know when creation has been cancelled
Thanks
|
|
|
|
|
Re: DiagramEditor mouse over [message #1092071 is a reply to message #902982] |
Thu, 22 August 2013 05:40   |
Eclipse User |
|
|
|
Hi there,
I unearth this topic because I need this functionality too.
More exactly, I understand the way of a MouseTrackListener applied on the control of the graphical viewer can notify when the mouse is over the diagram, but not on a specific element.
How to get this information ?
Apparently, it is not possible with the MouseTrackListener. I'm thinking of adding a MouseMoveListener of the graphicalViewer's control and then, thanks to the location of the mouse, retrieve the Graphiti pictogram element (I'm not sure, but I think there exists a method for this), and provide my own implementation to verify whether the notification refers to an over or an exit notification and what pictogram element is concerned.
Does a such implementation already exist ?
Thanks for you advice,
Regards,
--
Nicolas
|
|
|
Re: DiagramEditor mouse over [message #1092865 is a reply to message #1092071] |
Fri, 23 August 2013 05:12  |
Eclipse User |
|
|
|
Hi again,
My solution works:
final Diagram diagram; // initialization of the Diagram Object.
graphitiEditor.getGraphicalViewer().getControl().addMouseMoveListener(new MouseMoveListener() {
@Override
public void mouseMove(MouseEvent e) {
ILocationInfo info = Graphiti.getPeService().getLocationInfo(diagram, e.x, e.y);
Shape shape = info.getShape();
Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(shape);
}
This code does its job, and I can implement hover / exit verifications, but I'm not sure I'm not using a sledge-hammer to crack a nut. Would anybody have feedbacks about this or other solutions ?
Thanks,
Regards,
--
Nicolas
|
|
|
Powered by
FUDForum. Page generated in 0.04136 seconds