KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > actions > ToggleDetailPaneAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.actions;
12
13 import org.eclipse.debug.internal.ui.DebugPluginImages;
14 import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
15 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
16 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
17 import org.eclipse.debug.internal.ui.views.variables.VariablesView;
18 import org.eclipse.debug.ui.IDebugUIConstants;
19 import org.eclipse.jface.action.Action;
20 import org.eclipse.ui.PlatformUI;
21
22 /**
23  * Action that controls the appearance of the details pane in debug views such
24  * as the VariablesView and the ExpressionsView. Instances of this class can be
25  * created to show the detail pane underneath the main tree, to the right of the
26  * main tree, or not shown at all.
27  *
28  * @since 3.0
29  */

30 public class ToggleDetailPaneAction extends Action {
31
32     private VariablesView fVariablesView;
33     
34     private String JavaDoc fOrientation;
35
36     public ToggleDetailPaneAction(VariablesView view, String JavaDoc orientation, String JavaDoc hiddenLabel) {
37         super("", AS_RADIO_BUTTON); //$NON-NLS-1$
38
setVariablesView(view);
39         setOrientation(orientation);
40                 
41         if (orientation == IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_UNDERNEATH) {
42             setText(ActionMessages.ToggleDetailPaneAction_1); //$NON-NLS-1$
43
setToolTipText(ActionMessages.ToggleDetailPaneAction_2); //$NON-NLS-1$
44
setDescription(ActionMessages.ToggleDetailPaneAction_3); //$NON-NLS-1$
45
setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DETAIL_PANE_UNDER));
46             setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DETAIL_PANE_UNDER));
47             setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DETAIL_PANE_UNDER));
48         } else if (orientation == IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_RIGHT) {
49             setText(ActionMessages.ToggleDetailPaneAction_4); //$NON-NLS-1$
50
setToolTipText(ActionMessages.ToggleDetailPaneAction_5); //$NON-NLS-1$
51
setDescription(ActionMessages.ToggleDetailPaneAction_6); //$NON-NLS-1$
52
setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DETAIL_PANE_RIGHT));
53             setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DETAIL_PANE_RIGHT));
54             setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DETAIL_PANE_RIGHT));
55         } else {
56             setText(hiddenLabel);
57             setToolTipText(ActionMessages.ToggleDetailPaneAction_8); //$NON-NLS-1$
58
setDescription(ActionMessages.ToggleDetailPaneAction_9); //$NON-NLS-1$
59
setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DETAIL_PANE_HIDE));
60             setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DETAIL_PANE_HIDE));
61             setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DETAIL_PANE_HIDE));
62         }
63         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.SHOW_DETAIL_PANE_ACTION);
64     }
65
66     /* (non-Javadoc)
67      * @see org.eclipse.jface.action.IAction#run()
68      */

69     public void run() {
70         getVariablesView().setDetailPaneOrientation(getOrientation());
71     }
72     
73     private VariablesView getVariablesView() {
74         return fVariablesView;
75     }
76
77     private void setVariablesView(VariablesView variablesView) {
78         fVariablesView = variablesView;
79     }
80
81     private void setOrientation(String JavaDoc orientation) {
82         fOrientation = orientation;
83     }
84
85     public String JavaDoc getOrientation() {
86         return fOrientation;
87     }
88 }
89
90
Popular Tags