Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » viewShortcut and Key Bindings
viewShortcut and Key Bindings [message #323743] Mon, 07 January 2008 10:44 Go to next message
Eclipse UserFriend
Originally posted by: msoori.lggi.com

Hi,

I am showing the View menu for our RCP based application and its working
as expected, except for not being able to add in the shortcuts for our
views.

I have defined the viewShortcut in the plugin for the perspectiveExtension

<viewShortcut id="com.lggi.esp.rcp.dm.tree.TreeView"/>

and adding the item in the ApplicationActionBarAdvisor

showView = ContributionItemFactory.VIEWS_SHORTLIST.create(window);

MenuManager showViewMenu = new MenuManager("Show View");
showViewMenu.add(showView);
windowMenu.add(showViewMenu);

I was looking into how to add the shortcuts with key bindings in the faq
http://wiki.eclipse.org/FAQ_How_do_I_provide_a_keyboard_shor tcut_for_my_action%3F

<extension point="org.eclipse.ui.bindings">
<key sequence="Ctrl+7"
commandId="uk.co.example.actions.togglecomment"
chemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="uk.co.example.ampleEditorScope"/>
</extension>

I'm not sure how I can get hold of the commandId or the contextId as
they would be assigned by the ContributionItemFactory (I assume). Any
one has any suggestions as to how I can assign these key shortcuts for
the views shown in the Show View Menu?

Thanks
Mahesh
Re: viewShortcut and Key Bindings [message #323763 is a reply to message #323743] Mon, 07 January 2008 16:11 Go to previous messageGo to next message
Eclipse UserFriend
View shortcuts and key shortcuts are two different concepts.
View shortcuts are list of views that are shown in the "Show View" menu.
A key binding (key shortcut)is a key or set of keys that performs some
action.
It isn't clear if you have a problem with a view shortcut or with a key
binding.

Snjeza

Mahesh Soori wrote:
> Hi,
>
> I am showing the View menu for our RCP based application and its working
> as expected, except for not being able to add in the shortcuts for our
> views.
>
> I have defined the viewShortcut in the plugin for the perspectiveExtension
>
> <viewShortcut id="com.lggi.esp.rcp.dm.tree.TreeView"/>
>
> and adding the item in the ApplicationActionBarAdvisor
>
> showView = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
>
> MenuManager showViewMenu = new MenuManager("Show View");
> showViewMenu.add(showView);
> windowMenu.add(showViewMenu);
>
> I was looking into how to add the shortcuts with key bindings in the faq
> http://wiki.eclipse.org/FAQ_How_do_I_provide_a_keyboard_shor tcut_for_my_action%3F
>
>
> <extension point="org.eclipse.ui.bindings">
> <key sequence="Ctrl+7"
> commandId="uk.co.example.actions.togglecomment"
> chemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
> contextId="uk.co.example.ampleEditorScope"/>
> </extension>
>
> I'm not sure how I can get hold of the commandId or the contextId as
> they would be assigned by the ContributionItemFactory (I assume). Any
> one has any suggestions as to how I can assign these key shortcuts for
> the views shown in the Show View Menu?
>
> Thanks
> Mahesh
Re: viewShortcut and Key Bindings [message #323787 is a reply to message #323743] Tue, 08 January 2008 11:04 Go to previous messageGo to next message
Eclipse UserFriend
You could try creating a keybinding for the showView command, something
like:

<key
sequence="M2+M3+Q X"
contextId="org.eclipse.ui.contexts.window"
commandId="org.eclipse.ui.views.showView"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
<parameter
id="org.eclipse.ui.views.showView.viewId"
value="org.eclipse.ui.views.ProblemView" />
</key>
[/xml]

see org.eclipse.ui.ide/plugin.xml for more examples.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Re: viewShortcut and Key Bindings [message #323828 is a reply to message #323787] Wed, 09 January 2008 11:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: msoori.lggi.com

Thanks Paul. I tried that and it works partially. What I mean is by
working "partially" is that it dosent show the accelerator keys when I
pull down the menu by clicking on the Window|Show View menu. However,
if I press Alt+Shift+Q key combo, it brings up a small yellow window
listing the commands that I specified. I need it to show the
accelerator key combo in the menu, just like it shows up in Eclipse for
the Error Log or the Package Explorer views.

Thanks again for your help

Mahesh

Paul Webster wrote:
> You could try creating a keybinding for the showView command, something
> like:
>
> <key
> sequence="M2+M3+Q X"
> contextId="org.eclipse.ui.contexts.window"
> commandId="org.eclipse.ui.views.showView"
> schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
> <parameter
> id="org.eclipse.ui.views.showView.viewId"
> value="org.eclipse.ui.views.ProblemView" />
> </key>
> [/xml]
>
> see org.eclipse.ui.ide/plugin.xml for more examples.
>
> PW
>
Re: viewShortcut and Key Bindings [message #323832 is a reply to message #323763] Wed, 09 January 2008 11:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: msoori.lggi.com

Hi Snjeza,

I dont have a problem with the View Shortcuts. The Show View menu lists
all my views as expected. What I'm trying to do is to add accelerator
keys to the view shortcuts that appear in the view menu. I defined the
keys in plugin.xml as Paul suggested, and now it responds to the key
combos I assigned to the view shortcuts, but it wont show the
accelerator key combo on the menu. Instead it brings up a yellow cheat
sheet like window when I press Alt+Shift+Q containing all the acceleator
keys that I had defined for the view shortcuts. Any ideas as to how I
can get it to show the key combo next tot he menu item?

Thanks
Mahesh

Snjezana Peco wrote:
> View shortcuts and key shortcuts are two different concepts.
> View shortcuts are list of views that are shown in the "Show View" menu.
> A key binding (key shortcut)is a key or set of keys that performs some
> action.
> It isn't clear if you have a problem with a view shortcut or with a key
> binding.
>
> Snjeza
>
> Mahesh Soori wrote:
>> Hi,
>>
>> I am showing the View menu for our RCP based application and its
>> working as expected, except for not being able to add in the shortcuts
>> for our views.
>>
>> I have defined the viewShortcut in the plugin for the
>> perspectiveExtension
>>
>> <viewShortcut id="com.lggi.esp.rcp.dm.tree.TreeView"/>
>>
>> and adding the item in the ApplicationActionBarAdvisor
>>
>> showView = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
>>
>> MenuManager showViewMenu = new MenuManager("Show View");
>> showViewMenu.add(showView);
>> windowMenu.add(showViewMenu);
>>
>> I was looking into how to add the shortcuts with key bindings in the faq
>> http://wiki.eclipse.org/FAQ_How_do_I_provide_a_keyboard_shor tcut_for_my_action%3F
>>
>>
>> <extension point="org.eclipse.ui.bindings">
>> <key sequence="Ctrl+7"
>> commandId="uk.co.example.actions.togglecomment"
>> chemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
>> contextId="uk.co.example.ampleEditorScope"/>
>> </extension>
>>
>> I'm not sure how I can get hold of the commandId or the contextId as
>> they would be assigned by the ContributionItemFactory (I assume). Any
>> one has any suggestions as to how I can assign these key shortcuts for
>> the views shown in the Show View Menu?
>>
>> Thanks
>> Mahesh
Re: viewShortcut and Key Bindings [message #323836 is a reply to message #323828] Wed, 09 January 2008 12:29 Go to previous messageGo to next message
Eclipse UserFriend
Mahesh Soori wrote:
> Thanks Paul. I tried that and it works partially. What I mean is by
> working "partially" is that it dosent show the accelerator keys when I
> pull down the menu by clicking on the Window|Show View menu. However,
> if I press Alt+Shift+Q key combo, it brings up a small yellow window
> listing the commands that I specified. I need it to show the
> accelerator key combo in the menu, just like it shows up in Eclipse for
> the Error Log or the Package Explorer views.
>

AFAIK that's a bug in 3.3 that prevents keybinding lookups for
ParameterizedCommands (which is what you create with the view parameter).

It should be fixed in 3.4,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=159120

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Re: viewShortcut and Key Bindings [message #323838 is a reply to message #323836] Wed, 09 January 2008 12:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: msoori.lggi.com

Hi Paul,

Thanks for all your help. Is there a workaround for this? I see that
Eclipse IDE's Show View menu has accelerator keys defined for the Error
Log and Package Explorer. Any ideas as to how they get around this issue?

Thanks
Mahesh

Paul Webster wrote:
> Mahesh Soori wrote:
>> Thanks Paul. I tried that and it works partially. What I mean is by
>> working "partially" is that it dosent show the accelerator keys when I
>> pull down the menu by clicking on the Window|Show View menu. However,
>> if I press Alt+Shift+Q key combo, it brings up a small yellow window
>> listing the commands that I specified. I need it to show the
>> accelerator key combo in the menu, just like it shows up in Eclipse
>> for the Error Log or the Package Explorer views.
>>
>
> AFAIK that's a bug in 3.3 that prevents keybinding lookups for
> ParameterizedCommands (which is what you create with the view parameter).
>
> It should be fixed in 3.4,
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=159120
>
> PW
>
>
Re: viewShortcut and Key Bindings [message #323840 is a reply to message #323838] Wed, 09 January 2008 13:56 Go to previous messageGo to next message
Eclipse UserFriend
Mahesh Soori wrote:
> Hi Paul,
>
> Thanks for all your help. Is there a workaround for this? I see that
> Eclipse IDE's Show View menu has accelerator keys defined for the Error
> Log and Package Explorer. Any ideas as to how they get around this issue?

Those are non-extensible legacy actions with legacy commands. i.e. they
were there before the showView command, and don't use it AFAIK

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Re: viewShortcut and Key Bindings [message #323842 is a reply to message #323840] Wed, 09 January 2008 16:31 Go to previous message
Eclipse UserFriend
Originally posted by: msoori.lggi.com

Paul,

Thank you for all your help. It has been very useful. I will wait till
you guys get the new update to 3.4.

thanks again
Mahesh

Paul Webster wrote:
> Mahesh Soori wrote:
>> Hi Paul,
>>
>> Thanks for all your help. Is there a workaround for this? I see that
>> Eclipse IDE's Show View menu has accelerator keys defined for the
>> Error Log and Package Explorer. Any ideas as to how they get around
>> this issue?
>
> Those are non-extensible legacy actions with legacy commands. i.e. they
> were there before the showView command, and don't use it AFAIK
>
> PW
>
>
Previous Topic:MultipageEditorPart
Next Topic:RuleBasedScanner and getColumn()
Goto Forum:
  


Current Time: Thu Jul 17 23:53:51 EDT 2025

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

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

Back to the top