Merge branch 'develop' into remoting-4.0
authorCherian Mathew <c.mathew@bgbm.org>
Mon, 14 Sep 2015 14:37:41 +0000 (16:37 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Mon, 14 Sep 2015 14:37:41 +0000 (16:37 +0200)
Conflicts:
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewSpecimenHandler.java

eu.etaxonomy.taxeditor.application/.classpath
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewSpecimenHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventWizardPage.java

index 0f0d04b90bfb69678c587c34bb3585294306ea2f..4c0364cadc7a33d0798a7c7813ef92548fe8cb81 100644 (file)
@@ -4,6 +4,5 @@
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
        <classpathentry kind="src" path="src/test/java"/>
-       <classpathentry kind="src" path="src/main/resources/"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
index bfbdd84477a478f1d9b791b4e2c99d0c2b438824..dbd3353708ca5eed81bb348743c09e3b8d5cd2ee 100644 (file)
 
 package eu.etaxonomy.taxeditor.editor.handler.create;
 
-import java.util.Collections;
-
 import org.apache.log4j.Logger;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
 
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeFieldUnitCacheStrategy;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
-import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.newWizard.NewDerivedUnitBaseWizard;
 
 /**
- * <p>NewSpecimenHandler class.</p>
- *
  * @author n.hoffmann
  * @created Jun 16, 2010
  * @version 1.0
@@ -42,32 +28,32 @@ public class NewSpecimenHandler extends AbstractHandler {
        private static final Logger logger = Logger
                        .getLogger(NewSpecimenHandler.class);
 
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-        */
        /** {@inheritDoc} */
        @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-           ConversationHolder conversation = CdmStore.createConversation();
-           conversation.bind();
-           FieldUnit fieldUnit = FieldUnit.NewInstance();
-           DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
-           DerivationEvent.NewSimpleInstance(fieldUnit, derivedUnit, DerivationEventType.GATHERING_IN_SITU());
-        CdmStore.getService(IOccurrenceService.class).merge(fieldUnit);
-        conversation.commit();
-        DerivateViewEditorInput input = new DerivateViewEditorInput(Collections.singleton(fieldUnit.getUuid()));
-        fieldUnit.setCacheStrategy(new DerivedUnitFacadeFieldUnitCacheStrategy());
-        derivedUnit.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
-        try {
-            EditorUtil.open(input);
-        } catch (PartInitException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-//             NewDerivedUnitBaseWizard wizard = new NewDerivedUnitBaseWizard();
-//             wizard.init(null, null);
-//             WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
-//             dialog.open();
+
+           //TODO: we need to discuss how specimens should be created and handled #5244
+//         ConversationHolder conversation = CdmStore.createConversation();
+//         conversation.bind();
+//         FieldUnit fieldUnit = FieldUnit.NewInstance();
+//         DerivedUnit derivedUnit = DerivedUnit.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
+//         DerivationEvent.NewSimpleInstance(fieldUnit, derivedUnit, DerivationEventType.GATHERING_IN_SITU());
+//         fieldUnit.setCacheStrategy(new DerivedUnitFacadeFieldUnitCacheStrategy());
+//         derivedUnit.setCacheStrategy(new DerivedUnitFacadeCacheStrategy());
+//        CdmStore.getService(IOccurrenceService.class).save(fieldUnit);
+//        CdmStore.getService(IOccurrenceService.class).save(derivedUnit);
+//        conversation.commit();
+//        DerivateViewEditorInput input = new DerivateViewEditorInput(Collections.singleton(fieldUnit.getUuid()));
+//        try {
+//            EditorUtil.open(input);
+//        } catch (PartInitException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
+               NewDerivedUnitBaseWizard wizard = new NewDerivedUnitBaseWizard();
+               wizard.init(null, null);
+               WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+               dialog.open();
                return null;
        }
 }
index 7556a73d2612f9b93ca11525614197de02a0c09a..52fedd9b04960d13ab6ffd527757f956339ce945 100644 (file)
@@ -57,6 +57,7 @@ import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
 import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
 import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
@@ -223,10 +224,12 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
                if(part == this){
                    return;
                }
-               if(part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart){
-                   // do not show empty page as these views are also used to edit the description selected in this view
-                   return;
-               }
+        if (part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart
+                || part instanceof MediaViewPart) {
+            // do not show empty page as these views are also used to edit the
+            // description selected in this view
+            return;
+        }
                // unpackage TreeNode of DerivateView
                else if(part instanceof DerivateView){
                    TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(selection);
index e0520f0027b906427b9f20dc9a5b5934a63d08de..7bfee153d75129a063401743701729797e56e6e7 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.ui.IWorkbenchPart;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
@@ -97,8 +98,10 @@ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartCon
                        return;
                }
 
-        if(part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart){
-            // do not show empty page as these views are also used to edit the description selected in this view
+        if (part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart
+                || part instanceof DescriptiveViewPart) {
+            // do not show empty page as these views are also used to edit the
+            // description selected in this view
             return;
         }
 
index 5e32239b79b6a7bf6208453f1c8af9ea372356e6..836c953c9ef7986fa2edfc4fbcb606eb2b72a380 100644 (file)
@@ -29,8 +29,6 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitWizardPage;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventWizardPage;
 
 /**
- * <p>NewDerivedUnitBaseWizard class.</p>
- *
  * @author n.hoffmann
  * @created Jun 16, 2010
  * @version 1.0
@@ -70,12 +68,6 @@ public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOr
            }
        }
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#
-     * createNewEntity()
-     */
     /** {@inheritDoc} */
     @Override
     protected SpecimenOrObservationBase createNewEntity() {
@@ -96,9 +88,6 @@ public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOr
         }
     }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
-        */
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
index 69b53eb65dd7dca0e769676ad0a0a94edf4415a4..e7fcb52192ed3d660f88f344e90ba3cf17c5880d 100644 (file)
@@ -24,11 +24,6 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class DerivedUnitBaseWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
 
-       /**
-        * @param formFactory
-        * @param conversation
-        * @param entity
-        */
        public DerivedUnitBaseWizardPage(CdmFormFactory formFactory,
                        ConversationHolder conversation, DerivedUnitFacade entity) {
                super(formFactory, conversation, entity);
@@ -36,17 +31,11 @@ public class DerivedUnitBaseWizardPage extends AbstractCdmEntityWizardPage<Deriv
                setPageComplete(true);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
-        */
        @Override
        protected void checkComplete() {
                setPageComplete(true);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
-        */
        @Override
        public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
                DerivedUnitBaseDetailElement detailElement = formFactory.createDerivedUnitBaseDetailElement(rootElement);
index 1ac5b58dea93b3758db25b287f039bbc055e2c58..e8d77391b6f73202cde719a80bec9820573d98f6 100644 (file)
@@ -45,6 +45,8 @@ public class DerivedUnitGeneralDetailElement extends
                AbstractCdmDetailElement<DerivedUnitFacade> {
 
     boolean showOnlyDerivedUnitData = false;
+    //TODO: flag to disable specimen type dropdown (#5244)
+    boolean showSpecimenType = true;
 
        private ToggleableTextElement toggleableText_titleCache;
        private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
@@ -71,13 +73,6 @@ public class DerivedUnitGeneralDetailElement extends
            super(formFactory, formElement);
        }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
-        * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
-        */
        @Override
        protected void createControls(ICdmFormElement formElement,
                        DerivedUnitFacade entity, int style) {
@@ -91,6 +86,7 @@ public class DerivedUnitGeneralDetailElement extends
                else{
                    combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
                    combo_specorobstype.setSelection(entity.getType());
+                   combo_specorobstype.setEnabled(showSpecimenType);
                    selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
                            formElement, "Country",
                            entity.getCountry(), EntitySelectionElement.NOTHING, style);
@@ -130,13 +126,6 @@ public class DerivedUnitGeneralDetailElement extends
 
        }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
-        * .lang.Object)
-        */
        @Override
        public void handleEvent(Object eventSource) {
                if (eventSource == toggleableText_titleCache) {
@@ -177,4 +166,8 @@ public class DerivedUnitGeneralDetailElement extends
         this.showOnlyDerivedUnitData = showOnlyDerivedUnitData;
     }
 
+    public void setShowSpecimenType(boolean showSpecimenType) {
+        this.showSpecimenType = showSpecimenType;
+    }
+
 }
index 88a722ca4f72a562db97e5b5771c9760c09b78e2..8db53cebc21711e2530cfb045da61c3885cd4240 100644 (file)
@@ -24,31 +24,21 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class DerivedUnitGeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
 
-       /**
-        * @param formFactory
-        * @param conversation
-        * @param entity
-        */
        public DerivedUnitGeneralWizardPage(CdmFormFactory formFactory,
                        ConversationHolder conversation, DerivedUnitFacade entity) {
                super(formFactory, conversation, entity);
                setTitle("General Specimen Data");
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
-        */
        @Override
        protected void checkComplete() {
                setPageComplete(true);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
-        */
        @Override
        public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
                DerivedUnitGeneralDetailElement detailElement = formFactory.createDerivedUnitGeneralDetailElement(rootElement);
+               detailElement.setShowSpecimenType(false);
                detailElement.setEntity(getEntity());
                checkComplete();
                return detailElement;
index 5d2624b7a1dcd82cb6dd201ff6033200ee001e8b..2eac4598dd2777d96e21419a8c2848069773f51a 100644 (file)
@@ -24,11 +24,6 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class FieldUnitWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
 
-       /**
-        * @param formFactory
-        * @param conversation
-        * @param entity
-        */
        public FieldUnitWizardPage(CdmFormFactory formFactory,
                        ConversationHolder conversation, DerivedUnitFacade entity) {
                super(formFactory, conversation, entity);
@@ -36,17 +31,11 @@ public class FieldUnitWizardPage extends AbstractCdmEntityWizardPage<DerivedUnit
                setPageComplete(true);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
-        */
        @Override
        protected void checkComplete() {
                setPageComplete(true);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
-        */
        @Override
        public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
                FieldUnitDetailElement detailElement = formFactory.createFieldUnitDetailElement(rootElement);
index bcfd178d4cc87a5e45145517faa9731f304a8efd..3343ce7d658cfbd936907525808958fd998bcdaa 100644 (file)
@@ -24,11 +24,6 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class GatheringEventWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFacade> {
 
-       /**
-        * @param formFactory
-        * @param conversation
-        * @param entity
-        */
        public GatheringEventWizardPage(CdmFormFactory formFactory,
                        ConversationHolder conversation, DerivedUnitFacade entity) {
                super(formFactory, conversation, entity);
@@ -36,17 +31,11 @@ public class GatheringEventWizardPage extends AbstractCdmEntityWizardPage<Derive
                setPageComplete(true);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
-        */
        @Override
        protected void checkComplete() {
                setPageComplete(true);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
-        */
        @Override
        public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
                GatheringEventDetailElement detailElement = formFactory.createGatheringEventDetailElement(rootElement);