KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ca > mcgill > sable > soot > cfg > CFGMenuProvider


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2004 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 /*
21  * Created on May 20, 2004
22  *
23  * To change the template for this generated file go to
24  * Window>Preferences>Java>Code Generation>Code and Comments
25  */

26 package ca.mcgill.sable.soot.cfg;
27
28 import org.eclipse.gef.ContextMenuProvider;
29 import org.eclipse.gef.EditPartViewer;
30 import org.eclipse.jface.action.*;
31 import org.eclipse.gef.ui.actions.*;
32 import org.eclipse.ui.*;
33 import ca.mcgill.sable.graph.*;
34
35
36 /**
37  * @author jlhotak
38  *
39  * To change the template for this generated type comment go to
40  * Window>Preferences>Java>Code Generation>Code and Comments
41  */

42 public class CFGMenuProvider extends ContextMenuProvider {
43
44     ActionRegistry registry;
45     EditPartViewer viewer;
46     IWorkbenchPart part;
47     
48     /**
49      * @param viewer
50      */

51     public CFGMenuProvider(EditPartViewer viewer, ActionRegistry registry, IWorkbenchPart part) {
52         super(viewer);
53         setRegistry(registry);
54         this.part = part;
55         // TODO Auto-generated constructor stub
56
}
57
58     /* (non-Javadoc)
59      * @see org.eclipse.gef.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager)
60      */

61     public void buildContextMenu(IMenuManager menu) {
62         GEFActionConstants.addStandardActionGroups(menu);
63         
64         // TODO Auto-generated method stub
65
//IAction showCode = new ShowCodeAction(part);
66
//System.out.println("registry: "+getRegistry());
67
//System.out.println("acion: "+getRegistry().getAction(StopAction.STOP));
68
menu.add(getRegistry().getAction(StopAction.STOP));
69         menu.add(getRegistry().getAction(UnStopAction.UN_STOP));
70         //getRegistry().registerAction(showCode);
71
//((GraphEditor)part).getGraphEditorSelectionActions().add(showCode);
72
}
73
74     /**
75      * @return
76      */

77     public ActionRegistry getRegistry() {
78         return registry;
79     }
80
81     /**
82      * @param registry
83      */

84     public void setRegistry(ActionRegistry registry) {
85         this.registry = registry;
86     }
87
88 }
89
Popular Tags