Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Key bindings: what to use instead of getKeyBindingService().registerAction(action)?
Key bindings: what to use instead of getKeyBindingService().registerAction(action)? [message #214995] Tue, 25 April 2006 15:56 Go to next message
Eclipse UserFriend
Originally posted by: p.beauvoir.bolton.ac.uk

Hi,

I'm developing a GEF Editor based on the example Flow Editor and I need
to register the Zoom Action's key binding in the Editor thus:

getSite().getKeyBindingService().registerAction(zoomIn);

This works but is deprecated. How does one achieve the same thing (i.e.
register a key binding for an action) but in a non-deprecated way?

Many thanks.

PB
Re: Key bindings: what to use instead of getKeyBindingService().registerAction(action)? [message #214999 is a reply to message #214995] Tue, 25 April 2006 17:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

Phillip Beauvoir <p.beauvoir@bolton.ac.uk> wrote:
> Hi,
>
> I'm developing a GEF Editor based on the example Flow Editor and I
> need to register the Zoom Action's key binding in the Editor thus:
>
> getSite().getKeyBindingService().registerAction(zoomIn);
>
> This works but is deprecated. How does one achieve the same thing
> (i.e. register a key binding for an action) but in a non-deprecated
> way?
> Many thanks.
>
> PB

((IHandlerService)getSite().getHandlerService()).activateHan dler(zoomIn.getActionDefinitionId(),new
ActionHandler(zoomIn));

(or something like that)

--
Sunil
Re: Key bindings: what to use instead of getKeyBindingService().registerAction(action)? [message #215004 is a reply to message #214999] Tue, 25 April 2006 17:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: p.beauvoir.bolton.ac.uk

Sunil Kamath wrote:
> Phillip Beauvoir <p.beauvoir@bolton.ac.uk> wrote:
>> Hi,
>>
>> I'm developing a GEF Editor based on the example Flow Editor and I
>> need to register the Zoom Action's key binding in the Editor thus:
>>
>> getSite().getKeyBindingService().registerAction(zoomIn);
>>
>> This works but is deprecated. How does one achieve the same thing
>> (i.e. register a key binding for an action) but in a non-deprecated
>> way?
>> Many thanks.
>>
>> PB
>
> ((IHandlerService)getSite().getHandlerService()).activateHan dler(zoomIn.getActionDefinitionId(),new
> ActionHandler(zoomIn));
>
> (or something like that)
>

Thanks very much for that, it worked!

The code I used is this:

IHandlerService service =
(IHandlerService)getEditorSite().getService(IHandlerService. class);

service.activateHandler(zoomIn.getActionDefinitionId(),
new ActionHandler(zoomIn));

service.activateHandler(zoomOut.getActionDefinitionId(),
new ActionHandler(zoomOut));

PB
Re: Key bindings: what to use instead of getKeyBindingService().registerAction(action)? [message #215008 is a reply to message #215004] Tue, 25 April 2006 17:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: p.beauvoir.bolton.ac.uk

Phillip Beauvoir wrote:
> Sunil Kamath wrote:
>> Phillip Beauvoir <p.beauvoir@bolton.ac.uk> wrote:
>>> Hi,
>>>
>>> I'm developing a GEF Editor based on the example Flow Editor and I
>>> need to register the Zoom Action's key binding in the Editor thus:
>>>
>>> getSite().getKeyBindingService().registerAction(zoomIn);
>>>
>>> This works but is deprecated. How does one achieve the same thing
>>> (i.e. register a key binding for an action) but in a non-deprecated
>>> way?
>>> Many thanks.
>>>
>>> PB
>>
>> ((IHandlerService)getSite().getHandlerService()).activateHan dler(zoomIn.getActionDefinitionId(),new
>> ActionHandler(zoomIn));
>>
>> (or something like that)
>>
>
> Thanks very much for that, it worked!
>
> The code I used is this:
>
> IHandlerService service =
> (IHandlerService)getEditorSite().getService(IHandlerService. class);
>
> service.activateHandler(zoomIn.getActionDefinitionId(),
> new ActionHandler(zoomIn));
>
> service.activateHandler(zoomOut.getActionDefinitionId(),
> new ActionHandler(zoomOut));
>
> PB


Do I have to deactiviate the handlers when the Edit part is closed?

PB
Re: Key bindings: what to use instead of getKeyBindingService().registerAction(action)? [message #215086 is a reply to message #215008] Wed, 26 April 2006 14:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

No, services that are provided by your site get disposed when the site is
disposed.

"Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> wrote in message
news:e2lmi2$tsp$1@utils.eclipse.org...
> Phillip Beauvoir wrote:
>> Sunil Kamath wrote:
>>> Phillip Beauvoir <p.beauvoir@bolton.ac.uk> wrote:
>>>> Hi,
>>>>
>>>> I'm developing a GEF Editor based on the example Flow Editor and I
>>>> need to register the Zoom Action's key binding in the Editor thus:
>>>>
>>>> getSite().getKeyBindingService().registerAction(zoomIn);
>>>>
>>>> This works but is deprecated. How does one achieve the same thing
>>>> (i.e. register a key binding for an action) but in a non-deprecated
>>>> way?
>>>> Many thanks.
>>>>
>>>> PB
>>>
>>> ((IHandlerService)getSite().getHandlerService()).activateHan dler(zoomIn.getActionDefinitionId(),new
>>> ActionHandler(zoomIn));
>>>
>>> (or something like that)
>>>
>>
>> Thanks very much for that, it worked!
>>
>> The code I used is this:
>>
>> IHandlerService service =
>> (IHandlerService)getEditorSite().getService(IHandlerService. class);
>>
>> service.activateHandler(zoomIn.getActionDefinitionId(),
>> new ActionHandler(zoomIn));
>>
>> service.activateHandler(zoomOut.getActionDefinitionId(),
>> new ActionHandler(zoomOut));
>>
>> PB
>
>
> Do I have to deactiviate the handlers when the Edit part is closed?
>
> PB
Re: Key bindings: what to use instead of getKeyBindingService().registerAction(action)? [message #215117 is a reply to message #215086] Wed, 26 April 2006 22:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: p.beauvoir.bolton.ac.uk

Randy Hudson wrote:
> No, services that are provided by your site get disposed when the site is
> disposed.
>
> "Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> wrote in message
> news:e2lmi2$tsp$1@utils.eclipse.org...
>> Phillip Beauvoir wrote:
>>> Sunil Kamath wrote:
>>>> Phillip Beauvoir <p.beauvoir@bolton.ac.uk> wrote:
>>>>> Hi,
>>>>>
>>>>> I'm developing a GEF Editor based on the example Flow Editor and I
>>>>> need to register the Zoom Action's key binding in the Editor thus:
>>>>>
>>>>> getSite().getKeyBindingService().registerAction(zoomIn);
>>>>>
>>>>> This works but is deprecated. How does one achieve the same thing
>>>>> (i.e. register a key binding for an action) but in a non-deprecated
>>>>> way?
>>>>> Many thanks.
>>>>>
>>>>> PB
>>>> ((IHandlerService)getSite().getHandlerService()).activateHan dler(zoomIn.getActionDefinitionId(),new
>>>> ActionHandler(zoomIn));
>>>>
>>>> (or something like that)
>>>>
>>> Thanks very much for that, it worked!
>>>
>>> The code I used is this:
>>>
>>> IHandlerService service =
>>> (IHandlerService)getEditorSite().getService(IHandlerService. class);
>>>
>>> service.activateHandler(zoomIn.getActionDefinitionId(),
>>> new ActionHandler(zoomIn));
>>>
>>> service.activateHandler(zoomOut.getActionDefinitionId(),
>>> new ActionHandler(zoomOut));
>>>
>>> PB
>>
>> Do I have to deactiviate the handlers when the Edit part is closed?
>>
>> PB
>
>

Thanks Randy. All is cool now :)

PB
Re: Key bindings: what to use instead of getKeyBindingService().registerAction(action)? [message #215940 is a reply to message #214995] Thu, 11 May 2006 14:43 Go to previous message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
You could do it explicitely using the KeyHandler but then you don't gain the
customization capabilities the platform provides for key bindings. I think
your general question should be directed to the platform UI newsgroup.

To do it using KeyHandler you would do something like:
getGraphicalViewer().setKeyHandler( new
YourKeyHandler(viewer).setParent(getGraphicalViewer().getKey Handler()));

where YourKeyHandler class registers the keystroke against the registered
action.

-Steve


"Phillip Beauvoir" <p.beauvoir@bolton.ac.uk> wrote in message
news:e2lgq3$e98$1@utils.eclipse.org...
> Hi,
>
> I'm developing a GEF Editor based on the example Flow Editor and I need
> to register the Zoom Action's key binding in the Editor thus:
>
> getSite().getKeyBindingService().registerAction(zoomIn);
>
> This works but is deprecated. How does one achieve the same thing (i.e.
> register a key binding for an action) but in a non-deprecated way?
>
> Many thanks.
>
> PB
>
>
Previous Topic:Synchronized GEF-Editors
Next Topic:AbstractTreeEditPart and AbstractConnectionEditPart
Goto Forum:
  


Current Time: Wed Nov 30 15:03:32 GMT 2022

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

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

Back to the top