Bug 157808

Summary: [KeyBindings] JFace library has two independent collections to get an accelerator text for a Menu contribution item
Product: [Eclipse Project] Platform Reporter: Yevgeni <yevgeny>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: ASSIGNED --- QA Contact:
Severity: trivial    
Priority: P3 CC: Tod_Creasey
Version: 3.2Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Yevgeni CLA 2006-09-19 09:36:12 EDT
I created dynamically a new workbench menu with some contribution items. One of them has an accelerator value Ctrl+Shift+Arrow_Left:
 MyAction.setAccelerator(Action.convertAccelerator("Ctrl+Shift+Arrow_Left")); 
When my menu has been built I saw that the contributed item has a label "Align Left Ctrl+Al+Arrow Left" instead of "Align Left Ctrl+Alt+Left" like the "Back Alt+Left" from Navigate menu.
I debugged the JFace library and found that if the an action was created from XML  definition that it use the ExternalActionManager class to get accelerator text but if an action was done dynamically whith an accelerator value than it use the convertAccelerator method from Action class (look at snipped code from the ActionContributionItem class):

public void update(String propertyName) 
{
........................................

                    if (accelerator == 0) {
                        if ((callback != null) && (commandId != null)) {
                            acceleratorText = callback
                                    .getAcceleratorText(commandId);
                        }
                    } else {
                        acceleratorText = Action
                                .convertAccelerator(accelerator);
                    }


.............................................
}
Comment 1 Boris Bokowski CLA 2006-09-19 12:15:05 EDT
So the bug is that the menu item reads
"Align Left Ctrl+Alt+Arrow Left" but should be
"Align Left Ctrl+Alt+Left"?
Comment 2 Paul Webster CLA 2006-10-03 14:13:38 EDT
I won't be fixing bugs until 3.3M4 (which is in six weeks).

PW
Comment 3 Paul Webster CLA 2006-10-03 14:20:35 EDT
This problem seems to be related to the JFace resources calls and LegacyActionTools key string map,

keyStrings.put(new Integer(SWT.ARROW_LEFT), JFaceResources
  .getString("Arrow_Left")); //$NON-NLS-1$

and
Arrow_Left = Arrow Left

Tod, Should the "keycodes" even be localized?

PW
Comment 4 Tod Creasey CLA 2006-10-03 14:31:41 EDT
No identifier should be localized - only human readable labels.
Comment 5 Eclipse Webmaster CLA 2019-09-06 15:33:14 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.
Comment 6 Eclipse Webmaster CLA 2019-09-06 15:35:38 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.