Project

General

Profile

Download (2.07 KB) Statistics
| Branch: | Tag: | Revision:
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.common.TermType;
18
import eu.etaxonomy.cdm.model.name.Rank;
19
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
20

    
21
/**
22
 * Allows the user to choose which <code>Rank</code>s to display in the
23
 * <code>PropertySheet</code> drop-down menu for <code>TaxonNameBase</code>.
24
 *
25
 * @author p.ciardelli
26
 * @author n.hoffmann
27
 * @created 17.09.2008
28
 * @version 1.0
29
 */
30
public class RankMenuPreferences extends AbstractMenuPreferences<Rank> {
31

    
32
	/** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.rank"{trunked}</code> */
33
	public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.ranks";
34

    
35
	/**
36
	 * <p>Constructor for RankMenuPreferences.</p>
37
	 */
38
	public RankMenuPreferences() {
39
		super("Rank Preferences",
40
				"Choose which ranks to display in the property sheet drop-down menu.",
41
				false);
42
	}
43

    
44
	/** {@inheritDoc} */
45
	@Override
46
	protected void createAdditionalContent(Composite container) {
47

    
48
		final Button checkbox = new Button(container, SWT.CHECK);
49
		checkbox.setText("Sort ranks hierarchically (default is alphabetically)");
50

    
51
		checkbox.setSelection(PreferencesUtil.getSortRanksHierarchichally());
52

    
53
		checkbox.addSelectionListener(new SelectionAdapter() {
54
			/* (non-Javadoc)
55
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
56
			 */
57
			@Override
58
			public void widgetSelected(SelectionEvent e) {
59

    
60
				PreferencesUtil.setSortRanksHierarchichally(checkbox.getSelection());
61

    
62
			}
63
		});
64

    
65
	}
66

    
67
	/** {@inheritDoc} */
68
	@Override
69
	protected TermType getTermType() {
70
		return TermType.Rank;
71
	}
72

    
73
}
(18-18/21)