Author: scabanovich
Date: 2010-04-22 12:20:22 -0400 (Thu, 22 Apr 2010)
New Revision: 21618
Modified:
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/AbstractMultiPageContributor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5746
Modified:
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/AbstractMultiPageContributor.java
===================================================================
---
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/AbstractMultiPageContributor.java 2010-04-22
16:17:05 UTC (rev 21617)
+++
branches/jbosstools-3.1.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/AbstractMultiPageContributor.java 2010-04-22
16:20:22 UTC (rev 21618)
@@ -230,7 +230,19 @@
};
Map<IAction, ActionHandler> used = new HashMap<IAction, ActionHandler>();
- Map<String, IHandlerActivation> registered = new HashMap<String,
IHandlerActivation>();
+ Map<String, Deactivator> registered = new HashMap<String, Deactivator>();
+
+ class Deactivator {
+ IHandlerService service;
+ IHandlerActivation handler;
+ Deactivator(IHandlerService service, IHandlerActivation handler) {
+ this.service = service;
+ this.handler = handler;
+ }
+ void deactivate() {
+ service.deactivateHandler(handler);
+ }
+ }
public void registerKeyBindings(IHandlerService handler, String[] actions, ITextEditor
editor) {
for (int i = 0; i < actions.length; i++) {
@@ -250,10 +262,10 @@
used.put(action, h);
}
String id = action.getId();
- IHandlerActivation c = registered.get(id);
- if(c != null) handler.deactivateHandler(c);
+ Deactivator c = registered.remove(command);
+ if(c != null) c.deactivate();
IHandlerActivation a = handler.activateHandler(command, h);
- if(a != null) registered.put(id, a);
+ if(a != null) registered.put(command, new Deactivator(handler, a));
}
public void dispose() {