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
.preference
.menu
.AbstractMenuPreferences
.MenuPreferenceLabelProvider
;
22 import eu
.etaxonomy
.taxeditor
.store
.VocabularyStore
;
29 public class NameRelationshipTypeMenuPreferences
extends
30 AbstractMenuPreferences
<NameRelationshipType
> {
33 public NameRelationshipTypeMenuPreferences() {
34 super(VocabularyStore
.getNameRelationshipTypes(),
35 "Name relationship types",
36 "Configure name relationship types",
41 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#createContents(org.eclipse.swt.widgets.Composite)
44 public Control
createContents(Composite parent
) {
45 Control container
= super.createContents(parent
);
46 getTableViewer().setLabelProvider(new NameRelationLabelProvider());
50 public class NameRelationLabelProvider
extends MenuPreferenceLabelProvider
{
52 private LabelImageProvider labelProvider
;
54 public NameRelationLabelProvider() {
57 ILabelImageStrategy strategy
= LabelImageProvider
.getLabelStrategy(
58 PreferencesUtil
.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null));
59 this.labelProvider
= new LabelImageProvider(strategy
);
63 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences.MenuPreferenceLabelProvider#getColumnImage(java.lang.Object, int)
66 public Image
getColumnImage(Object element
, int columnIndex
) {
67 // The preference page looked lame with images
68 // if (element instanceof NameRelationshipType) {
69 // return labelProvider.getNameRelationImage((NameRelationshipType) element);
71 return super.getColumnImage(element
, columnIndex
);
75 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences.MenuPreferenceLabelProvider#getColumnText(java.lang.Object, int)
78 public String
getColumnText(Object element
, int columnIndex
) {
79 if (element
instanceof NameRelationshipType
) {
80 return labelProvider
.getNameRelationTypeLabel((NameRelationshipType
) element
);
82 return super.getColumnText(element
, columnIndex
);