Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2013-07-18 10:57:05 -0400
committerTom Schindl2013-07-18 10:57:05 -0400
commit15052ea8db462584f9ee333d472f2ab219b03245 (patch)
tree5fb9b103412fb64ba23bce4a144ce4061509c01c
parentb71e8178cb8aed2d154386ef43f6ac3580f728a0 (diff)
downloadorg.eclipse.efxclipse-15052ea8db462584f9ee333d472f2ab219b03245.tar.gz
org.eclipse.efxclipse-15052ea8db462584f9ee333d472f2ab219b03245.tar.xz
org.eclipse.efxclipse-15052ea8db462584f9ee333d472f2ab219b03245.zip
Bug 413254 - Add easy way for Keybinding Handlers to delegate to native
implementation
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.services/META-INF/MANIFEST.MF2
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.services/src/org/eclipse/fx/ui/services/commands/NativeStrategy.java16
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/KeyBindingDispatcher.java6
3 files changed, 23 insertions, 1 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.services/META-INF/MANIFEST.MF b/bundles/runtime/org.eclipse.fx.ui.services/META-INF/MANIFEST.MF
index 7a6a1a2ce..ca0a2d906 100755
--- a/bundles/runtime/org.eclipse.fx.ui.services/META-INF/MANIFEST.MF
+++ b/bundles/runtime/org.eclipse.fx.ui.services/META-INF/MANIFEST.MF
@@ -5,6 +5,8 @@ Bundle-SymbolicName: org.eclipse.fx.ui.services
Bundle-Version: 0.9.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.fx.ui.services,
+ org.eclipse.fx.ui.services.commands,
org.eclipse.fx.ui.services.theme
Bundle-Vendor: %Bundle-Vendor
Import-Package: javafx.scene;version="2.0.0"
+Require-Bundle: org.eclipse.e4.core.di;bundle-version="1.3.0"
diff --git a/bundles/runtime/org.eclipse.fx.ui.services/src/org/eclipse/fx/ui/services/commands/NativeStrategy.java b/bundles/runtime/org.eclipse.fx.ui.services/src/org/eclipse/fx/ui/services/commands/NativeStrategy.java
new file mode 100644
index 000000000..d7af7355b
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.ui.services/src/org/eclipse/fx/ui/services/commands/NativeStrategy.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2013 BestSolution.at 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.ui.services.commands;
+
+public enum NativeStrategy {
+ BLOCK,
+ PROCEED
+} \ No newline at end of file
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/KeyBindingDispatcher.java b/bundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/KeyBindingDispatcher.java
index 6cf570331..ca956eb99 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/KeyBindingDispatcher.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.fx/src/org/eclipse/fx/ui/workbench/fx/key/KeyBindingDispatcher.java
@@ -35,6 +35,7 @@ import org.eclipse.fx.ui.keybindings.KeySequence;
import org.eclipse.fx.ui.keybindings.KeyStroke;
import org.eclipse.fx.ui.keybindings.e4.EBindingService;
import org.eclipse.fx.ui.keybindings.service.BindingFactory;
+import org.eclipse.fx.ui.services.commands.NativeStrategy;
@SuppressWarnings("restriction")
public class KeyBindingDispatcher {
@@ -347,7 +348,10 @@ public class KeyBindingDispatcher {
commandHandled = HandlerServiceImpl.lookUpHandler(context, command.getId()) != null;
try {
- handlerService.executeHandler(parameterizedCommand, staticContext);
+ Object o = handlerService.executeHandler(parameterizedCommand, staticContext);
+ if( o instanceof NativeStrategy && o == NativeStrategy.PROCEED ) {
+ return false;
+ }
} catch (final Exception e) {
commandHandled = false;
e.printStackTrace();

Back to the top