Project

General

Profile

« Previous | Next » 

Revision d43e5395

Added by Katja Luther about 3 years ago

ref #8471: adapt label provider to show icon for computed descriptions and gray font

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveLabelProvider.java
11 11
import org.eclipse.jface.viewers.ColumnLabelProvider;
12 12
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
13 13
import org.eclipse.jface.viewers.StyledString;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.graphics.Color;
14 16
import org.eclipse.swt.graphics.Image;
17
import org.eclipse.swt.widgets.Display;
15 18

  
16 19
import eu.etaxonomy.cdm.model.description.DescriptionBase;
20
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
17 21
import eu.etaxonomy.cdm.model.description.DescriptionType;
18 22
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.MatrixUtility;
19 23
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
24
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
20 25
import eu.etaxonomy.taxeditor.model.ImageResources;
21 26

  
22 27
/**
......
39 44

  
40 45
	@Override
41 46
    public StyledString getStyledText(Object element) {
42
		return new StyledString(getText(element), StyledString.QUALIFIER_STYLER);
47
	    return new StyledString(getText(element), StyledString.QUALIFIER_STYLER);
43 48
	}
44 49

  
45 50
	@Override
46 51
	public Image getImage(Object element) {
47 52
	    if(element instanceof DescriptionBase){
48 53
	        DescriptionBase<?> description = (DescriptionBase<?>)element;
49
	        if(description.getTypes().contains(DescriptionType.AGGREGATED_STRUC_DESC)){
54
	        if(description.isComputed()){
50 55
	            return MatrixUtility.getAggregatedDescriptionIcon();
51 56
	        }
52 57
	        else if(description.getTypes().contains(DescriptionType.SECONDARY_DATA)){
......
64 69
	    }
65 70
	    return null;
66 71
	}
72

  
73
	@Override
74
    public Color getForeground(Object element) {
75
	    DescriptionBase desc = null;
76
	    if (element instanceof DescriptionBase){
77
	        desc = (DescriptionBase)element;
78
	    }else if (element instanceof DescriptionElementBase){
79
	        desc = ((DescriptionElementBase)element).getInDescription();
80
	    }else if (element instanceof FeatureNodeContainer){
81
	        desc = ((FeatureNodeContainer)element).getDescription();
82
	    }
83
	    if (desc.isComputed()){
84
	        return Display.getCurrent().getSystemColor(SWT.COLOR_GRAY);
85
	    }
86
	    return null;
87
    }
88

  
67 89
}

Also available in: Unified diff