1 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) { 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) { 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 |