2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.preference
.menu
;
12 import org
.eclipse
.swt
.graphics
.Image
;
13 import org
.eclipse
.swt
.widgets
.Composite
;
14 import org
.eclipse
.swt
.widgets
.Control
;
16 import eu
.etaxonomy
.cdm
.model
.common
.TermType
;
17 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
18 import eu
.etaxonomy
.taxeditor
.labels
.ILabelImageStrategy
;
19 import eu
.etaxonomy
.taxeditor
.labels
.LabelImageProvider
;
20 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
23 * <p>NameRelationshipTypeMenuPreferences class.</p>
29 public class NameRelationshipTypeMenuPreferences
extends
30 AbstractMenuPreferences
<NameRelationshipType
> {
34 * <p>Constructor for NameRelationshipTypeMenuPreferences.</p>
36 public NameRelationshipTypeMenuPreferences() {
37 super("Name relationship types",
38 "Configure name relationship types",
43 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#createContents(org.eclipse.swt.widgets.Composite)
47 public Control
createContents(Composite parent
) {
48 Control container
= super.createContents(parent
);
49 getTableViewer().setLabelProvider(new NameRelationLabelProvider());
53 public class NameRelationLabelProvider
extends DefinedTermBaseLabelProvider
{
55 private LabelImageProvider labelProvider
;
57 public NameRelationLabelProvider() {
60 ILabelImageStrategy strategy
= LabelImageProvider
.getLabelStrategy(
61 PreferencesUtil
.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null));
62 this.labelProvider
= new LabelImageProvider(strategy
);
66 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences.MenuPreferenceLabelProvider#getColumnImage(java.lang.Object, int)
69 public Image
getColumnImage(Object element
, int columnIndex
) {
70 // The preference page looked lame with images
71 // if (element instanceof NameRelationshipType) {
72 // return labelProvider.getNameRelationImage((NameRelationshipType) element);
74 return super.getColumnImage(element
, columnIndex
);
78 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences.MenuPreferenceLabelProvider#getColumnText(java.lang.Object, int)
81 public String
getColumnText(Object element
, int columnIndex
) {
82 if (element
instanceof NameRelationshipType
) {
83 return labelProvider
.getNameRelationTypeLabel((NameRelationshipType
) element
);
85 return super.getColumnText(element
, columnIndex
);
90 * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTermClass()
94 protected TermType
getTermType() {
95 return TermType
.NameRelationshipType
;