summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorBogdan Gheorghe2012-11-07 11:24:42 (EST)
committer Bogdan Gheorghe2012-11-07 11:24:42 (EST)
commit478ae0a1df96c36245c91518ba2975b3351da433 (patch)
treeeb0de02be1dd0eec2ee8c8b0f4f36f7d5816c5a9
parent699191aabd7973643a37575c2ba93419fadcead7 (diff)
downloadeclipse.platform.ui-478ae0a1df96c36245c91518ba2975b3351da433.zip
eclipse.platform.ui-478ae0a1df96c36245c91518ba2975b3351da433.tar.gz
eclipse.platform.ui-478ae0a1df96c36245c91518ba2975b3351da433.tar.bz2
Bug 391868 - very slow switching editors; especially XML.v20121107-162442M20121107-1200
-rw-r--r--bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/BindingServiceImpl.java5
-rw-r--r--bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/ContextServiceAddon.java19
2 files changed, 19 insertions, 5 deletions
diff --git a/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/BindingServiceImpl.java b/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/BindingServiceImpl.java
index 9bd7a71..31b8ba2 100644
--- a/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/BindingServiceImpl.java
+++ b/bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/BindingServiceImpl.java
@@ -13,7 +13,6 @@ package org.eclipse.e4.ui.bindings.internal;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
@@ -224,9 +223,6 @@ public class BindingServiceImpl implements EBindingService {
public void setContextIds(@Named(ACTIVE_CONTEXTS) @Optional Set<String> set) {
if (set == null || set.isEmpty() || contextManager == null) {
contextSet = ContextSet.EMPTY;
- if (contextManager != null) {
- contextManager.setActiveContextIds(Collections.EMPTY_SET);
- }
return;
}
ArrayList<Context> contexts = new ArrayList<Context>();
@@ -234,7 +230,6 @@ public class BindingServiceImpl implements EBindingService {
contexts.add(contextManager.getContext(id));
}
contextSet = manager.createContextSet(contexts);
- contextManager.setActiveContextIds(set);
}
public Collection<Binding> getActiveBindings() {
diff --git a/bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/ContextServiceAddon.java b/bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/ContextServiceAddon.java
index 693eb88..f25f3bd 100644
--- a/bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/ContextServiceAddon.java
+++ b/bundles/org.eclipse.e4.ui.services/src/org/eclipse/e4/ui/services/ContextServiceAddon.java
@@ -1,8 +1,12 @@
package org.eclipse.e4.ui.services;
+import java.util.Collections;
+
+import java.util.Set;
import javax.annotation.PostConstruct;
import org.eclipse.core.commands.contexts.ContextManager;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.contexts.RunAndTrack;
import org.eclipse.e4.ui.internal.services.ActiveContextsFunction;
import org.eclipse.e4.ui.internal.services.ContextContextFunction;
@@ -18,5 +22,20 @@ public class ContextServiceAddon {
context.set(EContextService.class.getName(), new ContextContextFunction());
context.set(IServiceConstants.ACTIVE_CONTEXTS, new ActiveContextsFunction());
+ context.runAndTrack(new RunAndTrack() {
+ @Override
+ public boolean changed(IEclipseContext context) {
+ ContextManager manager = context.get(ContextManager.class);
+ if (manager != null) {
+ Object s = context.get(IServiceConstants.ACTIVE_CONTEXTS);
+ if (s instanceof Set) {
+ manager.setActiveContextIds((Set) s);
+ } else {
+ manager.setActiveContextIds(Collections.EMPTY_SET);
+ }
+ }
+ return true;
+ }
+ });
}
}