Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2012-04-26 09:23:52 -0400
committerBrian de Alwis2012-04-26 09:23:52 -0400
commit2cdbb78665fcfe7e24ce192d318b5459d372875f (patch)
treea47ff6a32297484691ef4987ddc0c4c45e39d15e
parentbfc6bf9c166fc8e63232116457c0678e520759a9 (diff)
downloadorg.eclipse.e4.tools-2cdbb78665fcfe7e24ce192d318b5459d372875f.tar.gz
org.eclipse.e4.tools-2cdbb78665fcfe7e24ce192d318b5459d372875f.tar.xz
org.eclipse.e4.tools-2cdbb78665fcfe7e24ce192d318b5459d372875f.zip
Bug 376475 - [CSSSpy] processor causes duplicate Copy keybindingv20120426-1323
Don't create a new binding table, but insert into the table corresponding to the requested context.
-rw-r--r--bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/SpyInstaller.java36
1 files changed, 12 insertions, 24 deletions
diff --git a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/SpyInstaller.java b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/SpyInstaller.java
index 28f80284..c2bb4196 100644
--- a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/SpyInstaller.java
+++ b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/SpyInstaller.java
@@ -14,7 +14,6 @@ import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.MApplication;
-import org.eclipse.e4.ui.model.application.commands.MBindingContext;
import org.eclipse.e4.ui.model.application.commands.MBindingTable;
import org.eclipse.e4.ui.model.application.commands.MCommand;
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
@@ -68,7 +67,12 @@ public class SpyInstaller {
return hdlr;
}
- private void installSpyBinding(String bindingContextId, MCommand cmd, String keySeq) {
+ private void installSpyBinding(String bindingContextId, MCommand cmd,
+ String keySeq) {
+ // there is a one-to-one mapping between binding contexts and
+ // binding tables, though binding tables may not necessarily
+ // guaranteed an element id.
+ MBindingTable bindingTable = null;
for(MBindingTable table : app.getBindingTables()) {
for(MKeyBinding binding : table.getBindings()) {
if(binding.getCommand() == cmd) {
@@ -76,33 +80,17 @@ public class SpyInstaller {
return;
}
}
- }
-
- MBindingContext context = null;
- for(MBindingContext ctxt : app.getBindingContexts()) {
- if(ctxt.getElementId().equals(bindingContextId)) {
- context = ctxt;
- break;
- }
- }
- if(context == null) {
- System.err.println("Cannot find binding context: " + bindingContextId);
- return;
- }
-
- MBindingTable bindingTable = null;
- String tableId = "bt." + cmd.getElementId();
- for(MBindingTable table : app.getBindingTables()) {
- if(tableId.equals(table.getElementId())) {
+ if (table.getBindingContext() != null
+ && bindingContextId.equals(table.getBindingContext()
+ .getElementId())) {
bindingTable = table;
}
}
if(bindingTable == null) {
- bindingTable = MCommandsFactory.INSTANCE.createBindingTable();
- bindingTable.setElementId(tableId);
- bindingTable.setBindingContext(context);
- app.getBindingTables().add(bindingTable);
+ System.err.println("Cannot find table for binding context: "
+ + bindingContextId);
+ return;
}
MKeyBinding binding = MCommandsFactory.INSTANCE.createKeyBinding();

Back to the top