KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > runtime > registry > TogglePropertiesAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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.pde.internal.runtime.registry;
12
13 import org.eclipse.jface.action.*;
14 import org.eclipse.pde.internal.runtime.*;
15
16
17 /**
18  * Action that controls the appearance of the details pane in debug views such
19  * as the VariablesView and the ExpressionsView. Instances of this class can be
20  * created to show the detail pane underneath the main tree, to the right of the
21  * main tree, or not shown at all.
22  *
23  * @since 3.0
24  */

25 public class TogglePropertiesAction extends Action {
26     private RegistryBrowser fViewer;
27     private int fOrientation;
28
29     public TogglePropertiesAction(RegistryBrowser view, int orientation) {
30         super("", AS_RADIO_BUTTON); //$NON-NLS-1$
31
setRegistryBrowser(view);
32         setOrientation(orientation);
33                 
34         if (orientation == RegistryBrowser.VERTICAL_ORIENTATION) {
35             setText(PDERuntimeMessages.RegistryView_verticalOrientation_label); //$NON-NLS-1$
36
setToolTipText(PDERuntimeMessages.RegistryView_verticalOrientation_tooltip); //$NON-NLS-1$
37
setDescription(PDERuntimeMessages.RegistryView_verticalOrientation_desc); //$NON-NLS-1$
38
setImageDescriptor(PDERuntimePluginImages.DESC_VERTICAL_VIEW);
39             setDisabledImageDescriptor(PDERuntimePluginImages.DESC_VERTICAL_VIEW_DISABLED);
40         } else if (orientation == RegistryBrowser.HORIZONTAL_ORIENTATION) {
41             setText(PDERuntimeMessages.RegistryView_horizontalOrientation_label); //$NON-NLS-1$
42
setToolTipText(PDERuntimeMessages.RegistryView_horizontalOrientation_tooltip); //$NON-NLS-1$
43
setDescription(PDERuntimeMessages.RegistryView_horizontalOrientation_desc); //$NON-NLS-1$
44
setImageDescriptor(PDERuntimePluginImages.DESC_HORIZONTAL_VIEW);
45             setDisabledImageDescriptor(PDERuntimePluginImages.DESC_HORIZONTAL_VIEW_DISABLED);
46         } else {
47             setText(PDERuntimeMessages.RegistryView_showPropertiesSheet_label);
48             setToolTipText(PDERuntimeMessages.RegistryView_showPropertiesSheet_tooltip); //$NON-NLS-1$
49
setDescription(PDERuntimeMessages.RegistryView_showPropertiesSheet_desc); //$NON-NLS-1$
50
setImageDescriptor(PDERuntimePluginImages.DESC_HIDE_PANE);
51         }
52
53     }
54
55     /* (non-Javadoc)
56      * @see org.eclipse.jface.action.IAction#run()
57      */

58     public void run() { // called when menu pressed
59
getRegistryBrowser().setViewOrientation(getOrientation());
60     }
61     
62     private RegistryBrowser getRegistryBrowser() {
63         return fViewer;
64     }
65
66     private void setRegistryBrowser(RegistryBrowser view) {
67         fViewer = view;
68     }
69
70     private void setOrientation(int orientation) {
71         fOrientation = orientation;
72     }
73
74     public int getOrientation() {
75         return fOrientation;
76     }
77 }
78
79
Popular Tags