This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 182601 - Missing shortcuts for actions in context menus
Summary: Missing shortcuts for actions in context menus
Status: RESOLVED INVALID
Alias: None
Product: platform
Classification: Unclassified
Component: Actions (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: UI
: 184794 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-23 16:48 UTC by Tomas Pavek
Modified: 2012-10-24 08:15 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Bit of patch which might be useful later but does not seem necessary now (2.35 KB, patch)
2010-05-03 15:02 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Pavek 2010-03-23 16:48:11 UTC
Since NB 6.8 many actions don't have their shortcuts displayed in context menus, while they have them in the main menu.

If you open e.g. context menu on a Java SE project, there is just Alt+F6 on Test action. Why Run, Build, Debug etc don't have the shortcut? There are other like Find... or Delete missing their shortcuts (Ctrl+F, Delete).

Really strange looking is that Copy and Cut actions don't have the shortcut, while Paste has it (in any context menu, e.g. on a package or in editor).

Some other exapmles:
* Go to Declaration or Go to Super Implementation in editor Navigate submenu
* Toggle Line Breakpoint
* Reload Form on Component Inspector's root node
And probably much more...

It looks the same in NB 6.8. It is much better in NB 6.7 - seems only the Build/Run/Debug actions on project don't show the shortcuts (but these actions are likely somewhat special in other way).
Comment 1 Jaroslav Tulach 2010-03-23 22:15:34 UTC
At most P3, if not P4.
Comment 2 Jaroslav Tulach 2010-04-12 20:08:52 UTC
I can't say what is wrong, just that there is no AcceleratorKey when the Cut and Copy actions are placed into popup menu. I attribute this to the push approach Jesse is attempting to apply to Action registration. In 6.7 we were using mine pop style of obtaining AcceleratorKeys and it used to work...
Comment 3 Jesse Glick 2010-04-12 20:46:03 UTC
It is possible that the Action present in the context menu is not in fact the same as the one registered in Shortcuts. Only if they are identical (e.g. *.shadow pointing to same Actions/*/*.instance) will the accelerator be displayed.

It is also possible that the presenter is being created by some nonstandard code which fails to call org.openide.awt.AcceleratorBinding.

Probably each menu item needs to be evaluated in turn to find the explanation.
Comment 4 Jaroslav Tulach 2010-04-13 08:25:51 UTC
I was investigating Cut/Copy on a file/folder. Those actions are classical callback .instance onces and there is a shadow pointing to them from folder actions folder or file actions folder.
Comment 5 Jaroslav Tulach 2010-04-23 09:28:26 UTC
*** Bug 184794 has been marked as a duplicate of this bug. ***
Comment 6 Jesse Glick 2010-05-03 13:31:55 UTC
(In reply to comment #2)
> I attribute this to the push
> approach Jesse is attempting to apply to Action registration. In 6.7 we were
> using mine pop style of obtaining AcceleratorKeys and it used to work...

The only shortcuts I see in 6.7 are Test (Alt-F6), Delete (DELETE), and Find (Ctrl-F), so bug #152576 can at most be part of the issue.

As far as Delete on a project is concerned, the context menu item is really CommonProjectActions.deleteProjectAction(), not DeleteAction. It is BadgingNode which binds Node.destroy to ActionProvider.COMMAND_DELETE, so that DeleteAction will delegate to it. Actions.deleteProject() does try to copy the accelerator from DeleteAction but got the wrong instance after jtulach's d1f35ed43181, and also failed to listen for changes - both of which I can fix. (Making it simply return DeleteAction could also perhaps work, but might have compatibility implications since that action would be enabled on more than just project nodes.)

Regarding Run etc., the versions of the actions in the context menu are not in fact identical to the main menu/toolbar versions. The former always applies to the selection, whereas the latter takes several factors into consideration, such as the main project. (Test Project is never main-project-sensitive, so Alt-F6 is displayed.) Forcing the two actions to share an accelerator will not be correct in case the user has actually bound the non-main-project-sensitive version to a keystroke (as you are permitted to do). Consolidating the two actions is probably possible but not trivial; may be too risky for 6.9.

Still investigating Find.
Comment 7 Jesse Glick 2010-05-03 15:01:20 UTC
Find does in fact show Ctrl-Shift-F on a j2seproject as of #182488.

The problem with Cut & Copy is a bug in GeneralAction.DelegateAction which I will fix.
Comment 8 Jesse Glick 2010-05-03 15:02:42 UTC
Created attachment 98374 [details]
Bit of patch which might be useful later but does not seem necessary now

Forces AcceleratorBinding.setAccelerator to be called as soon as an Action is loaded from a *.instance file. Might be a good way to eliminate some or all calls to this method from menu/toolbar construction code.
Comment 9 Jesse Glick 2010-05-03 15:04:19 UTC
Go to Declaration and Go to Super Implementation are handled by the editor's context menu system which I don't know details of.
Comment 10 Quality Engineering 2010-05-04 04:35:30 UTC
Integrated into 'main-golden', will be available in build *201005040200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/
User: 
Log:
Comment 11 Jaroslav Tulach 2012-10-24 08:15:42 UTC
I've just inherited the bug and while I vaguely remember its history, I'd rather receive new and direct report of what is currently wrong.