-/*******************************************************************************\r
- * Copyright (c) 2012 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.modeling.ui.sharedontology.wizard;\r
-\r
-import org.eclipse.core.runtime.CoreException;\r
-import org.eclipse.core.runtime.IConfigurationElement;\r
-import org.eclipse.core.runtime.IExecutableExtension;\r
-import org.eclipse.core.runtime.IExecutableExtensionFactory;\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.core.runtime.Status;\r
-import org.simantics.modeling.ui.Activator;\r
-\r
-/**\r
- * A factory for diagram template related wizard extensions.\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public class WizardExtensionFactory implements IExecutableExtensionFactory, IExecutableExtension {\r
-\r
- /**\r
- * Factory ID for the shared library export wizard.\r
- */\r
- public static final String ANNOTATION_TYPE_EXPORT_WIZARD = "sharedOntologyExportWizard"; // $//$NON-NLS-1$\r
- public static final String MODEL_TYPE_EXPORT_WIZARD = "modelExportWizard"; // $//$NON-NLS-1$\r
-\r
- /**\r
- * Factory ID for the shared library import wizard.\r
- */\r
- public static final String ANNOTATION_TYPE_IMPORT_WIZARD = "sharedOntologyImportWizard"; // $//$NON-NLS-1$\r
- \r
- private IConfigurationElement config;\r
-\r
- private String id;\r
-\r
- private String propertyName;\r
-\r
- public WizardExtensionFactory() {\r
- // do nothing\r
- }\r
-\r
- private Object configure(Object obj) throws CoreException {\r
- if (obj instanceof IExecutableExtension) {\r
- ((IExecutableExtension) obj).setInitializationData(config, propertyName, null);\r
- }\r
- return obj;\r
- }\r
-\r
- @Override\r
- public Object create() throws CoreException {\r
- if (ANNOTATION_TYPE_EXPORT_WIZARD.equals(id)) {\r
- return configure(new SharedOntologyExportWizard());\r
- }\r
- if (MODEL_TYPE_EXPORT_WIZARD.equals(id)) {\r
- return configure(new ModelExportWizard());\r
- }\r
- if (ANNOTATION_TYPE_IMPORT_WIZARD.equals(id)) {\r
- return configure(new SharedOntologyImportWizard());\r
- }\r
-\r
- throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,\r
- 0, "Unknown id in data argument for " + getClass(), null)); //$NON-NLS-1$\r
- }\r
-\r
- @Override\r
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data)\r
- throws CoreException {\r
-\r
- if (data instanceof String) {\r
- id = (String) data;\r
- } else {\r
- throw new CoreException(new Status(IStatus.ERROR,\r
- Activator.PLUGIN_ID, 0,\r
- "Data argument must be a String for " + getClass(), null)); //$NON-NLS-1$\r
- }\r
- this.config = config;\r
- this.propertyName = propertyName;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * 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:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.modeling.ui.sharedontology.wizard;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.core.runtime.IExecutableExtensionFactory;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.simantics.modeling.ui.Activator;
+
+/**
+ * A factory for diagram template related wizard extensions.
+ *
+ * @author Tuukka Lehtonen
+ */
+public class WizardExtensionFactory implements IExecutableExtensionFactory, IExecutableExtension {
+
+ /**
+ * Factory ID for the shared library export wizard.
+ */
+ public static final String ANNOTATION_TYPE_EXPORT_WIZARD = "sharedOntologyExportWizard"; // $//$NON-NLS-1$
+ public static final String MODEL_TYPE_EXPORT_WIZARD = "modelExportWizard"; // $//$NON-NLS-1$
+
+ /**
+ * Factory ID for the shared library import wizard.
+ */
+ public static final String ANNOTATION_TYPE_IMPORT_WIZARD = "sharedOntologyImportWizard"; // $//$NON-NLS-1$
+ public static final String MODEL_IMPORT_WIZARD = "modelImportWizard"; // $//$NON-NLS-1$
+
+ private IConfigurationElement config;
+
+ private String id;
+
+ private String propertyName;
+
+ public WizardExtensionFactory() {
+ // do nothing
+ }
+
+ private Object configure(Object obj) throws CoreException {
+ if (obj instanceof IExecutableExtension) {
+ ((IExecutableExtension) obj).setInitializationData(config, propertyName, null);
+ }
+ return obj;
+ }
+
+ @Override
+ public Object create() throws CoreException {
+ if (ANNOTATION_TYPE_EXPORT_WIZARD.equals(id)) {
+ return configure(new SharedOntologyExportWizard());
+ }
+ if (MODEL_TYPE_EXPORT_WIZARD.equals(id)) {
+ return configure(new ModelExportWizard());
+ }
+ if (ANNOTATION_TYPE_IMPORT_WIZARD.equals(id)) {
+ return configure(new SharedOntologyImportWizard());
+ }
+ if (MODEL_IMPORT_WIZARD.equals(id)) {
+ return configure(new ModelImportWizard());
+ }
+
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ 0, "Unknown id in data argument for " + getClass(), null)); //$NON-NLS-1$
+ }
+
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+ throws CoreException {
+
+ if (data instanceof String) {
+ id = (String) data;
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR,
+ Activator.PLUGIN_ID, 0,
+ "Data argument must be a String for " + getClass(), null)); //$NON-NLS-1$
+ }
+ this.config = config;
+ this.propertyName = propertyName;
+ }
+
+}