1 11 package org.eclipse.pde.internal.ui.wizards; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.jface.dialogs.MessageDialog; 15 import org.eclipse.jface.wizard.IWizard; 16 import org.eclipse.jface.wizard.IWizardNode; 17 import org.eclipse.jface.wizard.WizardSelectionPage; 18 import org.eclipse.pde.internal.ui.PDEUIMessages; 19 import org.eclipse.pde.ui.IBasePluginWizard; 20 import org.eclipse.swt.graphics.Point; 21 22 public abstract class WizardNode implements IWizardNode { 23 private IWizard wizard; 24 private WizardSelectionPage parentWizardPage; 25 protected WizardElement wizardElement; 26 27 public WizardNode(WizardSelectionPage parentPage, WizardElement element) { 28 parentWizardPage = parentPage; 29 wizardElement = element; 30 } 31 protected abstract IBasePluginWizard createWizard() throws CoreException; 32 public void dispose() { 33 if (wizard != null) { 34 wizard.dispose(); 35 wizard = null; 36 } 37 } 38 public WizardElement getElement() { 39 return wizardElement; 40 } 41 public Point getExtent() { 42 return new Point(-1, -1); 43 } 44 public IWizard getWizard() { 45 if (wizard != null) 46 return wizard; 48 IBasePluginWizard pluginWizard; 49 try { 50 pluginWizard = createWizard(); } catch (CoreException e) { 52 if (parentWizardPage instanceof BaseWizardSelectionPage) 53 ((BaseWizardSelectionPage)parentWizardPage).setDescriptionText(""); parentWizardPage.setErrorMessage(PDEUIMessages.Errors_CreationError_NoWizard); 55 MessageDialog.openError( 56 parentWizardPage.getWizard().getContainer().getShell(), 57 PDEUIMessages.Errors_CreationError, 58 PDEUIMessages.Errors_CreationError_NoWizard); 59 return null; 60 } 61 wizard = pluginWizard; 62 return wizard; 64 } 65 public boolean isContentCreated() { 66 return wizard != null; 67 } 68 } 69 | Popular Tags |