01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.views;
05:
06: import org.eclipse.jface.action.IMenuManager;
07: import org.eclipse.ui.actions.ActionContext;
08: import org.eclipse.ui.actions.ActionGroup;
09:
10: public class LockActionGroup extends ActionGroup {
11: private ConfigViewPart fPart;
12: private EditLockExpressionAction fEditExpressionAction;
13: private LockLevelAction fLevelAction;
14: private AutoSynchronizedAction fAutoSyncAction;
15:
16: LockActionGroup(ConfigViewPart part) {
17: fPart = part;
18: makeActions();
19: }
20:
21: ConfigViewPart getPart() {
22: return fPart;
23: }
24:
25: private void makeActions() {
26: fLevelAction = new LockLevelAction(fPart);
27: fEditExpressionAction = new EditLockExpressionAction(fPart);
28: fAutoSyncAction = new AutoSynchronizedAction(fPart);
29: }
30:
31: public void setContext(ActionContext context) {
32: super .setContext(context);
33: fLevelAction.setContext(context);
34: fEditExpressionAction.setContext(context);
35: fAutoSyncAction.setContext(context);
36: }
37:
38: public void fillContextMenu(IMenuManager menu) {
39: if (fEditExpressionAction.canActionBeAdded()) {
40: menu.add(fEditExpressionAction);
41: }
42: if (fLevelAction.canActionBeAdded()) {
43: menu.add(fLevelAction);
44: }
45: if (fAutoSyncAction.canActionBeAdded()) {
46: menu.add(fAutoSyncAction);
47: }
48: }
49: }
|