aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Elder2013-03-08 06:50:27 (EST)
committerPaul Elder2013-04-04 15:45:49 (EDT)
commitf6176146acf3d4592aa4c77418d682630ca8b470 (patch)
tree34993af4830cb42dbfc6f3c94a8746ffe8902a4c
parent24cee195f6bf8e51d662813fbd690df6b2ce3680 (diff)
downloadeclipse.platform.ui-f6176146acf3d4592aa4c77418d682630ca8b470.zip
eclipse.platform.ui-f6176146acf3d4592aa4c77418d682630ca8b470.tar.gz
eclipse.platform.ui-f6176146acf3d4592aa4c77418d682630ca8b470.tar.bz2
Bug 383992: Juno: calling getPartialMatches causes a stack overflowrefs/changes/67/10967/4
Change getPartialMatches() implementation to correctly package up result from EBindingService.getPartialMatches() to be compatible with the legacy API. Change-Id: I61f0b869b5d10d0a9ae71cf151fcfc3fc28bcbe7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/BindingService.java26
1 files changed, 6 insertions, 20 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 2cc593a..8c601e5 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
@@ -13,7 +13,6 @@ package org.eclipse.ui.internal.keys;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -282,28 +281,15 @@ public final class BindingService implements IBindingService {
* .bindings.TriggerSequence)
*/
public Map getPartialMatches(TriggerSequence trigger) {
- final TriggerSequence[] prefixes = trigger.getPrefixes();
- final int prefixesLength = prefixes.length;
- if (prefixesLength == 0) {
- return Collections.EMPTY_MAP;
- }
+ final Collection<Binding> partialMatches = bindingService.getPartialMatches(trigger);
+ final Map<TriggerSequence, Binding> result = new HashMap<TriggerSequence, Binding>(
+ partialMatches.size());
- Collection<Binding> partialMatches = bindingService.getPartialMatches(trigger);
- Map<TriggerSequence, Object> prefixTable = new HashMap<TriggerSequence, Object>();
for (Binding binding : partialMatches) {
- for (int i = 0; i < prefixesLength; i++) {
- final TriggerSequence prefix = prefixes[i];
- final Object value = prefixTable.get(prefix);
- if ((prefixTable.containsKey(prefix)) && (value instanceof Map)) {
- ((Map) value).put(prefixTable, binding);
- } else {
- final Map map = new HashMap();
- prefixTable.put(prefix, map);
- map.put(prefixTable, binding);
- }
- }
+ result.put(binding.getTriggerSequence(), binding);
}
- return prefixTable;
+
+ return result;
}
/*