ref #8263 Simplify refresh logic hotfix/5.7.1
authorPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 9 May 2019 07:35:45 +0000 (09:35 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 9 May 2019 07:36:42 +0000 (09:36 +0200)
 - refresh is invoked on the entire tree since caching the children
already boosts the performance

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermEditorE4.java

index 5961f5a7a9fdb419119d0cfcd3d7b51d8d9bd14d..35d5d8df78d99cb8a5a6e292a018e4862f359a0e 100644 (file)
@@ -152,29 +152,21 @@ IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContex
                for (Object o : (Collection<?>)objectAffectedByOperation) {
                 if(o instanceof TermVocabularyDto){
                     contentProvider.removeVocabularyFromCache((TermVocabularyDto) o);
-                    viewer.refresh(o);
                 }
                 else if(o instanceof TermDto){
                     contentProvider.removeVocabularyFromCache(((TermDto) o).getVocabularyDto());
-                    viewer.refresh(((TermDto) o).getVocabularyDto());
-                    viewer.refresh(o);
                     itemsToSelect.add((TermDto) o);
                 }
             }
            }
            if(objectAffectedByOperation instanceof TermVocabularyDto){
                contentProvider.removeVocabularyFromCache((TermVocabularyDto) objectAffectedByOperation);
-               viewer.refresh();
                itemsToSelect.add((AbstractTermDto) objectAffectedByOperation);
            }
            else if(objectAffectedByOperation instanceof TermDto){
                TermDto termDto = (TermDto) objectAffectedByOperation;
             itemsToSelect.add(termDto);
             contentProvider.removeVocabularyFromCache(termDto.getVocabularyDto());
-               viewer.refresh(termDto.getVocabularyDto());
-           }
-           else{
-               viewer.refresh(objectAffectedByOperation);
            }
                if(!itemsToSelect.isEmpty()){
                        StructuredSelection selection = new StructuredSelection(itemsToSelect);
@@ -183,6 +175,7 @@ IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContex
                 viewer.expandToLevel(termDto, 1);
             }
                }
+               viewer.refresh();
                return true;
        }
 
@@ -201,17 +194,16 @@ IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContex
             if(term.isInstanceOf(DefinedTermBase.class)){
                 DefinedTermBase definedTermBase = (DefinedTermBase) term;
                 CdmStore.getService(ITermService.class).merge(definedTermBase);
-                viewer.refresh(TermDto.fromTerm(definedTermBase));
             }
             else if(term.isInstanceOf(TermVocabulary.class)){
                 TermVocabulary voc = (TermVocabulary) term;
                 CdmStore.getService(IVocabularyService.class).merge(voc);
-                viewer.refresh(new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType()));
             }
                }
                setDirty(false);
                input.initialiseVocabularies();
         changedTerms.clear();
+        viewer.refresh();
                EventUtility.postEvent(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL, true);
        }