Fixed #830 - Error when restoring taxon editor from memento
authorp.ciardelli <p.ciardelli@localhost>
Wed, 24 Jun 2009 16:22:27 +0000 (16:22 +0000)
committerp.ciardelli <p.ciardelli@localhost>
Wed, 24 Jun 2009 16:22:27 +0000 (16:22 +0000)
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputFactory.java

index 2a7d9bee7e899806ffe874a3869312ad0419a828..56012b8ab3ecbb4a4f0989a90f27be1af918deb0 100644 (file)
@@ -48,22 +48,20 @@ public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPe
        
     /**
      * 
-     * @param uuid
+     * @param taxonNodeUuid
      * @param conversation
      * @return
      */
-    public static TaxonEditorInput NewInstance(UUID uuid){
+    public static TaxonEditorInput NewInstance(UUID taxonNodeUuid){
        ConversationHolder conversation = CdmStore.NewTransactionalConversation();
        
-       TaxonNode taxonNode = CdmStore.getTaxonService().getTaxonNodeByUuid(uuid);
+       TaxonNode taxonNode = CdmStore.getTaxonService().getTaxonNodeByUuid(taxonNodeUuid);
                
                if(taxonNode == null){
                        MessageDialog.openWarning(EditorUtil.getShell(), "Not yet implemented", "Selected element is not type TaxonBase.");
                        return null;
                }
                
-               Taxon taxon;
-               
                // FIXME had to disable synonym handling for now while implementing taxonNode
 //             if (taxonBase instanceof Synonym) {
 //                     // TODO: in case of pro parte synonym or any other where we might have multiple
index 48e92ffa1bce34c7411e223c7ecef06a80cc131a..7e30683631ab19d5dba102e1c136f94a2589c9fe 100644 (file)
@@ -40,24 +40,24 @@ public class TaxonEditorInputFactory implements IElementFactory {
     /**\r
      * Tag for the IFile.fullPath of the file resource.\r
      */\r
-    private static final String TAXON_UUID = "uuid"; //$NON-NLS-1$\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 uuid = memento.getString(TAXON_UUID);\r
-        if (uuid == null) {\r
+        String taxonNodeUuid = memento.getString(TAXON_NODE_UUID);\r
+        if (taxonNodeUuid == null) {\r
                        return null;\r
                }\r
 //        StoreUtil.checktaxonExists(UUID.fromString(uuid));\r
-        if (CdmStore.getTaxonService().getTaxonByUuid(UUID.fromString(uuid)) == null) {\r
-               logger.warn("Couldn't find taxon with UUID " + uuid);\r
+        if (CdmStore.getTaxonService().getTaxonNodeByUuid(UUID.fromString(taxonNodeUuid)) == null) {\r
+               logger.warn("Couldn't find taxon node with UUID " + taxonNodeUuid);\r
                return null;\r
         }\r
-        logger.info("Creating taxon from memento w UUID " + uuid);\r
-        return TaxonEditorInput.NewInstance(UUID.fromString(uuid));\r
+        logger.info("Creating taxon node from memento w UUID " + taxonNodeUuid);\r
+        return TaxonEditorInput.NewInstance(UUID.fromString(taxonNodeUuid));\r
        }\r
        \r
     /**\r
@@ -76,7 +76,7 @@ public class TaxonEditorInputFactory implements IElementFactory {
      * @param input the file editor input\r
      */\r
     public static void saveState(IMemento memento, TaxonEditorInput input) {\r
-       String uuid = input.getTaxon().getUuid().toString();\r
-        memento.putString(TAXON_UUID, uuid);\r
+       String uuid = input.getTaxonNode().getUuid().toString();\r
+        memento.putString(TAXON_NODE_UUID, uuid);\r
     }\r
 }
\ No newline at end of file