KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > feature > FeatureDependenciesPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.feature;
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.PDEFormEditor;
20 import org.eclipse.pde.internal.ui.editor.PDEFormPage;
21 import org.eclipse.pde.internal.ui.editor.plugin.MatchSection;
22 import org.eclipse.swt.layout.GridData;
23 import org.eclipse.swt.widgets.Composite;
24 import org.eclipse.ui.PlatformUI;
25 import org.eclipse.ui.forms.IManagedForm;
26 import org.eclipse.ui.forms.widgets.FormToolkit;
27 import org.eclipse.ui.forms.widgets.ScrolledForm;
28
29 /**
30  *
31  */

32 public class FeatureDependenciesPage extends PDEFormPage {
33     public static final String JavaDoc PAGE_ID = "dependencies"; //$NON-NLS-1$
34

35     private RequiresSection fRequiresSection;
36
37     private MatchSection fMatchSection;
38
39     /**
40      *
41      * @param editor
42      * @param title
43      */

44     public FeatureDependenciesPage(PDEFormEditor editor, String JavaDoc title) {
45         super(editor, PAGE_ID, title);
46     }
47
48     /* (non-Javadoc)
49      * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#getHelpResource()
50      */

51     protected String JavaDoc getHelpResource() {
52         return IPDEUIConstants.PLUGIN_DOC_ROOT + "guide/tools/editors/feature_editor/dependencies.htm"; //$NON-NLS-1$
53
}
54     
55     protected void createFormContent(IManagedForm managedForm) {
56         ScrolledForm form = managedForm.getForm();
57         FormToolkit toolkit = managedForm.getToolkit();
58         form.getBody().setLayout(FormLayoutFactory.createFormGridLayout(true, 2));
59
60         // Set form header image
61
form.setImage(PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_REQ_PLUGINS_OBJ));
62         
63         GridData gd;
64
65         Composite left = toolkit.createComposite(form.getBody());
66         left.setLayout(FormLayoutFactory.createFormPaneGridLayout(false, 1));
67         gd = new GridData(GridData.FILL_BOTH);
68         left.setLayoutData(gd);
69
70         Composite right = toolkit.createComposite(form.getBody());
71         right.setLayout(FormLayoutFactory.createFormPaneGridLayout(false, 1));
72         gd = new GridData(GridData.FILL_BOTH);
73         right.setLayoutData(gd);
74
75         fRequiresSection = new RequiresSection(this, left);
76         fMatchSection = new MatchSection(this, right, false);
77         gd = new GridData(GridData.FILL_HORIZONTAL);
78         fMatchSection.getSection().setLayoutData(gd);
79         
80         // Align the master and details section headers (misalignment caused
81
// by section toolbar icons)
82
alignSectionHeaders(fRequiresSection.getSection(),
83                 fMatchSection.getSection());
84         
85         managedForm.addPart(fRequiresSection);
86         managedForm.addPart(fMatchSection);
87         PlatformUI.getWorkbench().getHelpSystem().setHelp(form.getBody(),IHelpContextIds.MANIFEST_FEATURE_DEPENDENCIES);
88         initialize();
89         fRequiresSection.fireSelection();
90         super.createFormContent(managedForm);
91     }
92
93     public void initialize() {
94         getManagedForm().getForm().setText(
95                 PDEUIMessages.FeatureEditor_DependenciesPage_heading);
96     }
97 }
98
Popular Tags