01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor;
11:
12: import org.eclipse.jface.action.Action;
13: import org.eclipse.jface.action.IAction;
14: import org.eclipse.pde.internal.ui.PDEPluginImages;
15: import org.eclipse.pde.internal.ui.PDEUIMessages;
16: import org.eclipse.swt.SWT;
17: import org.eclipse.ui.forms.IManagedForm;
18: import org.eclipse.ui.forms.widgets.ScrolledForm;
19:
20: public abstract class OrientableBlock extends PDEMasterDetailsBlock {
21:
22: public OrientableBlock(PDEFormPage page) {
23: super (page);
24: }
25:
26: protected void createToolBarActions(IManagedForm managedForm) {
27: final ScrolledForm form = managedForm.getForm();
28:
29: Action haction = new Action("hor", IAction.AS_RADIO_BUTTON) { //$NON-NLS-1$
30: public void run() {
31: sashForm.setOrientation(SWT.HORIZONTAL);
32: form.reflow(true);
33: }
34: };
35: haction.setChecked(true);
36: haction.setToolTipText(PDEUIMessages.DetailsBlock_horizontal);
37: haction.setImageDescriptor(PDEPluginImages.DESC_HORIZONTAL);
38: haction
39: .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
51: .setDisabledImageDescriptor(PDEPluginImages.DESC_VERTICAL_DISABLED);
52: form.getToolBarManager().add(haction);
53: form.getToolBarManager().add(vaction);
54: }
55: }
|