diff options
author | Remy Suen | 2012-01-23 18:02:56 +0000 |
---|---|---|
committer | Remy Suen | 2012-01-23 18:02:56 +0000 |
commit | b8c6c0a3b301f2bfb5d18a1f8b864ac4372b5a5b (patch) | |
tree | 6eba6c6c91702e82f557ffc17cf35de5d0e94529 | |
parent | b36acc1a2a78a92cf4e4e3c6997038d35d41d49e (diff) | |
download | eclipse.platform.ui-b8c6c0a3b301f2bfb5d18a1f8b864ac4372b5a5b.tar.gz eclipse.platform.ui-b8c6c0a3b301f2bfb5d18a1f8b864ac4372b5a5b.tar.xz eclipse.platform.ui-b8c6c0a3b301f2bfb5d18a1f8b864ac4372b5a5b.zip |
Bug 368494 [Compatibility] Preference mnemonic doesn't appear
Extract the mnemonic from the action and set it into the model
if found.
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java index e4373269bd4..81748fa5e92 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 IBM Corporation and others. + * Copyright (c) 2010, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -935,6 +935,13 @@ public class MenuHelper { menuItem.setIconURI(getIconURI(action.getImageDescriptor(), application.getContext())); + // extract the mnemonic definition + String text = action.getText(); + int index = text.indexOf('&'); + if (index != -1 && index != text.length() - 1) { + menuItem.setMnemonics(text.substring(index + 1, index + 2)); + } + switch (action.getStyle()) { case IAction.AS_CHECK_BOX: menuItem.setType(ItemType.CHECK); |