01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor.plugin;
11:
12: import org.eclipse.pde.core.plugin.IPluginModelBase;
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.ui.PlatformUI;
21: import org.eclipse.ui.forms.IManagedForm;
22: import org.eclipse.ui.forms.editor.FormEditor;
23: import org.eclipse.ui.forms.widgets.ScrolledForm;
24:
25: public class RuntimePage extends PDEFormPage {
26: public static final String PAGE_ID = "runtime"; //$NON-NLS-1$
27:
28: public RuntimePage(FormEditor editor) {
29: super (editor, PAGE_ID, PDEUIMessages.RuntimePage_tabName);
30: }
31:
32: /* (non-Javadoc)
33: * @see org.eclipse.pde.internal.ui.editor.PDEFormPage#getHelpResource()
34: */
35: protected String getHelpResource() {
36: return IPDEUIConstants.PLUGIN_DOC_ROOT
37: + "guide/tools/editors/manifest_editor/runtime.htm"; //$NON-NLS-1$
38: }
39:
40: protected void createFormContent(IManagedForm mform) {
41: super .createFormContent(mform);
42: ScrolledForm form = mform.getForm();
43: form.setImage(PDEPlugin.getDefault().getLabelProvider().get(
44: PDEPluginImages.DESC_JAVA_LIB_OBJ));
45: form.setText(PDEUIMessages.ManifestEditor_RuntimeForm_title);
46: form.getBody().setLayout(
47: FormLayoutFactory.createFormGridLayout(false, 2));
48:
49: if (isBundle()) {
50: mform
51: .addPart(new ExportPackageSection(this , form
52: .getBody()));
53: if (((ManifestEditor) getEditor()).isEquinox())
54: mform.addPart(new ExportPackageVisibilitySection(this ,
55: form.getBody()));
56: mform.addPart(new LibrarySection(this , form.getBody()));
57: } else {
58: // No MANIFEST.MF (not a Bundle)
59: // Create a new plug-in project targeted for 3.0 using the hello
60: // world template to see this section (no MANIFEST.MF is created)
61: mform.addPart(new LibrarySection(this , form.getBody()));
62: mform.addPart(new LibraryVisibilitySection(this , form
63: .getBody()));
64: }
65:
66: if (((IPluginModelBase) getPDEEditor().getAggregateModel())
67: .isFragmentModel())
68: PlatformUI.getWorkbench().getHelpSystem().setHelp(
69: form.getBody(),
70: IHelpContextIds.MANIFEST_FRAGMENT_RUNTIME);
71: else
72: PlatformUI.getWorkbench().getHelpSystem().setHelp(
73: form.getBody(),
74: IHelpContextIds.MANIFEST_PLUGIN_RUNTIME);
75: }
76:
77: private boolean isBundle() {
78: return getPDEEditor().getContextManager().findContext(
79: BundleInputContext.CONTEXT_ID) != null;
80: }
81:
82: }
|