Project

General

Profile

Download (2.36 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
import org.eclipse.ui.IWorkbenchPreferencePage;
17

    
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> implements
31
		IWorkbenchPreferencePage {
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";
35

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

    
45
	/* (non-Javadoc)
46
	 * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#createAdditionalContent(org.eclipse.swt.widgets.Composite)
47
	 */
48
	/** {@inheritDoc} */
49
	@Override
50
	protected void createAdditionalContent(Composite container) {
51

    
52
		final Button checkbox = new Button(container, SWT.CHECK);
53
		checkbox.setText("Sort ranks hierarchically (default is alphabetically)");
54

    
55
		checkbox.setSelection(PreferencesUtil.getSortRanksHierarchichally());
56

    
57
		checkbox.addSelectionListener(new SelectionAdapter() {
58
			/* (non-Javadoc)
59
			 * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
60
			 */
61
			@Override
62
			public void widgetSelected(SelectionEvent e) {
63

    
64
				PreferencesUtil.setSortRanksHierarchichally(checkbox.getSelection());
65

    
66
			}
67
		});
68

    
69
	}
70

    
71
	/* (non-Javadoc)
72
	 * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTermClass()
73
	 */
74
	/** {@inheritDoc} */
75
	@Override
76
	protected Class<Rank> getTermClass() {
77
		return Rank.class;
78
	}
79

    
80
}
(16-16/19)