Project

General

Profile

« Previous | Next » 

Revision ad568992

Added by Patrick Plitzner almost 5 years ago

ref #8263 Simplify refresh logic

  • refresh is invoked on the entire tree since caching the children already boosts the performance

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermEditorE4.java
152 152
	        for (Object o : (Collection<?>)objectAffectedByOperation) {
153 153
                if(o instanceof TermVocabularyDto){
154 154
                    contentProvider.removeVocabularyFromCache((TermVocabularyDto) o);
155
                    viewer.refresh(o);
156 155
                }
157 156
                else if(o instanceof TermDto){
158 157
                    contentProvider.removeVocabularyFromCache(((TermDto) o).getVocabularyDto());
159
                    viewer.refresh(((TermDto) o).getVocabularyDto());
160
                    viewer.refresh(o);
161 158
                    itemsToSelect.add((TermDto) o);
162 159
                }
163 160
            }
164 161
	    }
165 162
	    if(objectAffectedByOperation instanceof TermVocabularyDto){
166 163
	        contentProvider.removeVocabularyFromCache((TermVocabularyDto) objectAffectedByOperation);
167
	        viewer.refresh();
168 164
	        itemsToSelect.add((AbstractTermDto) objectAffectedByOperation);
169 165
	    }
170 166
	    else if(objectAffectedByOperation instanceof TermDto){
171 167
	        TermDto termDto = (TermDto) objectAffectedByOperation;
172 168
            itemsToSelect.add(termDto);
173 169
            contentProvider.removeVocabularyFromCache(termDto.getVocabularyDto());
174
	        viewer.refresh(termDto.getVocabularyDto());
175
	    }
176
	    else{
177
	        viewer.refresh(objectAffectedByOperation);
178 170
	    }
179 171
		if(!itemsToSelect.isEmpty()){
180 172
			StructuredSelection selection = new StructuredSelection(itemsToSelect);
......
183 175
                viewer.expandToLevel(termDto, 1);
184 176
            }
185 177
		}
178
		viewer.refresh();
186 179
		return true;
187 180
	}
188 181

  
......
201 194
            if(term.isInstanceOf(DefinedTermBase.class)){
202 195
                DefinedTermBase definedTermBase = (DefinedTermBase) term;
203 196
                CdmStore.getService(ITermService.class).merge(definedTermBase);
204
                viewer.refresh(TermDto.fromTerm(definedTermBase));
205 197
            }
206 198
            else if(term.isInstanceOf(TermVocabulary.class)){
207 199
                TermVocabulary voc = (TermVocabulary) term;
208 200
                CdmStore.getService(IVocabularyService.class).merge(voc);
209
                viewer.refresh(new TermVocabularyDto(voc.getUuid(), voc.getRepresentations(), voc.getTermType()));
210 201
            }
211 202
		}
212 203
		setDirty(false);
213 204
		input.initialiseVocabularies();
214 205
        changedTerms.clear();
206
        viewer.refresh();
215 207
		EventUtility.postEvent(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL, true);
216 208
	}
217 209

  

Also available in: Unified diff