01: package org.osbl.client.action;
02:
03: import org.apache.commons.logging.LogFactory;
04:
05: import java.util.*;
06:
07: import javax.swing.Action;
08:
09: /**
10: * @author hengels
11: * @version $Revision$
12: */
13: public class ActionRegistry {
14: private static org.apache.commons.logging.Log LOG = LogFactory
15: .getLog(ActionRegistry.class);
16:
17: private static final Map<String, Action> actions = new HashMap<String, Action>();
18:
19: private ActionRegistry() {
20: }
21:
22: public static void registerAction(Action action) {
23: final String cmdKey = (String) action
24: .getValue(Action.ACTION_COMMAND_KEY);
25: if (actions.get(cmdKey) == null) {
26: actions.put(cmdKey, action);
27: LOG.info("Register Action: " + cmdKey);
28: }
29: }
30:
31: public static Action getAction(String command) {
32: return actions.get(command);
33: }
34:
35: public static Collection<Action> getActions() {
36: return actions.values();
37: }
38: }
|