1 19 20 21 package ca.mcgill.sable.soot.cfg.actions; 22 23 import org.eclipse.gef.ui.actions.ActionBarContributor; 24 import org.eclipse.jface.action.*; 25 import org.eclipse.gef.ui.actions.*; 26 import org.eclipse.ui.IWorkbenchActionConstants; 27 import ca.mcgill.sable.soot.interaction.*; 28 import org.eclipse.ui.*; 29 30 31 public class CFGActionBarContributor extends ActionBarContributor { 32 33 34 public CFGActionBarContributor() { 35 super(); 36 } 37 38 private StepForwardAction stepForward; 39 private StepBackwardAction stepBackward; 40 private FinishMethodAction finishMethod; 41 private NextMethodAction nextMethod; 42 private FlowSelectAction flowSelect; 43 private StopInteractionAction stopInteraction; 44 45 46 49 protected void buildActions() { 50 addRetargetAction(new ZoomInRetargetAction()); 51 addRetargetAction(new ZoomOutRetargetAction()); 52 53 flowSelect = new FlowSelectAction(null); 54 addAction(flowSelect); 55 56 stepBackward = new StepBackwardAction(null); 57 addAction(stepBackward); 58 stepForward = new StepForwardAction(null); 59 addAction(stepForward); 60 61 finishMethod = new FinishMethodAction(null); 62 addAction(finishMethod); 63 nextMethod = new NextMethodAction(null); 64 addAction(nextMethod); 65 66 stopInteraction = new StopInteractionAction(null); 67 addAction(stopInteraction); 68 69 70 } 71 72 75 protected void declareGlobalActionKeys() { 76 } 77 78 public void contributeToToolBar(IToolBarManager toolBarManager){ 80 super.contributeToToolBar(toolBarManager); 81 82 toolBarManager.add(new Separator()); 83 toolBarManager.add(getAction(StepBackwardAction.STEP_BACKWARD)); 84 85 toolBarManager.add(getAction(StepForwardAction.STEP_FORWARD)); 86 toolBarManager.add(getAction(FinishMethodAction.FINISH_METHOD)); 87 toolBarManager.add(getAction(NextMethodAction.NEXT_METHOD)); 88 89 toolBarManager.add(getAction(StopInteractionAction.STOP_INTERACTION)); 90 } 91 92 public void contributeToMenu(IMenuManager menuManager){ 93 super.contributeToMenu(menuManager); 94 95 MenuManager viewMenu = new MenuManager("View"); 96 viewMenu.add(getAction(GEFActionConstants.ZOOM_IN)); 97 viewMenu.add(getAction(GEFActionConstants.ZOOM_OUT)); 98 99 menuManager.insertAfter(IWorkbenchActionConstants.M_EDIT, viewMenu); 100 } 101 102 public void setActiveEditor(IEditorPart editor) { 103 super.setActiveEditor(editor); 104 stepForward.setEditorPart( editor ); 105 stepBackward.setEditorPart(editor); 106 finishMethod.setEditorPart(editor); 107 nextMethod.setEditorPart(editor); 108 flowSelect.setEditorPart(editor); 109 stopInteraction.setEditorPart(editor); 110 } 111 112 } 113 | Popular Tags |