Bug 79162 - [Contributions] interactions: Key bindings for static menus
Summary: [Contributions] interactions: Key bindings for static menus
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-22 04:39 EST by Dani Megert CLA
Modified: 2019-09-06 15:36 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2004-11-22 04:39:07 EST
I200411230800

I'm asking for a hook so that I can modify the sub menu label of the global
(Search >) Occurrences in File sub menu.

Background:
We started to add quick menus e.g. for Source, Refactoring and now Occurrences
in File (Ctrl+Shift+U). I was able to add the key sequence to the sub menu label
in the context menu but found no way to achieve this for the global Search >
Occurrences in File sub menu entry.

Note: There's already a key binding being shown for a global sub-menu:
File > New     Alt+Shift+N
Dirk told me that this is currently hard coded somewhere in Platform UI code.
Comment 1 Douglas Pollock CLA 2004-11-22 11:53:21 EST
I'm confused, as I don't see a sub-menu for "Occurrences in File" ("Search > 
Occurrences in File") in the global menu.  I only see a menu item.  Then you go 
on to mention a context menu.  Which do you mean?  Is this meant to become a 
menu?  Is the menu supposed to be dynamic? 
 
If it is a dynamic menu, then this should be relatively easy.  You can just 
take a snippet from the Debug UI's plug-in and add a definitionId: 
 
         <action 
               label="%RunWithConfigurationAction.label" 
               pulldown="true" 
               helpContextId="run_with_configuration_action_context" 
               class="org.eclipse.debug.internal.ui.actions.RunAsAction" 
               definitionId="org.eclipse.ui.file.refresh" 
               menubarPath="org.eclipse.ui.run/runGroup" 
               id="org.eclipse.debug.internal.ui.actions.RunWithConfigurationAction"> 
         </action> 
 
The definition id should point to the command that will have the key binding, 
and will open the quick menu. 
 
If you the menu is purely static, then it won't work.  You're left with the 
(rather icky) option of changing it to be a dynamic menu that always has the 
same entries.  :(  This also has the negative side effect of causing early 
plug-in loading.  :( :( 
 
 
We are looking to overhaul contributions, and I will try to consider this as 
part of that work.  Please see Bug 36968 and Bug 45879. 
 
Comment 2 Dani Megert CLA 2004-11-22 11:58:12 EST
>I'm confused, as I don't see a sub-menu for "Occurrences in File" ("Search > 
>Occurrences in File") in the global menu.
See comment 0: build id: I200411230800 ;-)
Alternatively you can take JDT UI from HEAD or latest N-build.

The only thing which is not working is displaying the shortcut for the sub menu
in the global menu.
Comment 3 Douglas Pollock CLA 2004-11-22 12:01:48 EST
Heh.  I missed that, but as of yet I can't travel in time.  So, I'll just grab 
JDT UI. 
Comment 4 Douglas Pollock CLA 2004-11-22 13:45:17 EST
Yeah, my comment still stands.  Static menu, so you should probably just wait 
for the new contributions stuff. 
 
How does the refactor quick menu work get its key binding then? 
 
Comment 5 Dani Megert CLA 2004-11-23 03:12:51 EST
>How does the refactor quick menu work get its key binding then? 
The key sequence is shown (and the key binding works) for my quick menus in
context menus, this PR is about showing the key sequence in my quick menu in the
global menu bar. The Refactor and Source menus are top-level in the global menu
bar and it would look strange to show the key sequence there wouldn't it? Hence
I don't quite understand your question.
Comment 6 Douglas Pollock CLA 2004-11-23 08:53:40 EST
I'm just asking how you guys get it to work in the context menu. 
Comment 7 Dani Megert CLA 2004-11-23 09:02:01 EST
For example you can take a look at the OccurrencesSearchGroup: adapts the
context menu (see fillContextMenu(...)) and also contains the QuickAccessAction.
Comment 8 Douglas Pollock CLA 2004-11-23 15:00:29 EST
Dani: side note.  I've picked up today's integration build, and I must confess 
I am a little bit put-off by the new effect for the "Ctrl+Shift+U" key binding.  
I'm quite used to using the key combination to quickly scan for uses of a 
variable within a file.  Is there a way to not get prompted with that quick 
menu? 
Comment 9 Dani Megert CLA 2004-11-24 03:24:56 EST
>Is there a way to not get prompted with that quick menu? 
Sure. Simply reassign Ctrl+Shift+U to Find Occurrences in file command and - if
you like - asssign a new shortcut to the Quick Menu.
Comment 10 Benno Baumgartner CLA 2006-04-21 11:08:50 EDT
I've changed the menu into a dynamic one in N20060421-0010:-( I hope I can revert that in 3.3?
Comment 11 Michael Van Meekeren CLA 2006-04-21 13:56:26 EDT
Moving Dougs bugs
Comment 12 Paul Webster CLA 2007-04-05 19:03:39 EDT
Assigning to component owner
PW
Comment 13 Paul Webster CLA 2008-05-01 13:07:30 EDT
Dani, there is now API on MenuManager (setActionDefinitionId() :-) so that the small dynamic subclasses are no longer necessary to display a quick menu shortcut for a submenu (they can use the same command ID that is bound to the quick menu launcher).

This is also available for menus created by the the org.eclipse.ui.menus extension point.

PW
Comment 14 Eclipse Webmaster CLA 2019-09-06 15:36:07 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.