-// $Id$\r
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-\r
-package eu.etaxonomy.taxeditor.editor;\r
-\r
-import java.util.UUID;\r
-\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.eclipse.ui.IElementFactory;\r
-import org.eclipse.ui.IMemento;\r
-\r
-import eu.etaxonomy.taxeditor.store.CdmStore;\r
-\r
-\r
-/**\r
- * @author p.ciardelli\r
- * @created 23.04.2009\r
- * @version 1.0\r
- */\r
-public class TaxonEditorInputFactory implements IElementFactory {\r
-\r
- /**\r
- * Factory id. The workbench plug-in registers a factory by this name\r
- * with the "org.eclipse.ui.elementFactories" extension point.\r
- */\r
- private static final String ID_FACTORY = "eu.etaxonomy.taxeditor.editor.TaxonEditorInputFactory"; //$NON-NLS-1$\r
- \r
- /**\r
- * Tag for the IFile.fullPath of the file resource.\r
- */\r
- private static final String TAXON_NODE_UUID = "uuid"; //$NON-NLS-1$\r
- \r
- /* (non-Javadoc)\r
- * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)\r
- */\r
- public IAdaptable createElement(IMemento memento) {\r
- // Get the uuid\r
- String taxonNodeUuid = memento.getString(TAXON_NODE_UUID);\r
- if(! CdmStore.isActive()){\r
- return null;\r
- }\r
- if (taxonNodeUuid == null || CdmStore.getTaxonTreeService().getTaxonNodeByUuid(UUID.fromString(taxonNodeUuid)) == null) {\r
- EditorUtil.warn(this.getClass(), "Couldn't find taxon node with UUID " + taxonNodeUuid);\r
- return null;\r
- }\r
- try {\r
- return TaxonEditorInput.NewInstance(UUID.fromString(taxonNodeUuid));\r
- } catch (Exception e) {\r
- EditorUtil.warningDialog("Could not create element", TaxonEditorInputFactory.class, e.getMessage());\r
- }\r
- return null;\r
- } \r
- \r
- /**\r
- * Returns the element factory id for this class.\r
- * \r
- * @return the element factory id\r
- */\r
- public static String getFactoryId() {\r
- return ID_FACTORY;\r
- }\r
- \r
- /**\r
- * Saves the state of the given file editor input into the given memento.\r
- *\r
- * @param memento the storage area for element state\r
- * @param input the file editor input\r
- */\r
- public static void saveState(IMemento memento, TaxonEditorInput input) {\r
- String uuid = input.getTaxonNode().getUuid().toString();\r
- memento.putString(TAXON_NODE_UUID, uuid);\r
- }\r
-}
\ No newline at end of file
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor;
+
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
+
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+/**
+ * <p>TaxonEditorInputFactory class.</p>
+ *
+ * @author p.ciardelli
+ * @created 23.04.2009
+ * @version 1.0
+ */
+public class TaxonEditorInputFactory implements IElementFactory {
+
+ /**
+ * Factory id. The workbench plug-in registers a factory by this name
+ * with the "org.eclipse.ui.elementFactories" extension point.
+ */
+ private static final String ID_FACTORY = "eu.etaxonomy.taxeditor.editor.TaxonEditorInputFactory"; //$NON-NLS-1$
+
+ /**
+ * Tag for the IFile.fullPath of the file resource.
+ */
+ private static final String TAXON_NODE_UUID = "uuid"; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)
+ */
+ /** {@inheritDoc} */
+ public IAdaptable createElement(IMemento memento) {
+ // Get the uuid
+ String taxonNodeUuid = memento.getString(TAXON_NODE_UUID);
+ if(! CdmStore.isActive()){
+ return null;
+ }
+ if (taxonNodeUuid == null || CdmStore.getTaxonTreeService().getTaxonNodeByUuid(UUID.fromString(taxonNodeUuid)) == null) {
+ EditorUtil.warn(this.getClass(), "Couldn't find taxon node with UUID " + taxonNodeUuid);
+ return null;
+ }
+ try {
+ return TaxonEditorInput.NewInstance(UUID.fromString(taxonNodeUuid));
+ } catch (Exception e) {
+ EditorUtil.warningDialog("Could not create element", TaxonEditorInputFactory.class, e.getMessage());
+ }
+ return null;
+ }
+
+ /**
+ * Returns the element factory id for this class.
+ *
+ * @return the element factory id
+ */
+ public static String getFactoryId() {
+ return ID_FACTORY;
+ }
+
+ /**
+ * Saves the state of the given file editor input into the given memento.
+ *
+ * @param memento the storage area for element state
+ * @param input the file editor input
+ */
+ public static void saveState(IMemento memento, TaxonEditorInput input) {
+ String uuid = input.getTaxonNode().getUuid().toString();
+ memento.putString(TAXON_NODE_UUID, uuid);
+ }
+}