KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > plugin > ManifestOutlinePage


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 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.plugin;
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     protected Object JavaDoc[] getChildren(Object JavaDoc parent) {
35         if (parent instanceof PDEFormPage) {
36             PDEFormPage page = (PDEFormPage) parent;
37             IPluginModelBase model = (IPluginModelBase) page.getModel();
38             if (model != null && model.isValid()) {
39                 IPluginBase pluginBase = model.getPluginBase();
40                 if (page.getId().equals(DependenciesPage.PAGE_ID))
41                     return pluginBase.getImports();
42                 if (page.getId().equals(RuntimePage.PAGE_ID))
43                     return pluginBase.getLibraries();
44                 if (page.getId().equals(ExtensionsPage.PAGE_ID))
45                     return pluginBase.getExtensions();
46                 if (page.getId().equals(ExtensionPointsPage.PAGE_ID))
47                     return pluginBase.getExtensionPoints();
48             }
49         }
50         return new Object JavaDoc[0];
51     }
52     protected String JavaDoc getParentPageId(Object JavaDoc item) {
53         String JavaDoc pageId = null;
54         if (item instanceof IPluginImport || item instanceof ImportPackageObject)
55             pageId = DependenciesPage.PAGE_ID;
56         else if (item instanceof IPluginLibrary
57                 || item instanceof ExportPackageObject
58                 || item instanceof PackageFriend)
59             pageId = RuntimePage.PAGE_ID;
60         else if (item instanceof IPluginExtension)
61             pageId = ExtensionsPage.PAGE_ID;
62         else if (item instanceof IPluginExtensionPoint)
63             pageId = ExtensionPointsPage.PAGE_ID;
64         else if (item instanceof IBuildEntry)
65             pageId = BuildPage.PAGE_ID;
66         if (pageId != null)
67             return pageId;
68         return super.getParentPageId(item);
69     }
70 }
71
Popular Tags