Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Keimel2015-03-24 07:16:07 -0400
committerTom Schindl2015-06-10 05:06:33 -0400
commit179e3658c7c910ee30514accbeaaf31ad611a51f (patch)
treefed49f1be8802b7b4591aa6e891961e5fd53c36d
parent225033d7ce645d4540142e47146ac204d4838048 (diff)
downloadorg.eclipse.efxclipse-maint_1_2_x.tar.gz
org.eclipse.efxclipse-maint_1_2_x.tar.xz
org.eclipse.efxclipse-maint_1_2_x.zip
Bug 462936 - NPE when using system key (i.e. DELETE) as key bindingmaint_1_2_x
Signed-off-by: Christoph Keimel <c.keimel@emsw.de>
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefMenuItemRenderer.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefMenuItemRenderer.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefMenuItemRenderer.java
index c17bb74f4..f9e1455f4 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefMenuItemRenderer.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.fx/src/org/eclipse/fx/ui/workbench/renderers/fx/DefMenuItemRenderer.java
@@ -10,8 +10,10 @@
*******************************************************************************/
package org.eclipse.fx.ui.workbench.renderers.fx;
+import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
import javafx.application.Platform;
import javafx.event.ActionEvent;
@@ -209,8 +211,16 @@ public class DefMenuItemRenderer extends BaseMenuItemRenderer<MenuItem> {
if (sequence != null && sequence.getKeyStrokes().length == 1) {
KeyStroke k = sequence.getKeyStrokes()[0];
- getWidget().setAccelerator(new KeyCodeCombination(KeyCode.getKeyCode(Character.toUpperCase((char) k.getKeyCode()) + ""), //$NON-NLS-1$
- k.hasShiftModifier() ? ModifierValue.DOWN : ModifierValue.ANY, k.hasCtrlModifier() ? ModifierValue.DOWN : ModifierValue.ANY, k.hasAltModifier() ? ModifierValue.DOWN : ModifierValue.ANY, k.hasCommandModifier() ? ModifierValue.DOWN : ModifierValue.ANY, ModifierValue.ANY));
+ KeyCode keyCode = null;
+ List<KeyCode> collect = Arrays.asList(KeyCode.values()).stream().filter(code -> {
+ return code.impl_getCode() == k.getKeyCode();
+ }).collect(Collectors.toList());
+ if (collect.size() > 0)
+ keyCode = collect.get(0);
+
+ getWidget().setAccelerator(
+ new KeyCodeCombination(keyCode, k.hasShiftModifier() ? ModifierValue.DOWN : ModifierValue.ANY, k.hasCtrlModifier() ? ModifierValue.DOWN : ModifierValue.ANY, k.hasAltModifier() ? ModifierValue.DOWN : ModifierValue.ANY, k.hasCommandModifier() ? ModifierValue.DOWN
+ : ModifierValue.ANY, ModifierValue.ANY));
} else {
getWidget().setAccelerator(null);
}

Back to the top