Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schindl2015-03-30 21:52:26 +0000
committerGerrit Code Review @ Eclipse.org2015-03-30 21:52:26 +0000
commited3b3dfd0f8be81c57507805ecc174a83ef03a66 (patch)
tree14d1524a55ae642113ee7262da934d3caeb1b504 /bundles/runtime
parentc02fd031f80572029632e76e3a92733bee3d23f3 (diff)
parent314d4ca3946edd8c6f611a9f78fd558f1900e989 (diff)
downloadorg.eclipse.efxclipse-ed3b3dfd0f8be81c57507805ecc174a83ef03a66.tar.gz
org.eclipse.efxclipse-ed3b3dfd0f8be81c57507805ecc174a83ef03a66.tar.xz
org.eclipse.efxclipse-ed3b3dfd0f8be81c57507805ecc174a83ef03a66.zip
Merge "Bug 463452 - Enable possibility to use JavaFX KeyCode alias names in key bindings"
Diffstat (limited to 'bundles/runtime')
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.keybindings.generic/src/org/eclipse/fx/ui/keybindings/generic/KeyStrokeImpl.java8
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.keybindings/src/org/eclipse/fx/ui/keybindings/KeyLookup.java24
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/FxKeyLookup.java32
3 files changed, 10 insertions, 54 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.keybindings.generic/src/org/eclipse/fx/ui/keybindings/generic/KeyStrokeImpl.java b/bundles/runtime/org.eclipse.fx.ui.keybindings.generic/src/org/eclipse/fx/ui/keybindings/generic/KeyStrokeImpl.java
index a58bf8ffc..36b63d266 100755
--- a/bundles/runtime/org.eclipse.fx.ui.keybindings.generic/src/org/eclipse/fx/ui/keybindings/generic/KeyStrokeImpl.java
+++ b/bundles/runtime/org.eclipse.fx.ui.keybindings.generic/src/org/eclipse/fx/ui/keybindings/generic/KeyStrokeImpl.java
@@ -12,6 +12,8 @@ package org.eclipse.fx.ui.keybindings.generic;
import java.util.StringTokenizer;
+import javafx.scene.input.KeyCode;
+
import org.eclipse.fx.ui.keybindings.KeyLookup;
import org.eclipse.fx.ui.keybindings.KeyStroke;
import org.eclipse.fx.ui.keybindings.ParseException;
@@ -71,7 +73,13 @@ public class KeyStrokeImpl extends TriggerImpl implements KeyStroke {
token = token.toUpperCase();
if (token != null) {
naturalKey = lookup.formalKeyLookup(token);
+ if (naturalKey == NO_KEY) {
+ KeyCode fxKeyCode = KeyCode.valueOf(token);
+ if (fxKeyCode != null)
+ naturalKey = fxKeyCode.impl_getCode();
+ }
}
+
}
}
diff --git a/bundles/runtime/org.eclipse.fx.ui.keybindings/src/org/eclipse/fx/ui/keybindings/KeyLookup.java b/bundles/runtime/org.eclipse.fx.ui.keybindings/src/org/eclipse/fx/ui/keybindings/KeyLookup.java
index 764756178..aad8f9e9e 100755
--- a/bundles/runtime/org.eclipse.fx.ui.keybindings/src/org/eclipse/fx/ui/keybindings/KeyLookup.java
+++ b/bundles/runtime/org.eclipse.fx.ui.keybindings/src/org/eclipse/fx/ui/keybindings/KeyLookup.java
@@ -489,18 +489,6 @@ public interface KeyLookup {
public int formalKeyLookup(@NonNull String name);
/**
- * Looks up a single natural key by its formal name, and returns the integer
- * representation for this natural key
- *
- * @param name
- * The formal name of the natural key to look-up; must not be
- * <code>null</code>.
- * @return The integer representation of this key. If the natural key cannot
- * be found, then this method returns <code>0</code>.
- */
- public @NonNull Integer formalKeyLookupInteger(@NonNull String name);
-
- /**
* Looks up a single modifier key by its formal name, and returns the integer
* representation for this modifier key
*
@@ -513,18 +501,6 @@ public interface KeyLookup {
public int formalModifierLookup(@NonNull String name);
/**
- * Looks up a key value, and returns the formal string representation for
- * that key
- *
- * @param key
- * The key to look-up.
- * @return The formal string representation of this key. If this key cannot
- * be found, then it is simply the character corresponding to that
- * integer value.
- */
- public @NonNull String formalNameLookup(int key);
-
- /**
* Returns the integer representation of the ALT key.
*
* @return The ALT key
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/FxKeyLookup.java b/bundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/FxKeyLookup.java
index 0e293ffb4..f551a7e5c 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/FxKeyLookup.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/FxKeyLookup.java
@@ -401,23 +401,7 @@ public final class FxKeyLookup implements KeyLookup {
if (value instanceof Integer) {
return ((Integer) value).intValue();
}
-
- if (name.length() > 0) {
- throw new IllegalArgumentException("Unrecognized formal key name: " //$NON-NLS-1$
- + name);
- }
-
- return name.charAt(0);
- }
-
- @Override
- public final Integer formalKeyLookupInteger(final String name) {
- final Object value = this.naturalKeyTable.get(name);
- if (value instanceof Integer) {
- return (Integer) value;
- }
-
- return new Integer(name.charAt(0));
+ return NO_KEY;
}
@Override
@@ -426,19 +410,7 @@ public final class FxKeyLookup implements KeyLookup {
if (value instanceof Integer) {
return ((Integer) value).intValue();
}
-
- return 0;
- }
-
- @Override
- public final String formalNameLookup(final int key) {
- final Integer keyObject = new Integer(key);
- final Object value = this.nameTable.get(keyObject);
- if (value instanceof String) {
- return (String) value;
- }
-
- return ZERO_LENGTH_STRING + ((char) key);
+ return NO_KEY;
}
@Override

Back to the top