aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Sudol2014-02-12 07:11:18 (EST)
committerGerrit Code Review @ Eclipse.org2014-02-12 14:09:47 (EST)
commit507a271d3f852c9b50fc9c9fb8a3338189b81e07 (patch)
tree99e00492ca7b1fb2e2f5f08e227a2a32b3b1b5e2
parent675d6c5c2eb787790517cfcf80bcb1f43f525d54 (diff)
downloadeclipse.platform.ui-507a271d3f852c9b50fc9c9fb8a3338189b81e07.zip
eclipse.platform.ui-507a271d3f852c9b50fc9c9fb8a3338189b81e07.tar.gz
eclipse.platform.ui-507a271d3f852c9b50fc9c9fb8a3338189b81e07.tar.bz2
Bug 380721 - [KeyBindings] Programmatically-created commands are notrefs/changes/26/21626/5
available in fresh workspace Change-Id: If641c47d197d305b302581336c746ad65cfa9497 Signed-off-by: Wojciech Sudol <wojciech.sudol@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java15
2 files changed, 16 insertions, 1 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java
index d015a3c..1324431 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/util/BindingProcessingAddon.java
@@ -251,6 +251,8 @@ public class BindingProcessingAddon {
}
keyBinding = bindingService.createBinding(sequence, cmd,
bindingContext.getId(), attrs);
+ binding.getTransientData().put(
+ EBindingService.MODEL_TO_BINDING_KEY, keyBinding);
} catch (IllegalArgumentException e) {
Activator.trace(Policy.DEBUG_MENUS,
"failed to create: " + binding, e); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java
index b2511a9..463236e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/model/KeyController.java
@@ -16,8 +16,10 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.util.HashSet;
import java.util.Map;
import java.util.ResourceBundle;
+import java.util.Set;
import org.eclipse.core.commands.CommandManager;
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.core.commands.common.NotDefinedException;
@@ -26,6 +28,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.ui.bindings.EBindingService;
import org.eclipse.jface.bindings.Binding;
import org.eclipse.jface.bindings.BindingManager;
import org.eclipse.jface.bindings.Scheme;
@@ -155,7 +158,17 @@ public class KeyController {
bindingManager.setLocale(bindingService.getLocale());
bindingManager.setPlatform(bindingService.getPlatform());
- bindingManager.setBindings(bindingService.getBindings());
+
+ Set<Binding> bindings = new HashSet<Binding>();
+ EBindingService eBindingService = (EBindingService) locator
+ .getService(EBindingService.class);
+ bindings.addAll(eBindingService.getActiveBindings());
+ for (Binding binding : bindingService.getBindings()) {
+ bindings.add(binding);
+ }
+
+ bindingManager.setBindings(bindings.toArray(new Binding[0]));
+
return bindingManager;
}