KickJava   Java API By Example, From Geeks To Geeks.

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


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 IncludeActionGroup extends ActionGroup {
11   private ConfigViewPart fPart;
12   private EditIncludePatternAction fEditPatternAction;
13   private HonorTransientAction fHonorTransientAction;
14   private OnLoadAction fOnLoadAction;
15   
16   IncludeActionGroup(ConfigViewPart part) {
17     fPart = part;
18     makeActions();
19   }
20
21   ConfigViewPart getPart() {
22     return fPart;
23   }
24   
25   private void makeActions() {
26     fHonorTransientAction = new HonorTransientAction(fPart);
27     fOnLoadAction = new OnLoadAction(fPart);
28     fEditPatternAction = new EditIncludePatternAction(fPart);
29   }
30   
31   public void setContext(ActionContext context) {
32     super.setContext(context);
33     fHonorTransientAction.setContext(context);
34     fOnLoadAction.setContext(context);
35     fEditPatternAction.setContext(context);
36   }
37
38   public void fillContextMenu(IMenuManager menu) {
39     if(fEditPatternAction.canActionBeAdded()) {
40       menu.add(fEditPatternAction);
41     }
42     if(fHonorTransientAction.canActionBeAdded()) {
43       menu.add(fHonorTransientAction);
44     }
45     if(fOnLoadAction.canActionBeAdded()) {
46       menu.add(fOnLoadAction);
47     }
48   }
49 }
50
51
Popular Tags