3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.preference
.menu
;
13 import org
.eclipse
.swt
.graphics
.Image
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
15 import org
.eclipse
.swt
.widgets
.Control
;
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
;
21 import eu
.etaxonomy
.taxeditor
.store
.TermStore
;
28 public class NameRelationshipTypeMenuPreferences
extends
29 AbstractMenuPreferences
<NameRelationshipType
> {
32 public NameRelationshipTypeMenuPreferences() {
33 super(TermStore
.getNameRelationshipTypes(),
34 "Name relationship types",
35 "Configure name relationship types",
40 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#createContents(org.eclipse.swt.widgets.Composite)
43 public Control
createContents(Composite parent
) {
44 Control container
= super.createContents(parent
);
45 getTableViewer().setLabelProvider(new NameRelationLabelProvider());
49 public class NameRelationLabelProvider
extends DefinedTermBaseLabelProvider
{
51 private LabelImageProvider labelProvider
;
53 public NameRelationLabelProvider() {
56 ILabelImageStrategy strategy
= LabelImageProvider
.getLabelStrategy(
57 PreferencesUtil
.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null));
58 this.labelProvider
= new LabelImageProvider(strategy
);
62 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences.MenuPreferenceLabelProvider#getColumnImage(java.lang.Object, int)
65 public Image
getColumnImage(Object element
, int columnIndex
) {
66 // The preference page looked lame with images
67 // if (element instanceof NameRelationshipType) {
68 // return labelProvider.getNameRelationImage((NameRelationshipType) element);
70 return super.getColumnImage(element
, columnIndex
);
74 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences.MenuPreferenceLabelProvider#getColumnText(java.lang.Object, int)
77 public String
getColumnText(Object element
, int columnIndex
) {
78 if (element
instanceof NameRelationshipType
) {
79 return labelProvider
.getNameRelationTypeLabel((NameRelationshipType
) element
);
81 return super.getColumnText(element
, columnIndex
);