01: /*******************************************************************************
02: * Copyright (c) 2003, 2006 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.build.IBuildEntry;
13: import org.eclipse.pde.core.plugin.IPluginBase;
14: import org.eclipse.pde.core.plugin.IPluginExtension;
15: import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
16: import org.eclipse.pde.core.plugin.IPluginImport;
17: import org.eclipse.pde.core.plugin.IPluginLibrary;
18: import org.eclipse.pde.core.plugin.IPluginModelBase;
19: import org.eclipse.pde.internal.core.text.bundle.ExportPackageObject;
20: import org.eclipse.pde.internal.core.text.bundle.ImportPackageObject;
21: import org.eclipse.pde.internal.core.text.bundle.PackageFriend;
22: import org.eclipse.pde.internal.ui.editor.FormOutlinePage;
23: import org.eclipse.pde.internal.ui.editor.PDEFormEditor;
24: import org.eclipse.pde.internal.ui.editor.PDEFormPage;
25: import org.eclipse.pde.internal.ui.editor.build.BuildPage;
26:
27: public class ManifestOutlinePage extends FormOutlinePage {
28: /**
29: * @param editor
30: */
31: public ManifestOutlinePage(PDEFormEditor editor) {
32: super (editor);
33: }
34:
35: protected Object[] getChildren(Object parent) {
36: if (parent instanceof PDEFormPage) {
37: PDEFormPage page = (PDEFormPage) parent;
38: IPluginModelBase model = (IPluginModelBase) page.getModel();
39: if (model != null && model.isValid()) {
40: IPluginBase pluginBase = model.getPluginBase();
41: if (page.getId().equals(DependenciesPage.PAGE_ID))
42: return pluginBase.getImports();
43: if (page.getId().equals(RuntimePage.PAGE_ID))
44: return pluginBase.getLibraries();
45: if (page.getId().equals(ExtensionsPage.PAGE_ID))
46: return pluginBase.getExtensions();
47: if (page.getId().equals(ExtensionPointsPage.PAGE_ID))
48: return pluginBase.getExtensionPoints();
49: }
50: }
51: return new Object[0];
52: }
53:
54: protected String getParentPageId(Object item) {
55: String pageId = null;
56: if (item instanceof IPluginImport
57: || item instanceof ImportPackageObject)
58: pageId = DependenciesPage.PAGE_ID;
59: else if (item instanceof IPluginLibrary
60: || item instanceof ExportPackageObject
61: || item instanceof PackageFriend)
62: pageId = RuntimePage.PAGE_ID;
63: else if (item instanceof IPluginExtension)
64: pageId = ExtensionsPage.PAGE_ID;
65: else if (item instanceof IPluginExtensionPoint)
66: pageId = ExtensionPointsPage.PAGE_ID;
67: else if (item instanceof IBuildEntry)
68: pageId = BuildPage.PAGE_ID;
69: if (pageId != null)
70: return pageId;
71: return super.getParentPageId(item);
72: }
73: }
|