Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [ZEST] Disable node replacing
[ZEST] Disable node replacing [message #247459] Sat, 21 February 2009 10:14 Go to next message
Eclipse UserFriend
Originally posted by: simone.simonesaraceni.it

Hi, is it possible to disable user replacing nodes on Zest graph? How?
Re: [ZEST] Disable node replacing [message #248231 is a reply to message #247459] Fri, 10 April 2009 06:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

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
Re: [ZEST] Disable node replacing [message #248301 is a reply to message #248231] Tue, 14 April 2009 08:02 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Enabling Save function through performRequest
Next Topic:CreationTool.updateTargetRequest explanation
Goto Forum:
  


Current Time: Fri Apr 26 21:35:40 GMT 2024

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

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

Back to the top