KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > memory > ViewPaneOrientationAction


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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.views.memory;
12
13 import org.eclipse.debug.internal.ui.DebugPluginImages;
14 import org.eclipse.debug.internal.ui.DebugUIMessages;
15 import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
16 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
17 import org.eclipse.debug.ui.IDebugUIConstants;
18 import org.eclipse.jface.action.Action;
19 import org.eclipse.ui.PlatformUI;
20
21 class ViewPaneOrientationAction extends Action
22 {
23         private MemoryView fView;
24         private int fOrientation;
25
26         ViewPaneOrientationAction(MemoryView view, int orientation)
27         {
28             super("", AS_RADIO_BUTTON); //$NON-NLS-1$
29
fView = view;
30             fOrientation = orientation;
31             
32             if (orientation == MemoryView.HORIZONTAL_VIEW_ORIENTATION) {
33                 setText(DebugUIMessages.ViewPaneOrientationAction_0);
34                 setToolTipText(DebugUIMessages.ViewPaneOrientationAction_1);
35                 setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DETAIL_PANE_RIGHT));
36                 setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DETAIL_PANE_RIGHT));
37                 setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DETAIL_PANE_RIGHT));
38             } else if (orientation == MemoryView.VERTICAL_VIEW_ORIENTATION) {
39                 setText(DebugUIMessages.ViewPaneOrientationAction_2);
40                 setToolTipText(DebugUIMessages.ViewPaneOrientationAction_3);
41                 setImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_DETAIL_PANE_UNDER));
42                 setDisabledImageDescriptor(DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_DETAIL_PANE_UNDER));
43                 setHoverImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_LCL_DETAIL_PANE_UNDER));
44             }
45             PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.MEMORY_VIEW_PANE_ORIENTATION_ACTION);
46         }
47
48         public void run() {
49             fView.setViewPanesOrientation(fOrientation);
50         }
51         
52         public int getOrientation()
53         {
54             return fOrientation;
55         }
56     }
57
Popular Tags