001: /*******************************************************************************
002: * Copyright (c) 2000, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.pde.internal.ui.editor.feature;
011:
012: import org.eclipse.pde.internal.ui.IHelpContextIds;
013: import org.eclipse.pde.internal.ui.IPDEUIConstants;
014: import org.eclipse.pde.internal.ui.PDEPlugin;
015: import org.eclipse.pde.internal.ui.PDEPluginImages;
016: import org.eclipse.pde.internal.ui.PDEUIMessages;
017: import org.eclipse.pde.internal.ui.editor.FormLayoutFactory;
018: import org.eclipse.pde.internal.ui.editor.PDEFormEditor;
019: import org.eclipse.pde.internal.ui.editor.PDEFormPage;
020: import org.eclipse.pde.internal.ui.editor.plugin.MatchSection;
021: import org.eclipse.swt.layout.GridData;
022: import org.eclipse.swt.widgets.Composite;
023: import org.eclipse.ui.PlatformUI;
024: import org.eclipse.ui.forms.IManagedForm;
025: import org.eclipse.ui.forms.widgets.FormToolkit;
026: import org.eclipse.ui.forms.widgets.ScrolledForm;
027:
028: /**
029: *
030: */
031: public class FeatureDependenciesPage extends PDEFormPage {
032: public static final String PAGE_ID = "dependencies"; //$NON-NLS-1$
033:
034: private RequiresSection fRequiresSection;
035:
036: private MatchSection fMatchSection;
037:
038: /**
039: *
040: * @param editor
041: * @param title
042: */
043: public FeatureDependenciesPage(PDEFormEditor editor, String title) {
044: super (editor, PAGE_ID, title);
045: }
046:
047: /* (non-Javadoc)
048: * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#getHelpResource()
049: */
050: protected String getHelpResource() {
051: return IPDEUIConstants.PLUGIN_DOC_ROOT
052: + "guide/tools/editors/feature_editor/dependencies.htm"; //$NON-NLS-1$
053: }
054:
055: protected void createFormContent(IManagedForm managedForm) {
056: ScrolledForm form = managedForm.getForm();
057: FormToolkit toolkit = managedForm.getToolkit();
058: form.getBody().setLayout(
059: FormLayoutFactory.createFormGridLayout(true, 2));
060:
061: // Set form header image
062: form.setImage(PDEPlugin.getDefault().getLabelProvider().get(
063: PDEPluginImages.DESC_REQ_PLUGINS_OBJ));
064:
065: GridData gd;
066:
067: Composite left = toolkit.createComposite(form.getBody());
068: left.setLayout(FormLayoutFactory.createFormPaneGridLayout(
069: false, 1));
070: gd = new GridData(GridData.FILL_BOTH);
071: left.setLayoutData(gd);
072:
073: Composite right = toolkit.createComposite(form.getBody());
074: right.setLayout(FormLayoutFactory.createFormPaneGridLayout(
075: false, 1));
076: gd = new GridData(GridData.FILL_BOTH);
077: right.setLayoutData(gd);
078:
079: fRequiresSection = new RequiresSection(this , left);
080: fMatchSection = new MatchSection(this , right, false);
081: gd = new GridData(GridData.FILL_HORIZONTAL);
082: fMatchSection.getSection().setLayoutData(gd);
083:
084: // Align the master and details section headers (misalignment caused
085: // by section toolbar icons)
086: alignSectionHeaders(fRequiresSection.getSection(),
087: fMatchSection.getSection());
088:
089: managedForm.addPart(fRequiresSection);
090: managedForm.addPart(fMatchSection);
091: PlatformUI.getWorkbench().getHelpSystem().setHelp(
092: form.getBody(),
093: IHelpContextIds.MANIFEST_FEATURE_DEPENDENCIES);
094: initialize();
095: fRequiresSection.fireSelection();
096: super .createFormContent(managedForm);
097: }
098:
099: public void initialize() {
100: getManagedForm().getForm().setText(
101: PDEUIMessages.FeatureEditor_DependenciesPage_heading);
102: }
103: }
|