cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Fri, 2 Apr 2021 19:48:17 +0000 (21:48 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Fri, 2 Apr 2021 19:48:17 +0000 (21:48 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/FactualDataPartE4.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsViewHandler.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/element/RootElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtilE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmDataViewerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataViewerE4.java

index 33dee1f4b7c83fda5f2364a15773804d8250a7ec..29508393d919ef5666a9084aa000bc4f9b13c46d 100644 (file)
@@ -72,7 +72,7 @@ import eu.etaxonomy.taxeditor.workbench.part.ICollapsableExpandable;
  * @date 15.08.2017
  */
 public class FactualDataPartE4 extends AbstractCdmEditorPartE4
-        implements IPartContentHasDetails, IPartContentHasSupplementalData, 
+        implements IPartContentHasDetails, IPartContentHasSupplementalData,
                ICdmEntitySessionEnabled<CdmBase>, ICollapsableExpandable {
 
     /**
@@ -126,8 +126,6 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
         }
 
         Object partObject = createPartObject(activePart);
-        
-        
 
         if ((partObject instanceof DetailsPartE4 && !(selection instanceof TaxonName))|| partObject instanceof SupplementalDataPartE4
                 || partObject instanceof MediaViewPartE4 || partObject instanceof ConceptViewPartE4 || ((partObject instanceof AbstractCdmEditorPartE4) &&(((AbstractCdmEditorPartE4)partObject).getViewer().getInput() instanceof DescriptionElementBase))) {
@@ -136,12 +134,9 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
             return;
         }
 
-
         if(partObject instanceof IPartContentHasFactualData ){
-
             if (!viewer.getControl().isDisposed()){
                 viewer.getControl().setEnabled(isEnabled());
-
             }
 
             IStructuredSelection structuredSelection = createSelection(selection);
index 9e73126e0b2a47a10041865af9551d7e3a99f831..e4544a68154aa9556c8f54f81018f76d6fdfdfcb 100644 (file)
@@ -113,8 +113,6 @@ public class TaxonNavigatorE4 implements
 
        private ConversationHolder conversation;
 
-//     private ICdmEntitySession cdmEntitySession;
-
        private IDataChangeBehavior dataChangeBehavior;
 
        private Root root;
index d7bba594d40c6ae83e54c6a0c9a8eb9effac1ff5..e40d28b56aacafe3500549e8843b288bab892fe2 100644 (file)
@@ -20,7 +20,7 @@ import eu.etaxonomy.taxeditor.view.CdmViewerUtilE4;
 
 public class OpenReferencingObjectsViewHandler {
 
-    List<UuidAndTitleCache<? extends ICdmBase>> selectedObjectList;
+    private List<UuidAndTitleCache<? extends ICdmBase>> selectedObjectList;
 
     @Execute
     public void execute(EPartService partService) {
@@ -39,14 +39,13 @@ public class OpenReferencingObjectsViewHandler {
     public boolean canExecute(EPartService partService,
             @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
             MHandledMenuItem menuItem) {
+
         boolean canExecute = false;
         MPart part = partService.findPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4);
         canExecute = part.equals(activePart)  //we explicitly want to allow calling the view recursively
                 || part.getObject() == null ;  //we show the menu item only if the view is not yet open (otherwise by setting the focus data will be shown anyway
                                                //but this may change in future for some data where explicitly calling the view is required
 
-
-
         selectedObjectList = null;
         if (canExecute){
             String commandId = menuItem.getCommand().getElementId();
index 7f8222b2c62c194a3580c833034f34ae6e12d0cc..7c68a48d21a33f9bbdc955939f1ad91b7ed1401b 100644 (file)
@@ -1276,10 +1276,6 @@ public class CdmFormFactory extends FormToolkit {
      * Creates a section as a part of the form.
      *
      * @return the section widget
-     * @param section
-     *            a
-     *            {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-     *            object.
      */
     public Section adapt(AbstractFormSection section) {
         section.setMenu(section.getLayoutComposite().getMenu());
index d052d17091ad9b16b9f13899a4aa34e8d46b453b..a349cedf796784c094622d3f46e5a3f790df4442 100644 (file)
@@ -1,25 +1,19 @@
 /**
 * 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.
 */
-
 package eu.etaxonomy.taxeditor.ui.element;
 
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Composite;
 
-
-
 /**
- * <p>RootElement class.</p>
- *
  * @author n.hoffmann
  * @created May 27, 2010
- * @version 1.0
  */
 public class RootElement extends AbstractCdmFormElement {
 
@@ -33,12 +27,10 @@ public class RootElement extends AbstractCdmFormElement {
                super(formFactory, layoutComposite);
        }
 
-       /** {@inheritDoc} */
        @Override
        public void setBackground(Color color) {
                for(ICdmFormElement element : getElements()){
                        element.setBackground(color);
                }
        }
-       
-}
+}
\ No newline at end of file
index 8e4d72b94e7925ef61deb078463a7779f4633177..b20549d2cc9ee746537dcba3ad6cb1729a8f1a81 100644 (file)
@@ -86,22 +86,30 @@ public class CdmViewerUtilE4 {
         return commandViewerNameMap;
     }
 
-
-    public static List<UuidAndTitleCache<? extends ICdmBase>> transformSelectionToUuidAndTitleCacheList(Object selectedObject) {
+    /**
+     * Trys to create a List of {@link UuidAndTitleCache} from the selection.<BR>
+     * Selections which are not recognized are not included in the list.<BR>
+     * As a minimum each returned element contains the type and the uuid.
+     * If available also the label and the CdmBase entity is added (later by using the subclass {@link DtoWithEntity}.
+     * Label creation is not forced (TODO maybe in future we should have a parameter forceLabelCreation)
+     * @param
+     * @return list of {@link UuidAndTitleCache}
+     */
+    public static List<UuidAndTitleCache<? extends ICdmBase>> transformSelectionToUuidAndTitleCacheList(Object selection) {
 
         //make it all a list
         List<Object> multipleSelection = new ArrayList<>();
-        if(selectedObject instanceof IStructuredSelection){
-            IStructuredSelection selection = ((IStructuredSelection) selectedObject);
-            ((List<?>)selection.toList()).forEach(o->multipleSelection.add(o));
-        }else if(selectedObject.getClass().isArray()){
-            for (Object o : ((Object[])selectedObject)){
+        if(selection instanceof IStructuredSelection){
+            IStructuredSelection structuredSelection = ((IStructuredSelection) selection);
+            ((List<?>)structuredSelection.toList()).forEach(o->multipleSelection.add(o));
+        }else if(selection.getClass().isArray()){
+            for (Object o : ((Object[])selection)){
                 multipleSelection.add(o);
             }
-        }else if(selectedObject instanceof List){
-            multipleSelection.addAll((List<?>)selectedObject);
+        }else if(selection instanceof List){
+            multipleSelection.addAll((List<?>)selection);
         }else{
-            multipleSelection.add(selectedObject);
+            multipleSelection.add(selection);
         }
 
         //filter all as uuidIdAndTitleCache
index 4342b49c42f342d636a280322bfc39f0fbf95481..a5f1415d17f547797d542cbfac25d3989cc84407 100644 (file)
@@ -119,7 +119,6 @@ public abstract class AbstractCdmDataViewerE4 extends Viewer implements IConvers
                ContextInjectionFactory.inject(formFactory, context);
        }
 
-       /** {@inheritDoc} */
        @Override
        public Control getControl() {
            if(body!=null){
@@ -134,7 +133,6 @@ public abstract class AbstractCdmDataViewerE4 extends Viewer implements IConvers
                return body;
        }
 
-       /** {@inheritDoc} */
        @Override
        public void setInput(Object input) {
                this.input = input;
@@ -147,13 +145,11 @@ public abstract class AbstractCdmDataViewerE4 extends Viewer implements IConvers
                }
        }
 
-       /** {@inheritDoc} */
        @Override
        public Object getInput() {
                return input;
        }
 
-       /** {@inheritDoc} */
        @Override
        public void refresh() {
                showParts();
index 1bab66967d43dea093442eeb1978c184312812db..8ee2d4b1efa714d45216ea149bc895ffa508a44e 100644 (file)
@@ -158,13 +158,13 @@ public abstract class AbstractCdmEditorPartE4
            }catch(SWTException e){
               logger.debug("Something went wrong for viewer.getControl().setEnabled(true) in " + this.getClass().getSimpleName(), e);
            }
-
         }
 
-        if((previousSelection!=null && selection!=null) && (activePart != null &&  selectionProvidingPart != null && activePart.equals(selectionProvidingPart)) &&
-                (previousSelection==selection
-                || previousSelection.equals(selection)
-                || new StructuredSelection(selection).equals(previousSelection))
+        if((previousSelection!=null && selection!=null)
+               && (activePart != null &&  selectionProvidingPart != null && activePart.equals(selectionProvidingPart))
+               && (previousSelection==selection
+                    || previousSelection.equals(selection)
+                    || new StructuredSelection(selection).equals(previousSelection))
                 ) {
             return;
         }
@@ -214,7 +214,7 @@ public abstract class AbstractCdmEditorPartE4
                 return;
             }
             viewer.getControl().setEnabled(true);
-            if(selection.getFirstElement()!=null){
+            if(element != null){
                 if (element instanceof Taxon){
 
                     Taxon taxon = HibernateProxyHelper.deproxy(element, Taxon.class);
@@ -223,7 +223,7 @@ public abstract class AbstractCdmEditorPartE4
                         if (node != null){
                             boolean doEnable = CdmStore.currentAuthentiationHasPermission(node,
                                     RequiredPermissions.TAXON_EDIT);
-                             if (!doEnable){
+                            if (!doEnable){
                                  //check whether there are explicit TaxonNode rights
                                  boolean taxonnodePermissionExists = false;
                                  Collection<? extends GrantedAuthority> authorities = CdmStore.getCurrentAuthentiation().getAuthorities();
@@ -235,13 +235,11 @@ public abstract class AbstractCdmEditorPartE4
                                  if (!taxonnodePermissionExists){
                                      doEnable = true;
                                  }
-                             }
+                            }
 
                             //TODO: differ between the views
                             this.isEnabled = doEnable;
                         }
-
-
                     }
                     if (taxon.isMisapplication() || taxon.isProparteSynonym() ){
 
@@ -259,10 +257,9 @@ public abstract class AbstractCdmEditorPartE4
                                 }
                             }
                         }
-
-
                     }
                 }
+
                 //unwrap term DTOs
                 if(element instanceof TermDto){
                     element = CdmStore.getService(ITermService.class).load(((TermDto) element).getUuid());
@@ -318,11 +315,10 @@ public abstract class AbstractCdmEditorPartE4
                             null,
                             e,
                             true);
-
                 }
             }
-
         }
+
         reset();
         if(thisPart!=null){
             thisPart.setLabel(getViewName());
index add20a91b9aaee3fb484ec1a2ec7f1acb28515f6..2e1af647536d7157e195ce6e7f51990c7dce295f 100755 (executable)
@@ -227,7 +227,6 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         }
     }
 
-    /** {@inheritDoc} */
     @Override
     protected void showParts() {
         // FIXME (CM) : Need to clean out this code.
index f4420d7de21230f8471444425bf0fc46e1efe92b..9bbbe709c046d2e1b849d24cba181c3d663efda4 100644 (file)
@@ -134,7 +134,6 @@ public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
                showViewer(structuredSelection, activePart, viewer);
                ((SupplementalDataViewerE4)viewer).setEnabled(isEnabled());
 
-
                return;
            }
         else{
@@ -143,9 +142,6 @@ public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
            }
        }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     protected void showEmptyPage() {
         super.showEmptyPage();
index 40f2fc5f00422e05f812f905e894ef8de316be7e..9b7c2cc9e60c78a9adfb08400dc068ae97bc14c6 100644 (file)
@@ -6,7 +6,6 @@
 * 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.
 */
-
 package eu.etaxonomy.taxeditor.view.e4.supplementaldata;
 
 import javax.inject.Inject;
@@ -47,28 +46,22 @@ import eu.etaxonomy.taxeditor.view.detail.CdmSectionPart;
 import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
 
 /**
- *
  * @author pplitzner
  * @since Aug 10, 2017
- *
  */
 public class SupplementalDataViewerE4 extends AbstractCdmDataViewerE4 {
 
        private boolean showDebug;
 
-       /** {@inheritDoc} */
        @Override
        public ISelection getSelection() {
                return null;
        }
 
-       /** {@inheritDoc} */
        @Override
        public void setSelection(ISelection selection, boolean reveal) {
-
        }
 
-       /** {@inheritDoc} */
        @Override
        protected void showParts() {