Project

General

Profile

Revision c023c9af

IDc023c9afa5f06499320a897dc034422beb02c572
Parent 26334359
Child 9c419e9e

Added by Andreas Müller almost 4 years ago

Fix NPE in TermLabelProvider

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermLabelProvider.java
22 22
import org.eclipse.swt.graphics.TextStyle;
23 23
import org.eclipse.swt.widgets.Display;
24 24

  
25
import eu.etaxonomy.cdm.common.CdmUtils;
25 26
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
26 27
import eu.etaxonomy.cdm.model.common.Language;
27 28
import eu.etaxonomy.cdm.model.common.Representation;
......
78 79
        return new StyledString(getText(element), StyledString.QUALIFIER_STYLER);
79 80
    }
80 81

  
81
    /*
82
     * (non-Javadoc)
83
     *
84
     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
85
     */
86

  
87 82
    public String getText(Object element) {
88 83

  
89 84
        if (element instanceof DefinedTermBase) {
......
93 88
            if ( rep == null){
94 89
                rep = dtb.getPreferredRepresentation(new ArrayList<Language>());
95 90
            }
96
            if (StringUtils.isNotBlank(dtb.getIdInVocabulary())) {
97
                return dtb.getIdInVocabulary() + " : " + rep.getLabel();
98
            } else {
99
                return rep.getLabel();
100
            }
91
            String label = rep != null? rep.getLabel() : dtb.getTitleCache();
92
            return CdmUtils.concat(" : ", dtb.getIdInVocabulary(), label);
101 93

  
102 94
        } else if (element instanceof TermBase) {
103 95
            return ((TermBase) element).getTitleCache();

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)