KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > extension > ExtensionEditorSelectionPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.wizards.extension;
12
13 import org.eclipse.core.resources.IProject;
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.jface.viewers.IStructuredSelection;
16 import org.eclipse.jface.wizard.IWizardNode;
17 import org.eclipse.pde.core.plugin.IPluginBase;
18 import org.eclipse.pde.internal.ui.PDEUIMessages;
19 import org.eclipse.pde.internal.ui.elements.ElementList;
20 import org.eclipse.pde.internal.ui.wizards.WizardElement;
21 import org.eclipse.pde.internal.ui.wizards.WizardListSelectionPage;
22 import org.eclipse.pde.internal.ui.wizards.WizardNode;
23 import org.eclipse.pde.ui.IBasePluginWizard;
24 import org.eclipse.pde.ui.IExtensionEditorWizard;
25
26 /**
27  *
28  */

29 public class ExtensionEditorSelectionPage extends WizardListSelectionPage {
30     private IProject fProject;
31     private IPluginBase fPluginBase;
32     private IStructuredSelection fSelection;
33     /**
34      * @param categories
35      * @param baseCategory
36      * @param message
37      */

38     public ExtensionEditorSelectionPage(ElementList wizards) {
39         super(wizards, PDEUIMessages.ExtensionEditorSelectionPage_message);
40         setTitle(PDEUIMessages.ExtensionEditorSelectionPage_title);
41         setDescription(PDEUIMessages.ExtensionEditorSelectionPage_desc);
42     }
43     public void init(IProject project, IPluginBase pluginBase, IStructuredSelection selection) {
44         this.fProject = project;
45         this.fPluginBase = pluginBase;
46         this.fSelection = selection;
47     }
48     protected IWizardNode createWizardNode(WizardElement element) {
49         return new WizardNode(this, element) {
50             public IBasePluginWizard createWizard() throws CoreException {
51                 IExtensionEditorWizard wizard = createWizard(wizardElement);
52                 wizard.init(fProject, fPluginBase.getPluginModel(), fSelection);
53                 return wizard;
54             }
55             protected IExtensionEditorWizard createWizard(WizardElement element)
56                 throws CoreException {
57                 return (IExtensionEditorWizard) element.createExecutableExtension();
58             }
59         };
60     }
61 }
62
Popular Tags