KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > product > ConfigurationPage


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.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 JavaDoc PLUGIN_ID = "plugin-configuration"; //$NON-NLS-1$
31
public static final String JavaDoc FEATURE_ID = "feature-configuration"; //$NON-NLS-1$
32

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     /* (non-Javadoc)
42      * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#getHelpResource()
43      */

44     protected String JavaDoc getHelpResource() {
45         return IPDEUIConstants.PLUGIN_DOC_ROOT + "guide/tools/editors/product_editor/configuration.htm"; //$NON-NLS-1$
46
}
47     
48     /* (non-Javadoc)
49      * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#createFormContent(org.eclipse.ui.forms.IManagedForm)
50      */

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         // sections
66
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