1 11 package org.eclipse.pde.internal.ui.editor.product; 12 13 import org.eclipse.pde.internal.ui.IHelpContextIds; 14 import org.eclipse.pde.internal.ui.IPDEUIConstants; 15 import org.eclipse.pde.internal.ui.PDEPlugin; 16 import org.eclipse.pde.internal.ui.PDEPluginImages; 17 import org.eclipse.pde.internal.ui.PDEUIMessages; 18 import org.eclipse.pde.internal.ui.editor.FormLayoutFactory; 19 import org.eclipse.pde.internal.ui.editor.PDEFormPage; 20 import org.eclipse.swt.widgets.Composite; 21 import org.eclipse.ui.PlatformUI; 22 import org.eclipse.ui.forms.IManagedForm; 23 import org.eclipse.ui.forms.editor.FormEditor; 24 import org.eclipse.ui.forms.widgets.FormToolkit; 25 import org.eclipse.ui.forms.widgets.ScrolledForm; 26 27 28 public class ConfigurationPage extends PDEFormPage { 29 30 public static final String PLUGIN_ID = "plugin-configuration"; public static final String FEATURE_ID = "feature-configuration"; 33 private boolean fUseFeatures; 34 private PluginSection fPluginSection = null; 35 36 public ConfigurationPage(FormEditor editor, boolean useFeatures) { 37 super(editor, useFeatures ? FEATURE_ID : PLUGIN_ID, PDEUIMessages.Product_ConfigurationPage_title); 38 fUseFeatures = useFeatures; 39 } 40 41 44 protected String getHelpResource() { 45 return IPDEUIConstants.PLUGIN_DOC_ROOT + "guide/tools/editors/product_editor/configuration.htm"; } 47 48 51 protected void createFormContent(IManagedForm managedForm) { 52 super.createFormContent(managedForm); 53 ScrolledForm form = managedForm.getForm(); 54 FormToolkit toolkit = managedForm.getToolkit(); 55 form.setImage(PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_FEATURE_OBJ)); 56 form.setText(PDEUIMessages.Product_ConfigurationPage_title); 57 fillBody(managedForm, toolkit); 58 PlatformUI.getWorkbench().getHelpSystem().setHelp(form.getBody(), IHelpContextIds.CONFIGURATION_PAGE); 59 } 60 61 private void fillBody(IManagedForm managedForm, FormToolkit toolkit) { 62 Composite body = managedForm.getForm().getBody(); 63 body.setLayout(FormLayoutFactory.createFormGridLayout(false, 1)); 64 65 if (fUseFeatures) 67 managedForm.addPart(new FeatureSection(this, body)); 68 else 69 managedForm.addPart(fPluginSection = new PluginSection(this, body)); 70 managedForm.addPart(new ConfigurationSection(this, body)); 71 } 72 73 public boolean includeOptionalDependencies() { 74 return (fPluginSection != null) ? fPluginSection.includeOptionalDependencies(): false; 75 } 76 } 77 | Popular Tags |