| //------------------------------------------------------------------------------ |
| // Copyright (c) 2005, 2007 IBM Corporation and others. |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // which accompanies this distribution, and is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| // |
| // Contributors: |
| // IBM Corporation - initial implementation |
| //------------------------------------------------------------------------------ |
| package org.eclipse.epf.authoring.ui.wizards; |
| |
| import org.eclipse.core.runtime.CoreException; |
| import org.eclipse.epf.authoring.ui.AuthoringUIPlugin; |
| import org.eclipse.epf.library.edit.util.ExtensionManager; |
| import org.eclipse.ui.IWorkbenchWizard; |
| import org.eclipse.ui.PlatformUI; |
| import org.eclipse.ui.wizards.IWizardDescriptor; |
| |
| /** |
| * @author Phong Nguyen Le |
| * |
| * @since 1.2 |
| */ |
| public class WizardHelper { |
| private static IWizardRegistry wizardRegistry; |
| |
| public static final IWizardRegistry getWizardRegistry() { |
| if(wizardRegistry == null) { |
| wizardRegistry = (IWizardRegistry) ExtensionManager.getExtension(AuthoringUIPlugin.getDefault().getId(), "wizardRegistryProvider"); //$NON-NLS-1$ |
| } |
| return wizardRegistry; |
| } |
| |
| public static final IWorkbenchWizard createNewWizard(String newWizardId) throws CoreException { |
| IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(newWizardId); |
| if(descriptor != null) { |
| return descriptor.createWizard(); |
| } |
| return null; |
| } |
| } |