Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » DiagramEditor mouse over
DiagramEditor mouse over [message #902982] Tue, 21 August 2012 13:59 Go to next message
Rui Domingues is currently offline Rui Domingues
Messages: 191
Registered: October 2010
Senior Member
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 #903705 is a reply to message #902982] Wed, 22 August 2012 07:26 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1592
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Rui,

diagramEditor.getGraphicalViewer().getControl().addMouseTrackListener should
be the hook you are looking for.

Michael
Re: DiagramEditor mouse over [message #903959 is a reply to message #903705] Mon, 27 August 2012 12:52 Go to previous messageGo to next message
Rui Domingues is currently offline Rui Domingues
Messages: 191
Registered: October 2010
Senior Member
Very Happy

Thanks a lot. It's exactly that.

Thanks sincerely
Rui
Re: DiagramEditor mouse over [message #1092071 is a reply to message #902982] Thu, 22 August 2013 09:40 Go to previous messageGo to next message
nicolas h is currently offline nicolas h
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
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 09:12 Go to previous message
nicolas h is currently offline nicolas h
Messages: 60
Registered: February 2011
Location: Grenoble, France
Member
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
Previous Topic:CustomContext in negative coordinate space
Next Topic:DiagramEditor refresh behaviour
Goto Forum:
  


Current Time: Tue Sep 16 23:48:32 GMT 2014

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

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