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.
9 package eu
.etaxonomy
.taxeditor
.preference
.menu
;
11 import org
.eclipse
.swt
.SWT
;
12 import org
.eclipse
.swt
.events
.SelectionAdapter
;
13 import org
.eclipse
.swt
.events
.SelectionEvent
;
14 import org
.eclipse
.swt
.widgets
.Button
;
15 import org
.eclipse
.swt
.widgets
.Composite
;
16 import org
.eclipse
.ui
.IWorkbenchPreferencePage
;
18 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
19 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
20 import eu
.etaxonomy
.taxeditor
.store
.TermStore
;
23 * Allows the user to choose which <code>Rank</code>s to display in the
24 * <code>PropertySheet</code> drop-down menu for <code>TaxonNameBase</code>.
31 public class RankMenuPreferences
extends AbstractMenuPreferences
<Rank
> implements
32 IWorkbenchPreferencePage
{
34 /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.rank"{trunked}</code> */
35 public static final String PLUGIN_ID
= "eu.etaxonomy.taxeditor.preferences.ranks";
38 * <p>Constructor for RankMenuPreferences.</p>
40 public RankMenuPreferences() {
41 super(TermStore
.getRanks(),
43 "Choose which ranks to display in the property sheet drop-down menu.",
48 * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#createAdditionalContent(org.eclipse.swt.widgets.Composite)
52 protected void createAdditionalContent(Composite container
) {
54 // TODO create option to sort ranks either alphabetically or hierarchically (asc- or descending)
56 final Button checkbox
= new Button(container
, SWT
.CHECK
);
57 checkbox
.setText("Sort ranks hierarchically (default is alphabetically)");
59 checkbox
.setSelection(PreferencesUtil
.getSortRanksHierarchichally());
61 checkbox
.addSelectionListener(new SelectionAdapter() {
63 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
66 public void widgetSelected(SelectionEvent e
) {
67 PreferencesUtil
.setSortRanksHierarchichally(checkbox
.getSelection());
68 refresh(TermStore
.getRanks());
75 * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTermClass()
79 protected Class
<Rank
> getTermClass() {