01: package net.sourceforge.squirrel_sql.plugins.hibernate;
02:
03: import net.sourceforge.squirrel_sql.client.gui.session.ToolsPopupAccessor;
04: import net.sourceforge.squirrel_sql.client.gui.session.ToolsPopupController;
05: import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
06:
07: import javax.swing.*;
08: import java.util.HashMap;
09:
10: public class ToolsPopupAccessorProxy implements ToolsPopupAccessor {
11: private HashMap<String, Action> _key_action = new HashMap<String, Action>();
12:
13: public void addToToolsPopup(String key, Action action) {
14: _key_action.put(key, action);
15: }
16:
17: public void apply(HQLEntryPanelManager hqlEntryPanelManager) {
18: for (String key : _key_action.keySet()) {
19: Action action = _key_action.get(key);
20: hqlEntryPanelManager.addToSQLEntryAreaMenu(action, key);
21:
22: if (action instanceof SquirrelAction) {
23: KeyStroke keyStroke = ((SquirrelAction) action)
24: .getKeyStroke();
25: if (null != keyStroke) {
26: hqlEntryPanelManager.registerKeyboardAction(action,
27: keyStroke);
28: }
29: }
30: }
31: }
32: }
|