Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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
Rob  is currently offline Rob
Messages: 3
Registered: July 2009
Junior Member
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
Devi Vara Prasad Bandaru is currently offline Devi Vara Prasad Bandaru
Messages: 98
Registered: March 2010
Location: Hyderabad
Member

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
Rob  is currently offline Rob
Messages: 3
Registered: July 2009
Junior Member
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: Thu Jul 31 21:53:30 EDT 2014

Powered by FUDForum. Page generated in 0.10086 seconds