1 package org.simantics.views.swt;
3 import org.eclipse.core.runtime.CoreException;
4 import org.eclipse.core.runtime.IConfigurationElement;
5 import org.eclipse.core.runtime.IExecutableExtension;
6 import org.eclipse.core.runtime.IExecutableExtensionFactory;
7 import org.eclipse.core.runtime.IStatus;
8 import org.eclipse.core.runtime.Status;
12 * @author Antti Villberg
14 public class WizardFactory implements IExecutableExtensionFactory, IExecutableExtension {
16 private IConfigurationElement config;
20 private String propertyName;
22 public WizardFactory() {
26 private Object configure(Object obj) throws CoreException {
27 if (obj instanceof IExecutableExtension) {
28 ((IExecutableExtension) obj).setInitializationData(config, propertyName, null);
34 public Object create() throws CoreException {
36 return configure(new ModelledWizard(id));
41 public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
42 throws CoreException {
43 //System.out.println("setInitializationData: " + config + ", " + propertyName + ", " + data);
45 if (data instanceof String) {
48 throw new CoreException(new Status(IStatus.ERROR,
49 Activator.PLUGIN_ID, 0,
50 "Data argument must be a String for " + getClass(), null)); //$NON-NLS-1$
53 this.propertyName = propertyName;