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
.name
.NameRelationshipType
;
17 import eu
.etaxonomy
.taxeditor
.labels
.ILabelImageStrategy
;
18 import eu
.etaxonomy
.taxeditor
.labels
.LabelImageProvider
;
19 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
22 * <p>NameRelationshipTypeMenuPreferences class.</p>
28 public class NameRelationshipTypeMenuPreferences
extends
29 AbstractMenuPreferences
<NameRelationshipType
> {
33 * <p>Constructor for NameRelationshipTypeMenuPreferences.</p>
35 public NameRelationshipTypeMenuPreferences() {
36 super("Name relationship types",
37 "Configure name relationship types",
42 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#createContents(org.eclipse.swt.widgets.Composite)
46 public Control
createContents(Composite parent
) {
47 Control container
= super.createContents(parent
);
48 getTableViewer().setLabelProvider(new NameRelationLabelProvider());
52 public class NameRelationLabelProvider
extends DefinedTermBaseLabelProvider
{
54 private LabelImageProvider labelProvider
;
56 public NameRelationLabelProvider() {
59 ILabelImageStrategy strategy
= LabelImageProvider
.getLabelStrategy(
60 PreferencesUtil
.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null));
61 this.labelProvider
= new LabelImageProvider(strategy
);
65 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences.MenuPreferenceLabelProvider#getColumnImage(java.lang.Object, int)
68 public Image
getColumnImage(Object element
, int columnIndex
) {
69 // The preference page looked lame with images
70 // if (element instanceof NameRelationshipType) {
71 // return labelProvider.getNameRelationImage((NameRelationshipType) element);
73 return super.getColumnImage(element
, columnIndex
);
77 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences.MenuPreferenceLabelProvider#getColumnText(java.lang.Object, int)
80 public String
getColumnText(Object element
, int columnIndex
) {
81 if (element
instanceof NameRelationshipType
) {
82 return labelProvider
.getNameRelationTypeLabel((NameRelationshipType
) element
);
84 return super.getColumnText(element
, columnIndex
);
89 * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTermClass()
93 protected Class
<NameRelationshipType
> getTermClass() {
94 return NameRelationshipType
.class;