/** * Copyright (c) 2014 committers of YAKINDU 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: * committers of YAKINDU - initial API and implementation * */ package org.yakindu.sct.ui.intro; import java.util.Properties; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.wizard.IWizard; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.intro.IIntroSite; import org.eclipse.ui.intro.config.IIntroAction; import org.eclipse.ui.wizards.IWizardDescriptor; /** * * @author Florian Antony * */ public class OpenExampleIntroAction implements IIntroAction { private final String TRAFFICLIGHT_EXAMPLE_WIZARD = "org.yakindu.sct.examples.ui.wizards.ExampleWizard"; @Override public void run(IIntroSite site, Properties params) { openWizard(TRAFFICLIGHT_EXAMPLE_WIZARD); } public void openWizard(String id) { IWizardDescriptor descriptor = PlatformUI.getWorkbench() .getNewWizardRegistry().findWizard(id); if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry() .findWizard(id); } if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry() .findWizard(id); } try { if (descriptor != null) { IWizard wizard = descriptor.createWizard(); WizardDialog wd = new WizardDialog(Display.getDefault() .getActiveShell(), wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } } catch (CoreException e) { e.printStackTrace(); } } }