Project

General

Profile

Revision 835c1454

ID835c14544d7f3023c31551b9af030232bc769f30
Parent 0df7b52d
Child 71ef005a

Added by Patrick Plitzner over 2 years ago

ref #7095 Fix label representation for taxon combo

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermUuidComboViewer.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.ui.combo;
10 10

  
11
import org.eclipse.jface.viewers.ComboViewer;
12 11
import org.eclipse.jface.viewers.ILabelProvider;
13 12
import org.eclipse.jface.viewers.IStructuredContentProvider;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.custom.CCombo;
16
import org.eclipse.swt.layout.FillLayout;
17 13
import org.eclipse.swt.widgets.Composite;
18 14

  
19 15
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
......
25 21
 */
26 22
public class TermUuidComboViewer extends AbstractComboComposite<DefinedTermBase>{
27 23

  
28
    private ComboViewer viewer;
29

  
30
    public TermUuidComboViewer(Composite parent, int style){
24
    public TermUuidComboViewer(Composite parent, int style) {
31 25
        super(parent, style);
32
        setLayout(new FillLayout());
33
        viewer = new ComboViewer(new CCombo(this, SWT.READ_ONLY | SWT.SINGLE));
34
        viewer.setContentProvider(new TermUuidContentProvider());
35
        viewer.setLabelProvider(new TermUuidLabelProvider());
36 26
    }
37 27

  
38 28
    @Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/taxon/TaxonNodeCombo.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.ui.combo.taxon;
10 10

  
11
import org.eclipse.jface.viewers.ComboViewer;
12 11
import org.eclipse.jface.viewers.ILabelProvider;
13 12
import org.eclipse.jface.viewers.IStructuredContentProvider;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.custom.CCombo;
16
import org.eclipse.swt.layout.FillLayout;
17 13
import org.eclipse.swt.widgets.Composite;
18 14

  
19 15
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
......
27 23
 */
28 24
public class TaxonNodeCombo extends AbstractComboComposite<TaxonNode>{
29 25

  
30
    private ComboViewer viewer;
31

  
32
    public TaxonNodeCombo(Composite parent, int style){
26
    public TaxonNodeCombo(Composite parent, int style) {
33 27
        super(parent, style);
34
        setLayout(new FillLayout());
35
        viewer = new ComboViewer(new CCombo(this, SWT.READ_ONLY | SWT.SINGLE));
36
        viewer.setContentProvider(new TaxonNodeComboContentProvider());
37
        viewer.setLabelProvider(new TaxonNodeComboLabelProvider());
38 28
    }
39 29

  
40 30
    @Override
41 31
    public String getElementLabel(TaxonNode element) {
42
        return element.getTaxon().getTitleCache();
32
        return element.getTaxon().getName().getTitleCache();
43 33
    }
44 34

  
45 35
    @Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/taxon/TaxonNodeComboLabelProvider.java
25 25
    @Override
26 26
    public String getText(Object element) {
27 27
        if(element instanceof TaxonNode){
28
            return ((TaxonNode) element).getTaxon().getTitleCache();
28
            return ((TaxonNode) element).getTaxon().getName().getTitleCache();
29 29
        }
30 30
        return super.getText(element);
31 31
    }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)