#5256 Add workaround for description reference issue
authorCherian Mathew <c.mathew@bgbm.org>
Thu, 1 Oct 2015 12:46:17 +0000 (14:46 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Thu, 1 Oct 2015 12:58:49 +0000 (14:58 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementSourceSection.java

index 69ffb03cb04f8b97e2fa22eb54e9b5606b25f0f0..5cfb246549a750f05a9934204e98eeae9005cd6c 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.ui.section.description;
 
@@ -9,6 +9,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.common.OriginalSourceType;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
@@ -37,6 +38,10 @@ public class DescriptionElementSourceSection extends AbstractEntityCollectionSec
        /** {@inheritDoc} */
        @Override
        public DescriptionElementSource createNewElement() {
+           if(getEntity().getId() == 0) {
+               MessagingUtils.warningDialog("Description not saved", this, "Please save the newly created description before adding source");
+               return null;
+           }
                return DescriptionElementSource.NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
        }