Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Keep palette tool selected when shift is pressed
Keep palette tool selected when shift is pressed [message #247881] Tue, 24 March 2009 16:30 Go to next message
Matthew Dickie is currently offline Matthew DickieFriend
Messages: 56
Registered: July 2009
Member
I have used GEF to write a form editor for our language, where the
palette contains a tool for creating each kind of widget (textfield,
button, etc.). By default the selected tool becomes deselected when it
is used, i.e. when a widget is created on the form. However, I have a
feature request for the selected tool to stay selected after use if it
was selected with the Shift key pressed. Is it possible to achieve this?

I have found the unloadWhenFinished() method which controls this
behaviour and managed to make it so that tools stay selected. However,
the problem is in detecting whether shift is pressed when the tool is
selected. The SWT mouse event does not give this information. Can anyone
help?

I suppose this is an SWT question as much as a GEF question, so perhaps
I will ask on the SWT newsgroup too.
Re: Keep palette tool selected when shift is pressed [message #247928 is a reply to message #247881] Sun, 29 March 2009 03:06 Go to previous messageGo to next message
Ben Vitale is currently offline Ben VitaleFriend
Messages: 247
Registered: July 2009
Senior Member
1] Subclass the appropriate Tool
2] Extend activate(), capture getCurrentInput().isShiftKeyDown() as your
own flag
3] Override unloadWhenFinished() to do the right thing

Seems like it would work? Perhaps I am missing something.

Cheers
Ben

Matt Dickie wrote:
> I have used GEF to write a form editor for our language, where the
> palette contains a tool for creating each kind of widget (textfield,
> button, etc.). By default the selected tool becomes deselected when it
> is used, i.e. when a widget is created on the form. However, I have a
> feature request for the selected tool to stay selected after use if it
> was selected with the Shift key pressed. Is it possible to achieve this?
>
> I have found the unloadWhenFinished() method which controls this
> behaviour and managed to make it so that tools stay selected. However,
> the problem is in detecting whether shift is pressed when the tool is
> selected. The SWT mouse event does not give this information. Can anyone
> help?
>
> I suppose this is an SWT question as much as a GEF question, so perhaps
> I will ask on the SWT newsgroup too.
Re: Keep palette tool selected when shift is pressed [message #248001 is a reply to message #247928] Tue, 31 March 2009 17:15 Go to previous message
Matthew Dickie is currently offline Matthew DickieFriend
Messages: 56
Registered: July 2009
Member
> 1] Subclass the appropriate Tool
> 2] Extend activate(), capture getCurrentInput().isShiftKeyDown() as your
> own flag
> 3] Override unloadWhenFinished() to do the right thing
>
> Seems like it would work? Perhaps I am missing something.

Thanks Ben,

I overlooked the getCurrentInput() method, and did it the hard way by
overriding a couple of classes so I could get to the original
MouseEvent. I shall rewrite it now to do it the easy way.
Previous Topic:Regarding org.eclipse.ui.views.properties.PropertySheet
Next Topic:Unable to drag shapes
Goto Forum:
  


Current Time: Wed Apr 24 20:12:39 GMT 2024

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

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

Back to the top