1 12 package org.eclipse.jdt.internal.ui.callhierarchy; 13 14 import org.eclipse.core.runtime.Assert; 15 16 import org.eclipse.jface.action.Action; 17 18 import org.eclipse.ui.PlatformUI; 19 20 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 21 import org.eclipse.jdt.internal.ui.JavaPluginImages; 22 23 26 class ToggleOrientationAction extends Action { 27 28 private CallHierarchyViewPart fView; 29 private int fActionOrientation; 30 31 public ToggleOrientationAction(CallHierarchyViewPart v, int orientation) { 32 super("", AS_RADIO_BUTTON); if (orientation == CallHierarchyViewPart.VIEW_ORIENTATION_HORIZONTAL) { 34 setText(CallHierarchyMessages.ToggleOrientationAction_horizontal_label); 35 setDescription(CallHierarchyMessages.ToggleOrientationAction_horizontal_description); 36 setToolTipText(CallHierarchyMessages.ToggleOrientationAction_horizontal_tooltip); 37 JavaPluginImages.setLocalImageDescriptors(this, "th_horizontal.gif"); } else if (orientation == CallHierarchyViewPart.VIEW_ORIENTATION_VERTICAL) { 39 setText(CallHierarchyMessages.ToggleOrientationAction_vertical_label); 40 setDescription(CallHierarchyMessages.ToggleOrientationAction_vertical_description); 41 setToolTipText(CallHierarchyMessages.ToggleOrientationAction_vertical_tooltip); 42 JavaPluginImages.setLocalImageDescriptors(this, "th_vertical.gif"); } else if (orientation == CallHierarchyViewPart.VIEW_ORIENTATION_AUTOMATIC) { 44 setText(CallHierarchyMessages.ToggleOrientationAction_automatic_label); 45 setDescription(CallHierarchyMessages.ToggleOrientationAction_automatic_description); 46 setToolTipText(CallHierarchyMessages.ToggleOrientationAction_automatic_tooltip); 47 JavaPluginImages.setLocalImageDescriptors(this, "th_automatic.gif"); } else if (orientation == CallHierarchyViewPart.VIEW_ORIENTATION_SINGLE) { 49 setText(CallHierarchyMessages.ToggleOrientationAction_single_label); 50 setDescription(CallHierarchyMessages.ToggleOrientationAction_single_description); 51 setToolTipText(CallHierarchyMessages.ToggleOrientationAction_single_tooltip); 52 JavaPluginImages.setLocalImageDescriptors(this, "th_single.gif"); } else { 54 Assert.isTrue(false); 55 } 56 fView= v; 57 fActionOrientation= orientation; 58 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CALL_HIERARCHY_TOGGLE_ORIENTATION_ACTION); 59 } 60 61 public int getOrientation() { 62 return fActionOrientation; 63 } 64 65 68 public void run() { 69 if (isChecked()) { 70 fView.fOrientation= fActionOrientation; 71 fView.computeOrientation(); 72 } 73 } 74 75 } 76 | Popular Tags |