KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > OrientableBlock


1 /*******************************************************************************
2  * Copyright (c) 2006 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.ui.editor;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.action.IAction;
15 import org.eclipse.pde.internal.ui.PDEPluginImages;
16 import org.eclipse.pde.internal.ui.PDEUIMessages;
17 import org.eclipse.swt.SWT;
18 import org.eclipse.ui.forms.IManagedForm;
19 import org.eclipse.ui.forms.widgets.ScrolledForm;
20
21 public abstract class OrientableBlock extends PDEMasterDetailsBlock {
22
23     public OrientableBlock(PDEFormPage page) {
24         super(page);
25     }
26
27     protected void createToolBarActions(IManagedForm managedForm) {
28         final ScrolledForm form = managedForm.getForm();
29
30         Action haction = new Action("hor", IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$
31
public void run() {
32                 sashForm.setOrientation(SWT.HORIZONTAL);
33                 form.reflow(true);
34             }
35         };
36         haction.setChecked(true);
37         haction.setToolTipText(PDEUIMessages.DetailsBlock_horizontal);
38         haction.setImageDescriptor(PDEPluginImages.DESC_HORIZONTAL);
39         haction.setDisabledImageDescriptor(PDEPluginImages.DESC_HORIZONTAL_DISABLED);
40
41         Action vaction = new Action("ver", IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$
42
public void run() {
43                 sashForm.setOrientation(SWT.VERTICAL);
44                 form.reflow(true);
45             }
46         };
47         vaction.setChecked(false);
48         vaction.setToolTipText(PDEUIMessages.DetailsBlock_vertical);
49         vaction.setImageDescriptor(PDEPluginImages.DESC_VERTICAL);
50         vaction.setDisabledImageDescriptor(PDEPluginImages.DESC_VERTICAL_DISABLED);
51         form.getToolBarManager().add(haction);
52         form.getToolBarManager().add(vaction);
53     }
54 }
Popular Tags