Merge branch 'develop' into nameEditorE4
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / DescriptionSourceSection.java
index bdf401a207551868bb6199aa4619ef999115db24..0c508ed334ce333d570a514aef70fbdf8f5db62a 100644 (file)
@@ -1,9 +1,8 @@
-// $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -14,9 +13,11 @@ import java.util.Collection;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.common.IdentifiableSource;
+import eu.etaxonomy.cdm.model.common.OriginalSourceType;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.OriginalSourceTypeSelectionDialog;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
 
 /**
@@ -28,7 +29,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
  */
 public class DescriptionSourceSection extends
                AbstractEntityCollectionSection<DescriptionBase, IdentifiableSource>{
-       
+
        /**
         * <p>Constructor for DescriptionSourceSection.</p>
         *
@@ -42,7 +43,7 @@ public class DescriptionSourceSection extends
                super(cdmFormFactory, conversation, parentElement, "Description Sources", style);
        }
 
-       
+
 
        /** {@inheritDoc} */
        @Override
@@ -53,7 +54,12 @@ public class DescriptionSourceSection extends
        /** {@inheritDoc} */
        @Override
        public IdentifiableSource createNewElement() {
-               return IdentifiableSource.NewInstance();
+               OriginalSourceType ost = OriginalSourceTypeSelectionDialog.select(getShell(), getConversationHolder());
+               if(ost != null) {
+                       return IdentifiableSource.NewInstance(ost);
+               } else {
+                       return null;
+               }
        }
 
        /** {@inheritDoc} */
@@ -79,4 +85,24 @@ public class DescriptionSourceSection extends
        public void removeElement(IdentifiableSource element) {
                getEntity().removeSource(element);
        }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IdentifiableSource addExisting() {
+        return null;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean allowAddExisting() {
+        return false;
+    }
 }