Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Besedin2012-04-10 20:36:08 +0000
committerOleg Besedin2012-04-10 20:36:08 +0000
commitc432e724c14558715454a991fb4677cdbd3eb3d8 (patch)
tree57ca742b99396d072dea716e11ab7df40ef34bc1
parent7c7397b74eb4af6690d787dd4be9596a2230e555 (diff)
downloadeclipse.platform.ui-c432e724c14558715454a991fb4677cdbd3eb3d8.tar.gz
eclipse.platform.ui-c432e724c14558715454a991fb4677cdbd3eb3d8.tar.xz
eclipse.platform.ui-c432e724c14558715454a991fb4677cdbd3eb3d8.zip
Bug 374942 - Copy keybinding always brings up key binding selectionv20120410-2036I20120411-0258I20120410-2330I20120410-2037I20120410-1710
popup
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java41
1 files changed, 37 insertions, 4 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java
index b8f22038de2..b5590ccf094 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java
@@ -658,6 +658,36 @@ public final class BindingService implements IBindingService {
}
+ static private boolean isSameBinding(MKeyBinding existingBinding, MCommand cmd, Binding binding) {
+ // see org.eclipse.jface.bindings.Binding#equals(final Object object)
+ if (!cmd.equals(existingBinding.getCommand()))
+ return false;
+ String existingKeySequence = existingBinding.getKeySequence();
+ if (existingKeySequence == null)
+ return false;
+ if (!existingKeySequence.equals(binding.getTriggerSequence().format()))
+ return false;
+
+ // tags to look for:
+ ArrayList<String> expectedTagList = new ArrayList<String>(4);
+
+ String schemeId = binding.getSchemeId();
+ if (schemeId != null && !schemeId.equals(BindingPersistence.getDefaultSchemeId())) {
+ expectedTagList.add(EBindingService.SCHEME_ID_ATTR_TAG + ":" + schemeId); //$NON-NLS-1$
+ }
+ String locale = binding.getLocale();
+ if (locale != null) {
+ expectedTagList.add(EBindingService.LOCALE_ATTR_TAG + ":" + locale); //$NON-NLS-1$
+ }
+ String platform = binding.getPlatform();
+ if (platform != null) {
+ expectedTagList.add(EBindingService.PLATFORM_ATTR_TAG + ":" + platform); //$NON-NLS-1$
+ }
+ if (binding.getType() == Binding.USER) {
+ expectedTagList.add(EBindingService.TYPE_ATTR_TAG + ":user"); //$NON-NLS-1$
+ }
+ return existingBinding.getTags().equals(expectedTagList);
+ }
// TBD the "update" procedure should not typically be run.
// Add some sort of timestamp on the source files and update
@@ -682,10 +712,13 @@ public final class BindingService implements IBindingService {
MKeyBinding keyBinding = null;
for (MKeyBinding existingBinding : table.getBindings()) {
- if (cmd.equals(existingBinding.getCommand())
- && existingBinding.getKeySequence() != null
- && existingBinding.getKeySequence().equals(
- binding.getTriggerSequence().format())) {
+ Binding b = (Binding) existingBinding.getTransientData().get(
+ EBindingService.MODEL_TO_BINDING_KEY);
+ if (binding.equals(b)) {
+ keyBinding = existingBinding;
+ break;
+ }
+ if (isSameBinding(existingBinding, cmd, binding)) {
keyBinding = existingBinding;
break;
}

Back to the top