Fix label type info
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 3 Nov 2015 07:26:32 +0000 (08:26 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 3 Nov 2015 07:26:32 +0000 (08:26 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java

index 5c9d85d31108d1ff401f4f82e6c68596a8cf4650..178c3f7f598010b1214797bbf3a6fbbe254c1991 100644 (file)
@@ -238,7 +238,7 @@ public class DerivateView extends AbstractCdmViewPart implements IPartContentHas
                 }
             }
             viewer.setInput(rootElements);
-            refreshTree();
+            refreshTree(false);
             previousCdmEntitySession.bind();
         }
     }
@@ -369,9 +369,22 @@ public class DerivateView extends AbstractCdmViewPart implements IPartContentHas
      * Refreshes the derivate hierarchy tree
      */
     public void refreshTree(){
+        refreshTree(true);
+    }
+
+    /**
+     * Refreshes the derivate hierarchy tree
+     * @param refreshViewer if <code>true</code> then also the
+     * viewer will be refreshed. This was implemented due to
+     * performance reasons. If passing <code>false</code>
+     * does what was expected use <code>false</code> preferably.
+     */
+    public void refreshTree(boolean refreshViewer){
         //refresh typedesignations
         labelProvider.refresh();
-        viewer.refresh();
+        if(refreshViewer){
+            viewer.refresh();
+        }
     }
 
     //FIXME:Remoting hack to make this work for remoting
index 06116c3f3156d6e04dd715443c4ea606aca67177..ad1ec3cf1198e5ad65c0372b6fdbb11960bd8355 100644 (file)
@@ -230,7 +230,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
             DerivedUnit derivedUnit = (DerivedUnit)derivate;
             if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
                 //check for type designation
-                if(typeDesignations.isEmpty()){
+                if(typeDesignations.get(derivedUnit)==null){
                     for (SpecimenTypeDesignation specimenTypeDesignation : CdmStore.getService(IOccurrenceService.class).listTypeDesignations(derivedUnit, null, null, null, null)) {
                         addTypeDesignation(derivedUnit, specimenTypeDesignation);
                     }
@@ -414,13 +414,13 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
      * @param multiLinkSingleReads
      */
     public void refresh() {
-        this.multiLinkSingleReads = new HashSet<SingleRead>();
+        DerivateLabelProvider.multiLinkSingleReads = new HashSet<SingleRead>();
         for(Entry<SingleRead, Collection<Sequence>> entry:CdmStore.getService(ISequenceService.class).getSingleReadSequencesMap().entrySet()){
             if(entry.getValue().size()>1){
                 multiLinkSingleReads.add(entry.getKey());
             }
         }
-        this.typeDesignations = new HashMap<DerivedUnit, List<SpecimenTypeDesignation>>();
+        DerivateLabelProvider.typeDesignations = new HashMap<DerivedUnit, List<SpecimenTypeDesignation>>();
     }
 
     private static void addTypeDesignation(DerivedUnit derivedUnit, SpecimenTypeDesignation typeDesignation){