Keep palette tool selected when shift is pressed [message #247881] |
Tue, 24 March 2009 12:30  |
Eclipse User |
|
|
|
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 13:15  |
Eclipse User |
|
|
|
> 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.
|
|
|
Powered by
FUDForum. Page generated in 0.23680 seconds