fix #8162 adapt terms to new package structure in TaxEditor
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / preference / menu / RankMenuPreferences.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9 package eu.etaxonomy.taxeditor.preference.menu;
10
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
17 import eu.etaxonomy.cdm.model.term.TermType;
18 import eu.etaxonomy.cdm.model.name.Rank;
19 import eu.etaxonomy.taxeditor.l10n.Messages;
20 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
21
22 /**
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>.
25 *
26 * @author p.ciardelli
27 * @author n.hoffmann
28 * @created 17.09.2008
29 * @version 1.0
30 */
31 public class RankMenuPreferences extends AbstractMenuPreferences<Rank> {
32
33 /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.rank"{trunked}</code> */
34 public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.ranks"; //$NON-NLS-1$
35
36 /**
37 * <p>Constructor for RankMenuPreferences.</p>
38 */
39 public RankMenuPreferences() {
40 super("Rank Preferences", //$NON-NLS-1$
41 Messages.RankMenuPreferences_display,
42 false);
43 }
44
45 /** {@inheritDoc} */
46 @Override
47 protected void createAdditionalContent(Composite container) {
48
49 final Button checkbox = new Button(container, SWT.CHECK);
50 checkbox.setText(Messages.RankMenuPreferences_sort);
51
52 checkbox.setSelection(PreferencesUtil.getSortRanksHierarchichally());
53
54 checkbox.addSelectionListener(new SelectionAdapter() {
55 /* (non-Javadoc)
56 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
57 */
58 @Override
59 public void widgetSelected(SelectionEvent e) {
60
61 PreferencesUtil.setSortRanksHierarchichally(checkbox.getSelection());
62
63 }
64 });
65
66 }
67
68 /** {@inheritDoc} */
69 @Override
70 protected TermType getTermType() {
71 return TermType.Rank;
72 }
73
74 }