Skip to main content


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 11:28 Go to next message
Rob  is currently offline Rob Friend
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 10:11 Go to previous messageGo to next message
Devi Vara Prasad Bandaru is currently offline Devi Vara Prasad BandaruFriend
Messages: 100
Registered: March 2010
Location: Hyderabad
Senior 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 13:12 Go to previous message
Rob  is currently offline Rob Friend
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 Apr 25 20:26:03 GMT 2024

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

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

Back to the top