KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > dso > views > LockActionGroup


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package org.terracotta.dso.views;
5
6 import org.eclipse.jface.action.IMenuManager;
7 import org.eclipse.ui.actions.ActionContext;
8 import org.eclipse.ui.actions.ActionGroup;
9
10 public class LockActionGroup extends ActionGroup {
11   private ConfigViewPart fPart;
12   private EditLockExpressionAction fEditExpressionAction;
13   private LockLevelAction fLevelAction;
14   
15   LockActionGroup(ConfigViewPart part) {
16     fPart = part;
17     makeActions();
18   }
19
20   ConfigViewPart getPart() {
21     return fPart;
22   }
23   
24   private void makeActions() {
25     fLevelAction = new LockLevelAction(fPart);
26     fEditExpressionAction = new EditLockExpressionAction(fPart);
27   }
28   
29   public void setContext(ActionContext context) {
30     super.setContext(context);
31     fLevelAction.setContext(context);
32     fEditExpressionAction.setContext(context);
33   }
34
35   public void fillContextMenu(IMenuManager menu) {
36     if(fEditExpressionAction.canActionBeAdded()) {
37       menu.add(fEditExpressionAction);
38     }
39     if(fLevelAction.canActionBeAdded()) {
40       menu.add(fLevelAction);
41     }
42   }
43 }
44
45
Popular Tags