ref #9900: fix consistent use of abbrev title for authors of nomenclatural reference
authorKatja Luther <k.luther@bgbm.org>
Fri, 17 Dec 2021 12:36:17 +0000 (13:36 +0100)
committerKatja Luther <k.luther@bgbm.org>
Fri, 17 Dec 2021 12:36:17 +0000 (13:36 +0100)
15 files changed:
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewReferenceWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTeamWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TeamOrPersonBaseSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/NomenclaturalTeamMemberElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamMemberElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalSourceDetailElement.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java with 93% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalSourceDetailSection.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java with 91% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalSourceElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EditFromSelectionWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java

index 2d8063e4263fd2dae60c34897141a79247f8d0c6..02b70e4f97064472f7d9ea6dd134415224e2e09d 100644 (file)
@@ -53,7 +53,7 @@ public class NewReferenceWizard extends AbstractNewEntityWizard<Reference> {
        public void addPages() {
                // TODO disabling external service wizard page for now
 //             addPage(new ExternalReferenceServiceWizardPage(formFactory, getConversationHolder(), entity));
-               referencePage = new ReferenceWizardPage(formFactory, getConversationHolder(), getEntity());
+               referencePage = new ReferenceWizardPage(formFactory, getConversationHolder(), getEntity(), false);
                addPage(referencePage);
        }
 
index fd9ac5ae64bbe85ee44ad31f4df2ea5ba9414aab..d23425f65cb49cd762ed1d1dd8737d0af27ea04b 100644 (file)
@@ -11,6 +11,7 @@ package eu.etaxonomy.taxeditor.newWizard;
 
 import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.cdm.persistence.dto.MergeResult;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.section.agent.TeamWizardPage;
 
@@ -49,7 +50,7 @@ public class NewTeamWizard extends AbstractNewEntityWizard<Team> {
        /** {@inheritDoc} */
        @Override
        protected void saveEntity() {
-           CdmStore.getService(IAgentService.class).merge(getEntity(), true);
+           MergeResult result = CdmStore.getService(IAgentService.class).merge(getEntity(), true);
            
        }
 
index 9b2ee454f00878aa1f765bab8ccbb5a61f38798c..1e4998fdfe75b08f74b560d9f98952e8bb5de22d 100644 (file)
@@ -83,10 +83,16 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmB
             this.cdmBaseToBeFiltered = new HashSet<>();
             objectsToBeFiltered.forEach(filter->this.cdmBaseToBeFiltered.add(filter.getUuid()));
         }
-        Cursor cursor = shell.getCursor();
-        shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
+        Cursor cursor = null;
+        if (shell != null){
+               cursor = shell.getCursor();
+               shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
+        }
+        
         init();
-        shell.setCursor(cursor);
+        if (shell != null){   
+               shell.setCursor(cursor);
+        }
         setListLabelProvider(createListLabelProvider());
 
        }
index f7a1c599a990a7c6ac750921866757553de417bd..d276f5f83ff5ba2daaaf4c3abd9572c72fc24789 100644 (file)
@@ -57,7 +57,7 @@ import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;\r
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailElement;\r
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitFacadeGeneralDetailElement;\r
-import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;\r
+import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailElement;\r
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;\r
 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailElement;\r
 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;\r
@@ -93,9 +93,9 @@ public class SelectionDialogFactory {
                        return (T) TaxonNodeSelectionDialog.select(shell,\r
                                null, null, (TaxonNode) currentSelection, ((TaxonNode) currentSelection).getClassification().getUuid());\r
                }\r
-               if(clazz.equals(Reference.class) && parentElement != null && parentElement.getParentElement() instanceof NomenclaturalReferenceDetailElement){\r
+               if(clazz.equals(Reference.class) && parentElement != null && parentElement.getParentElement() instanceof NomenclaturalSourceDetailElement){\r
                        return (T) NomenclaturalReferenceSelectionDialog.select(shell,\r
-                               (Reference) currentSelection, ((NomenclaturalReferenceDetailElement)parentElement.getParentElement()).getEntity().getCombinationAuthorship());\r
+                               (Reference) currentSelection, ((NomenclaturalSourceDetailElement)parentElement.getParentElement()).getEntity().getCombinationAuthorship());\r
                }\r
                if(clazz.equals(Reference.class) && parentElement instanceof CommonNameSourceElement && PreferencesUtil.getFilterCommonNameReferences()){\r
             return (T) CommonNameReferenceSelectionDialog.select(shell,\r
@@ -115,7 +115,8 @@ public class SelectionDialogFactory {
                if(clazz.equals(Team.class)){\r
                        return (T) TeamSelectionDialog.select(shell, (Team)currentSelection);\r
                }\r
-               if(clazz.equals(TeamOrPersonBase.class) && parentElement instanceof AuthorshipDetailElement){\r
+               if(clazz.equals(TeamOrPersonBase.class) && (parentElement instanceof AuthorshipDetailElement \r
+                               || (parentElement instanceof ReferenceDetailElement && ((ReferenceDetailElement)parentElement).isNomenclaturalReference()))){\r
             return (T) NomenclaturalAuthorSelectionDialog.select(shell,\r
                     (TeamOrPersonBase) currentSelection, false);\r
         }else if(clazz.equals(AgentBase.class) && (parentElement instanceof FieldUnitFacadeGeneralDetailElement || parentElement instanceof DerivedUnitGeneralDetailElement)){\r
index 13038fc4e9b4635790a84715a1db095bd94bfc18..a08fd86ef8465c82b962157cf04f5ca29ec964e7 100755 (executable)
@@ -39,8 +39,9 @@ public class TeamOrPersonBaseSelectionDialog
 
     @Override
     protected void callService(String pattern) {
-        model = (List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class, limitOfInitialElements, pattern);
-        model.addAll((List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class,limitOfInitialElements, pattern));
+       model = (List)CdmStore.getService(IAgentService.class).getTeamOrPersonUuidAndTitleCache(null, limitOfInitialElements, pattern);
+//        model = (List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Team.class, limitOfInitialElements, pattern);
+//        model.addAll((List)CdmStore.getService(IAgentService.class).getUuidAndTitleCache(Person.class,limitOfInitialElements, pattern));
     }
 
     @Override
index 81568b89e9d43568a7d8f0cad616b8d9ac47bf0f..e83696d8e87dab498be6a625deb22f4843fe77d6 100644 (file)
@@ -156,6 +156,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
 import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.agent.NomenclaturalTeamMemberElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailElement;
@@ -338,8 +339,8 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDe
 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.AdvancedNomenclaturalSourceElement;
 import eu.etaxonomy.taxeditor.ui.section.reference.AdvancedSourceElement;
-import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceElement;
 import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceAdvancedSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.OriginalSourceElement;
@@ -1927,8 +1928,8 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-    public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
+    public NomenclaturalSourceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        NomenclaturalSourceDetailSection section = new NomenclaturalSourceDetailSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
         return section;
     }
@@ -2475,9 +2476,14 @@ public class CdmFormFactory extends FormToolkit {
         addAndAdaptElement(parentElement, element);
         return element;
     }
+    public ReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
+        ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, true, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
 
-    public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
-        NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
+    public NomenclaturalSourceDetailElement createNomenclaturalSourceDetailElement(ICdmFormElement parentElement, int style){
+        NomenclaturalSourceDetailElement element = new NomenclaturalSourceDetailElement(this, parentElement, style);
         addAndAdaptElement(parentElement, element);
         return element;
     }
@@ -2982,7 +2988,11 @@ public class CdmFormFactory extends FormToolkit {
             if (parentElement instanceof TeamMemberSection){
                 isNomenclatural = ((TeamMemberSection) parentElement).isNomenclaturalTeam();
             }
-            element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style, isNomenclatural);
+            if (isNomenclatural){
+               element = new NomenclaturalTeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
+            }else{
+               element = new TeamMemberElement(this, parentElement, (Person) entity, removeListener, style);
+            }
         } else if (entity instanceof Credit) {
             element = new CreditElement(this, parentElement, (Credit) entity, removeListener, style);
         } else if (entity instanceof Extension) {
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/NomenclaturalTeamMemberElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/NomenclaturalTeamMemberElement.java
new file mode 100644 (file)
index 0000000..5d6f4de
--- /dev/null
@@ -0,0 +1,30 @@
+package eu.etaxonomy.taxeditor.ui.section.agent;
+
+import org.eclipse.swt.events.SelectionListener;
+
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+public class NomenclaturalTeamMemberElement extends TeamMemberElement {
+
+       public NomenclaturalTeamMemberElement(CdmFormFactory cdmFormFactory, AbstractFormSection section, Person entity,
+                       SelectionListener removeListener, int style) {
+               super(cdmFormFactory, section, entity, removeListener, style);
+               
+       }
+
+       @Override
+       public void createControls(ICdmFormElement element, int style) {
+               selection_person = formFactory
+                               .createSelectionElementWithAbbreviatedTitle(Person.class,getConversationHolder(),
+                                       this, "Person", null,
+                                               EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE,
+                                               style);
+               if (entity != null){
+                       setEntity(entity);
+               }
+       }
+}
index 785c11d2c7f0f0d6a47213653f6bc61a3138fa1f..9c9d0d5bf66ac0cd1eaafda5ed84485bfef5cf0c 100644 (file)
@@ -25,11 +25,11 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  */
 public class TeamMemberElement extends AbstractEntityCollectionElement<Person> {
 
-       private EntitySelectionElement<Person> selection_person;
+       protected EntitySelectionElement<Person> selection_person;
 
        public TeamMemberElement(CdmFormFactory cdmFormFactory,
                        AbstractFormSection section, Person entity,
-                       SelectionListener removeListener, int style, boolean isNomenclatural) {
+                       SelectionListener removeListener, int style) {
                super(cdmFormFactory, section, entity, removeListener, null, style);
        }
 
@@ -23,7 +23,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  * @author n.hoffmann
  * @created Mar 12, 2010
  */
-public class NomenclaturalReferenceDetailElement extends
+public class NomenclaturalSourceDetailElement extends
                AbstractCdmDetailElement<TaxonName> {
 
     private OriginalSourceElement sourceElement;
@@ -42,7 +42,7 @@ public class NomenclaturalReferenceDetailElement extends
         * @param style
         *            a int.
         */
-       public NomenclaturalReferenceDetailElement(CdmFormFactory cdmFormFactory,
+       public NomenclaturalSourceDetailElement(CdmFormFactory cdmFormFactory,
                        ICdmFormElement formElement, int style) {
                super(cdmFormFactory, formElement);
        }
@@ -28,7 +28,7 @@ import eu.etaxonomy.taxeditor.ui.section.ITaxonBaseDetailSection;
  * @author n.hoffmann
  * @created Mar 12, 2010
  */
-public class NomenclaturalReferenceDetailSection extends
+public class NomenclaturalSourceDetailSection extends
                AbstractCdmDetailSection<TaxonName>  implements ITaxonBaseDetailSection{
 
        private TaxonBase<?> taxonBase;
@@ -42,7 +42,7 @@ public class NomenclaturalReferenceDetailSection extends
         * @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
         * @param style a int.
         */
-       public NomenclaturalReferenceDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
+       public NomenclaturalSourceDetailSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
                        ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
                super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
        }
@@ -81,6 +81,6 @@ public class NomenclaturalReferenceDetailSection extends
        @Override
        protected AbstractCdmDetailElement<TaxonName> createCdmDetailElement(
                        AbstractCdmDetailSection<TaxonName> parentElement, int style) {
-           return formFactory.createNomenclaturalReferenceDetailElement(parentElement, style);
+           return formFactory.createNomenclaturalSourceDetailElement(parentElement, style);
        }
 }
index 7062c0d373057394772ce78e20eac0d33a942337..36dd271f2456b0f65aed975dfe8ac3bcd96d1ab7 100755 (executable)
@@ -33,11 +33,8 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElementWithAbbreviated
 public class NomenclaturalSourceElement extends OriginalSourceElement<NomenclaturalSource> {
 
     private EntitySelectionElementWithAbbreviatedTitle<Reference> selection_NomRef;
-    protected String label = "Source";
-    protected CdmBase cdmEntity;
-
     protected EntitySelectionElement<TaxonName> select_nameUsedInSource;
-    protected ExternalLinksSection externalLinks;
+    
 
     public NomenclaturalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity,
             String label) {
index f7721f754826f3531b5fb2e9a061fb5c6fb3da74..418fad5ab02873255b7973e8177b1e7732c2b380 100644 (file)
@@ -48,7 +48,11 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElement<Reference>
                implements IErrorIntolerableElement, IExceptionHandler {
 
-    private ToggleableTextElement toggleableAbbrevCache;
+       boolean isNomenclaturalReference = false;
+       
+    
+
+       private ToggleableTextElement toggleableAbbrevCache;
 
        private TextWithLabelElement text_edition;
        private TextWithLabelElement text_editor;
@@ -97,6 +101,20 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
                        ICdmFormElement formElement, int style) {
                super(cdmFormFactory, formElement);
        }
+       
+       public ReferenceDetailElement(CdmFormFactory cdmFormFactory,
+                       ICdmFormElement formElement, boolean isNomenclaturalReference, int style) {
+               this(cdmFormFactory, formElement, style);
+               this.isNomenclaturalReference = isNomenclaturalReference;
+               
+       }
+       public boolean isNomenclaturalReference() {
+               return isNomenclaturalReference;
+       }
+
+       public void setNomenclaturalReference(boolean isNomenclaturalReference) {
+               this.isNomenclaturalReference = isNomenclaturalReference;
+       }
 
        @Override
        protected void createControls(ICdmFormElement formElement,
@@ -125,11 +143,19 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
                ReferenceType referenceType = entity.getType();
                // author team
                if(referenceType != null && !referenceType.equals(ReferenceType.Journal) && !referenceType.equals(ReferenceType.PrintSeries) ) {
-            selection_authorTeam = formFactory
-                       .createSelectionElement(TeamOrPersonBase.class,
-                               formElement, "Author",
-                                       entity.getAuthorship(),
-                                       EntitySelectionElement.ALL, style);
+                       if (isNomenclaturalReference){
+                               selection_authorTeam = formFactory
+                               .createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,getConversationHolder(),
+                                       formElement, "Author",
+                                               entity.getAuthorship(),
+                                               EntitySelectionElement.ALL, style);
+                       }else{
+                   selection_authorTeam = formFactory
+                               .createSelectionElement(TeamOrPersonBase.class,
+                                       formElement, "Author",
+                                               entity.getAuthorship(),
+                                               EntitySelectionElement.ALL, style);
+                       }
         }
 
                if (referenceType != null) {
index 2385142046f5dcb8888ac6583d0af3aa0810c2db..bd0ef9f043ac498b3c3bca628d4198e5f9b83e84 100644 (file)
@@ -27,6 +27,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  * @created Jun 1, 2010
  */
 public class ReferenceWizardPage extends AbstractCdmEntityWizardPage<Reference> implements IExceptionHandler{
+       private boolean isNomenclaturalReference = false;
 
        /**
         * <p>Constructor for ReferenceBaseWizardPage.</p>
@@ -35,9 +36,10 @@ public class ReferenceWizardPage extends AbstractCdmEntityWizardPage<Reference>
         * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
         * @param entity a {@link eu.etaxonomy.cdm.model.reference.ReferenceBase} object.
         */
-       public ReferenceWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, Reference entity) {
+       public ReferenceWizardPage(CdmFormFactory formFactory, ConversationHolder conversation, Reference entity, boolean isNomenclaturalReference) {
                super(formFactory, conversation, entity);
                setTitle("Reference");
+               this.isNomenclaturalReference = isNomenclaturalReference;
        }
 
        @Override
@@ -47,7 +49,7 @@ public class ReferenceWizardPage extends AbstractCdmEntityWizardPage<Reference>
 
        @Override
     public AbstractCdmDetailElement<Reference> createElement(ICdmFormElement rootElement){
-               ReferenceDetailElement referenceElement = formFactory.createReferenceDetailElement(rootElement, SWT.NULL);
+               ReferenceDetailElement referenceElement = formFactory.createNomenclaturalReferenceDetailElement(rootElement,  SWT.NULL);
                referenceElement.addExceptionHandler(this);
                referenceElement.setEntity(entity);
                referenceElement.setWarnForReferencingObjectsVisible(true);
index 0479bff0d48ddcdb247937d712a34bb3264e6cbb..06139631d6b7fb9c76e48855d1fc5c8ccbae06dc 100644 (file)
@@ -97,11 +97,14 @@ public class EditFromSelectionWizard extends Wizard implements
                        IService<CdmBase> service = CdmStore.getService(entity);
                        rootElement = service.load(entity.getUuid());
                }
-               if (rootElement.isInstanceOf(Reference.class)) {
+               if (rootElement.isInstanceOf(Reference.class)&& selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?>) {
                        addPage(new ReferenceWizardPage(formFactory,
                                        selectionElement.getConversationHolder(),
-                                       (HibernateProxyHelper.deproxy(rootElement, Reference.class))));
-               } else if (rootElement.isInstanceOf(Team.class) && selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?>) {
+                                       HibernateProxyHelper.deproxy(rootElement, Reference.class), true));
+               } else if (rootElement.isInstanceOf(Reference.class) ) {
+                       addPage(new ReferenceWizardPage(formFactory,
+                                       selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Reference.class), false));
+               } else if (rootElement.isInstanceOf(Team.class) && (selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?> )) {
                        addPage(new TeamWizardPage(formFactory,
                                        selectionElement.getConversationHolder(), HibernateProxyHelper.deproxy(rootElement, Team.class), true));
                } else if (rootElement.isInstanceOf(Team.class) && !(selectionElement instanceof EntitySelectionElementWithAbbreviatedTitle<?>)) {
index bf6ebfb5127657d5b67afbcd10f86fa4fd066318..fb9c0cda111d7867a7fcc8ac9a6dcc6ae8c3a798 100755 (executable)
@@ -15,11 +15,13 @@ import java.util.Set;
 
 import javax.inject.Inject;
 
+import org.apache.lucene.search.BulkScorer;
 import org.eclipse.e4.core.di.annotations.Optional;
 import org.eclipse.e4.ui.di.UIEventTopic;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.swt.SWT;
 import org.springframework.security.core.GrantedAuthority;
@@ -30,6 +32,7 @@ import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
 import eu.etaxonomy.cdm.model.agent.Person;
 import eu.etaxonomy.cdm.model.agent.Team;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Marker;
 import eu.etaxonomy.cdm.model.description.CategoricalData;
 import eu.etaxonomy.cdm.model.description.Character;
@@ -52,6 +55,7 @@ import eu.etaxonomy.cdm.model.permission.CRUD;
 import eu.etaxonomy.cdm.model.permission.Group;
 import eu.etaxonomy.cdm.model.permission.User;
 import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.SecundumSource;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
@@ -132,8 +136,9 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailS
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalSourceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.reference.SecundumSourceSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.identifier.DerivedUnitFacadeIdentifierSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
@@ -209,6 +214,8 @@ public class DetailsViewerE4 extends AbstractCdmDataViewer {
             input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
         }
         super.setInput(input);
+        
+        
     }
 
     @Override
@@ -477,9 +484,10 @@ public class DetailsViewerE4 extends AbstractCdmDataViewer {
             requiredCrud = EnumSet.of(CRUD.UPDATE);
         }
         boolean hasPermission = CdmStore.currentAuthentiationHasPermission(StoreUtil.getCdmEntity(getInput()), requiredCrud);
+        TaxonBase<?> taxonBase = (TaxonBase<?>)getInput();
         if (hasPermission){
             // check for subtree permissions as well.
-            TaxonBase<?> taxonBase = (TaxonBase<?>)getInput();
+            
             Taxon acceptedTaxon = null;
             if (taxonBase instanceof Taxon){
                 acceptedTaxon = (Taxon)taxonBase;
@@ -525,14 +533,29 @@ public class DetailsViewerE4 extends AbstractCdmDataViewer {
                 addPart(taxonBaseDetailSection);
             }
         }
+        //TODO: test code for secundum source section
+//        SecundumSourceSection sourceSection = formFactory.createSecundumDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(SecundumSourceSection.class, getInput().getClass().getCanonicalName(), true));
+//        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+//        addPart(sourceSection);
+//        if (taxonBase.getSecSource() == null){
+//            SecundumSource source = SecundumSource.NewSecundumInstance(taxonBase);
+//            taxonBase.setSecSource(source);
+//            sourceSection.setEntity(taxonBase);
+//        }else{
+//             sourceSection.setEntity(taxonBase);
+//        }
+//
+//        if (config != null && !config.isSecEnabled()){
+//             sourceSection.setEnabled(false);
+//        }
         NonViralNameDetailSection nonViralNameSection = formFactory
                 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
                         StoreUtil.getSectionStyle(NonViralNameDetailSection.class, getInput().getClass().getCanonicalName(), true));
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
         nonViralNameSection.setEnabled(detailsEnabled);
         if (config == null || config.isNomenclaturalReferenceSectionActivated()){
-            NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
-                    StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
+            NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
+                    StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
             referenceDetailSection.setEnabled(detailsEnabled);
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             addPart(referenceDetailSection);
@@ -577,8 +600,8 @@ public class DetailsViewerE4 extends AbstractCdmDataViewer {
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
-                StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
+        NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
+                StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
         NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
@@ -939,8 +962,8 @@ public class DetailsViewerE4 extends AbstractCdmDataViewer {
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-        NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
-                StoreUtil.getSectionStyle(NomenclaturalReferenceDetailSection.class, getInput().getClass().getCanonicalName(), true));
+        NomenclaturalSourceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
+                StoreUtil.getSectionStyle(NomenclaturalSourceDetailSection.class, getInput().getClass().getCanonicalName(), true));
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
         addPart(referenceDetailSection);