KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > actions > variables > 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.variables;
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.actions.ActionMessages;
17 import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
18 import org.eclipse.debug.internal.ui.views.variables.VariablesView;
19 import org.eclipse.debug.ui.IDebugUIConstants;
20 import org.eclipse.jface.action.Action;
21 import org.eclipse.ui.PlatformUI;
22
23 /**
24  * Action that controls the appearance of the details pane in debug views such
25  * as the VariablesView and the ExpressionsView. Instances of this class can be
26  * created to show the detail pane underneath the main tree, to the right of the
27  * main tree, or not shown at all.
28  *
29  * @since 3.0
30  */

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

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