Project

General

Profile

Revision c5a8e428

IDc5a8e428d4d57519155bcfdd9e7c8c71a55feff3
Parent b5bbb82f
Child baa11275

Added by Katja Luther over 5 years ago

#5910 if the default language of the editor is not available then the Language.Default representation is used

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermLabelProvider.java
9 9
 */
10 10
package eu.etaxonomy.taxeditor.editor.definedterm;
11 11

  
12
import java.util.ArrayList;
13

  
12 14
import org.apache.commons.lang.StringUtils;
13 15
import org.eclipse.jface.viewers.StyledCellLabelProvider;
14 16
import org.eclipse.jface.viewers.StyledString;
......
21 23
import org.eclipse.swt.widgets.Display;
22 24

  
23 25
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
26
import eu.etaxonomy.cdm.model.common.Language;
27
import eu.etaxonomy.cdm.model.common.Representation;
24 28
import eu.etaxonomy.cdm.model.common.TermBase;
25 29
import eu.etaxonomy.cdm.model.common.TermVocabulary;
26 30
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
......
84 88

  
85 89
        if (element instanceof DefinedTermBase) {
86 90
            DefinedTermBase<?> dtb = (DefinedTermBase<?>) element;
91

  
92
            Representation rep = dtb.getRepresentation(PreferencesUtil.getGlobalLanguage());
93
            if ( rep == null){
94
                rep = dtb.getPreferredRepresentation(new ArrayList<Language>());
95
            }
87 96
            if (StringUtils.isNotBlank(dtb.getIdInVocabulary())) {
88
                return dtb.getIdInVocabulary() + " : " + dtb.getLabel(PreferencesUtil.getGlobalLanguage());
97
                return dtb.getIdInVocabulary() + " : " + rep.getLabel();
89 98
            } else {
90
                return dtb.getLabel(PreferencesUtil.getGlobalLanguage());
99
                return rep.getLabel();
91 100
            }
101

  
92 102
        } else if (element instanceof TermBase) {
93 103
            return ((TermBase) element).getTitleCache();
94 104
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
292 292
			return "";
293 293
		}else{
294 294
			String termLabel = term.getLabel(CdmStore.getDefaultLanguage());
295
			if (termLabel == null){
296
			    termLabel = term.getLabel();
297
			}
295 298
			if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_VOCABULARY_ID_FOR_TERM_LABELS)
296 299
			    && term.getVocabulary()!=null){
297
			    termLabel += " ["+term.getVocabulary().getLabel(CdmStore.getDefaultLanguage())+"]";
300
			    String vocLabel = term.getVocabulary().getLabel(CdmStore.getDefaultLanguage());
301
			    if (vocLabel == null){
302
			        vocLabel = term.getVocabulary().getLabel();
303
			    }
304
			    termLabel += " ["+vocLabel+"]";
298 305
			}
299 306
            return termLabel;
300 307
		}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)