Project

General

Profile

« Previous | Next » 

Revision f00fe291

Added by Cherian Mathew over 8 years ago

Cache the default feature tree

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.java
38 38
	protected static final Object[] NO_CHILDREN = new Object[0];
39 39
	protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache;
40 40
	private boolean showOnlyIndividualAssociations;
41
	private static FeatureTree defaultFeatureTree = null;
41 42

  
42 43
	public DescriptiveContentProvider(Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache) {
43 44
	    this(featureNodeContainerCache, false);
......
144 145
	 * @return
145 146
	 */
146 147
	private FeatureTree getFeatureTree(DescriptionBase description){
147
		FeatureTree featureTree = null;
148 148

  
149
	    if(defaultFeatureTree == null) {
150
	        defaultFeatureTree = FeatureTree.NewInstance(TermStore.getTerms(Feature.class));
151
	    }
152
	    FeatureTree featureTree;
149 153
		// TODO change this to the feature tree associated with this taxon description
150 154
		if (description.hasStructuredData()){
151 155
			featureTree = PreferencesUtil.getDefaultFeatureTreeForStructuredDescription();
......
155 159

  
156 160
		// create a transient tree with all features if none was selected
157 161
		if(featureTree == null){
158
			featureTree = FeatureTree.NewInstance(TermStore.getTerms(Feature.class));
162
			featureTree = defaultFeatureTree;
159 163
		}
160 164

  
161 165
		return featureTree;

Also available in: Unified diff