X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=case-study%2Fjdt-after%2Fui%2Forg%2Feclipse%2Fjdt%2Finternal%2Fui%2Fcallhierarchy%2FToggleOrientationAction.java;fp=case-study%2Fjdt-after%2Fui%2Forg%2Feclipse%2Fjdt%2Finternal%2Fui%2Fcallhierarchy%2FToggleOrientationAction.java;h=24e415a560752bf6d00dd07c3554d5e7c7198616;hb=1b2798f607d741df30e5197f427381cbff326adc;hp=0000000000000000000000000000000000000000;hpb=246231e4bd9b24345490f369747c0549ca308c4d;p=ifi-stolz-refaktor.git diff --git a/case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/callhierarchy/ToggleOrientationAction.java b/case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/callhierarchy/ToggleOrientationAction.java new file mode 100644 index 00000000..24e415a5 --- /dev/null +++ b/case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/callhierarchy/ToggleOrientationAction.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jesper Kamstrup Linnet (eclipse@kamstrup-linnet.dk) - initial API and implementation + * (report 36180: Callers/Callees view) + *******************************************************************************/ +package org.eclipse.jdt.internal.ui.callhierarchy; + +import org.eclipse.core.runtime.Assert; + +import org.eclipse.jface.action.Action; + +import org.eclipse.ui.PlatformUI; + +import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; +import org.eclipse.jdt.internal.ui.JavaPluginImages; + +/** + * Toggles the orientationof the layout of the call hierarchy + */ +class ToggleOrientationAction extends Action { + + CallHierarchyViewPart fView; + int fActionOrientation; + + public ToggleOrientationAction(CallHierarchyViewPart v, int orientation) { + super("", AS_RADIO_BUTTON); //$NON-NLS-1$ + if (orientation == CallHierarchyViewPart.VIEW_ORIENTATION_HORIZONTAL) { + setText(CallHierarchyMessages.ToggleOrientationAction_horizontal_label); + setDescription(CallHierarchyMessages.ToggleOrientationAction_horizontal_description); + setToolTipText(CallHierarchyMessages.ToggleOrientationAction_horizontal_tooltip); + JavaPluginImages.setLocalImageDescriptors(this, "th_horizontal.gif"); //$NON-NLS-1$ + } else if (orientation == CallHierarchyViewPart.VIEW_ORIENTATION_VERTICAL) { + setText(CallHierarchyMessages.ToggleOrientationAction_vertical_label); + setDescription(CallHierarchyMessages.ToggleOrientationAction_vertical_description); + setToolTipText(CallHierarchyMessages.ToggleOrientationAction_vertical_tooltip); + JavaPluginImages.setLocalImageDescriptors(this, "th_vertical.gif"); //$NON-NLS-1$ + } else if (orientation == CallHierarchyViewPart.VIEW_ORIENTATION_AUTOMATIC) { + setText(CallHierarchyMessages.ToggleOrientationAction_automatic_label); + setDescription(CallHierarchyMessages.ToggleOrientationAction_automatic_description); + setToolTipText(CallHierarchyMessages.ToggleOrientationAction_automatic_tooltip); + JavaPluginImages.setLocalImageDescriptors(this, "th_automatic.gif"); //$NON-NLS-1$ + } else if (orientation == CallHierarchyViewPart.VIEW_ORIENTATION_SINGLE) { + setText(CallHierarchyMessages.ToggleOrientationAction_single_label); + setDescription(CallHierarchyMessages.ToggleOrientationAction_single_description); + setToolTipText(CallHierarchyMessages.ToggleOrientationAction_single_tooltip); + JavaPluginImages.setLocalImageDescriptors(this, "th_single.gif"); //$NON-NLS-1$ + } else { + Assert.isTrue(false); + } + fView= v; + fActionOrientation= orientation; + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.CALL_HIERARCHY_TOGGLE_ORIENTATION_ACTION); + } + + public int getOrientation() { + return fActionOrientation; + } + + /* + * @see Action#actionPerformed + */ + @Override + public void run() { + if (isChecked()) { + fView.generated_3565091769241228967(this); + fView.computeOrientation(); + } + } + +}