|  | 
|  | 
| 
| Re: [ZEST] Disable node replacing [message #248301 is a reply to message #248231] | Tue, 14 April 2009 04:02  |  | 
| Eclipse User  |  |  |  |  | Originally posted by: simone.simonesaraceni.it 
 Ian Bull ha scritto:
 > Simone wrote:
 >> Hi, is it possible to disable user replacing nodes on Zest graph? How?
 > It might be possible by overriding the GraphNode class and replacing the
 > setLocation methods, but I'm not sure if all the necessary hooks are
 > visible.  Can you try this, and file a bug, and I can investigate
 > opening the needed hooks.
 >
 > cheers,
 > ian
 Hi,
 I've solved extending the Graph class and on constructor I've changed
 the EventDispatcher:
 
 //Disable node moving
 getLightweightSystem().setEventDispatcher(new SWTEventDispatcher() {
 public void dispatchMouseMoved(org.eclipse.swt.events.MouseEvent me) {
 
 // If the current event is null, return
 if (getCurrentEvent() == null) {
 return;
 }
 if (getMouseTarget() == null) {
 setMouseTarget(getRoot());
 }
 if ((me.stateMask & SWT.BUTTON_MASK) != 0) {
 getMouseTarget().handleMouseDragged( getCurrentEvent());
 } else {
 getMouseTarget().handleMouseMoved( getCurrentEvent());
 }
 }
 });
 
 I take this code from the source code of Graph and remove the call to
 dispachMouseMoved(MouseEvent) method.
 
 I use this solution because is the simpliest that I've found.
 
 Simone.
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.05432 seconds