Skip to main content



      Home
Home » Eclipse Projects » GEF » Keep creation tool from palette active when modifier key is pressed
Keep creation tool from palette active when modifier key is pressed [message #641959] Mon, 29 November 2010 06:28 Go to next message
Eclipse UserFriend
Hello,

I have a palette implemented in my graphical editor.
When the palette entry is clicked and the creation is performed in the editor, the creation entry is unloaded again.
I would like to allow the user to create multiple items by holding a modifier key (control) without going back to the palette each time.

I see how to do this always (setUnloadWhenFinished(false) in the CreationTool), but I would like to have the tool unload by default and only stay active when the modifier key is down.

Anyone know how to achieve that?

Thanks in advance,

Rob
Re: Keep creation tool from palette active when modifier key is pressed [message #642429 is a reply to message #641959] Wed, 01 December 2010 05:11 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
Try this create a custom creation tool as below and set the tool class while creating palette entries using this method org.eclipse.gef.palette.ToolEntry.setToolClass(CustomCreatio nTool.class)


public class CustomCreationTool extends CreationTool {

	@Override
	protected void handleFinished() {
		if (unloadWhenFinished() && !getCurrentInput().isModKeyDown(SWT.MOD1))
			getDomain().loadDefaultTool();
		else
			reactivate();
	}
	
}
Re: Keep creation tool from palette active when modifier key is pressed [message #642943 is a reply to message #642429] Fri, 03 December 2010 08:12 Go to previous message
Eclipse UserFriend
Prasad,

This works like a charm.
Thanks!

Rob
Previous Topic:Need help syncing scrollbar and figurecanvas
Next Topic:[Zest] Custom drawn connections or anchor labels
Goto Forum:
  


Current Time: Sat Apr 26 21:11:33 EDT 2025

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

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

Back to the top