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
.jface
.viewers
.ITableLabelProvider
;
13 import org
.eclipse
.jface
.viewers
.LabelProvider
;
14 import org
.eclipse
.jface
.viewers
.ViewerComparator
;
15 import org
.eclipse
.swt
.graphics
.Image
;
16 import org
.eclipse
.swt
.widgets
.Composite
;
17 import org
.eclipse
.swt
.widgets
.Control
;
19 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
22 * <p>LanguageMenuPreferences class.</p>
28 public class LanguageMenuPreferences
extends AbstractMenuPreferences
<Language
> {
30 /** Constant <code>ID="eu.etaxonomy.taxeditor.preferences.lang"{trunked}</code> */
31 public final static String ID
= "eu.etaxonomy.taxeditor.preferences.languages";
34 * <p>Constructor for LanguageMenuPreferences.</p>
36 public LanguageMenuPreferences() {
37 super("Language Preferences",
38 "Configure language preferences.",
43 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#createContents(org.eclipse.swt.widgets.Composite)
47 public Control
createContents(Composite parent
) {
48 Control control
= super.createContents(parent
);
50 tableViewer
.setLabelProvider(new LanguagePreferenceLabelProvider());
51 tableViewer
.setComparator(new ViewerComparator());
56 class LanguagePreferenceLabelProvider
extends LabelProvider
implements ITableLabelProvider
{
59 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
61 public Image
getColumnImage(Object element
, int columnIndex
) {
66 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
68 public String
getColumnText(Object element
, int columnIndex
) {
69 String description
= ((Language
)element
).getDescription();
70 if (description
== null) {
71 description
= ((Language
)element
).getLabel() + " - Warning: no description - not shown in menus";
79 * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTermClass()
83 protected Class
<Language
> getTermClass() {
84 return Language
.class;