01: /*
02: * SimpleContainerProvider.java
03: *
04: * Created on January 25, 2004, 3:07 PM
05: */
06:
07: package org.netbeans.actions.simple;
08:
09: import java.util.MissingResourceException;
10: import java.util.ResourceBundle;
11: import org.netbeans.actions.spi.ActionProvider;
12: import org.netbeans.actions.spi.ContainerProvider;
13:
14: /**
15: *
16: * @author tim
17: */
18: public class SimpleContainerProvider extends ContainerProvider {
19: private Interpreter interp;
20: ResourceBundle bundle;
21:
22: /** Creates a new instance of SimpleContainerProvider */
23: public SimpleContainerProvider(Interpreter interp,
24: ResourceBundle bundle) {
25: this .interp = interp;
26: this .bundle = bundle;
27: }
28:
29: public int getContainerState(Object containerType,
30: String containerCtx, java.util.Map context) {
31: return ActionProvider.STATE_ENABLED
32: | ActionProvider.STATE_VISIBLE;
33: }
34:
35: public String getDisplayName(Object containerType,
36: String containerCtx) {
37: try {
38: return bundle.getString(containerCtx);
39: } catch (MissingResourceException mre) {
40: mre.printStackTrace();
41: return containerCtx;
42: }
43: }
44:
45: public String[] getMenuContainerContexts() {
46: return interp.getMenus();
47: }
48:
49: public String[] getToolbarContainerContexts() {
50: return interp.getToolbars();
51: }
52:
53: }
|