01: /*******************************************************************************
02: * Copyright (c) 2000, 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.wizards.extension;
11:
12: import org.eclipse.core.resources.IProject;
13: import org.eclipse.core.runtime.CoreException;
14: import org.eclipse.jface.viewers.IStructuredSelection;
15: import org.eclipse.jface.wizard.IWizardNode;
16: import org.eclipse.pde.core.plugin.IPluginBase;
17: import org.eclipse.pde.internal.ui.PDEUIMessages;
18: import org.eclipse.pde.internal.ui.elements.ElementList;
19: import org.eclipse.pde.internal.ui.wizards.WizardElement;
20: import org.eclipse.pde.internal.ui.wizards.WizardListSelectionPage;
21: import org.eclipse.pde.internal.ui.wizards.WizardNode;
22: import org.eclipse.pde.ui.IBasePluginWizard;
23: import org.eclipse.pde.ui.IExtensionEditorWizard;
24:
25: /**
26: *
27: */
28: public class ExtensionEditorSelectionPage extends
29: WizardListSelectionPage {
30: private IProject fProject;
31: private IPluginBase fPluginBase;
32: private IStructuredSelection fSelection;
33:
34: /**
35: * @param categories
36: * @param baseCategory
37: * @param message
38: */
39: public ExtensionEditorSelectionPage(ElementList wizards) {
40: super (wizards,
41: PDEUIMessages.ExtensionEditorSelectionPage_message);
42: setTitle(PDEUIMessages.ExtensionEditorSelectionPage_title);
43: setDescription(PDEUIMessages.ExtensionEditorSelectionPage_desc);
44: }
45:
46: public void init(IProject project, IPluginBase pluginBase,
47: IStructuredSelection selection) {
48: this .fProject = project;
49: this .fPluginBase = pluginBase;
50: this .fSelection = selection;
51: }
52:
53: protected IWizardNode createWizardNode(WizardElement element) {
54: return new WizardNode(this , element) {
55: public IBasePluginWizard createWizard()
56: throws CoreException {
57: IExtensionEditorWizard wizard = createWizard(wizardElement);
58: wizard.init(fProject, fPluginBase.getPluginModel(),
59: fSelection);
60: return wizard;
61: }
62:
63: protected IExtensionEditorWizard createWizard(
64: WizardElement element) throws CoreException {
65: return (IExtensionEditorWizard) element
66: .createExecutableExtension();
67: }
68: };
69: }
70: }
|