-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-\r
-package eu.etaxonomy.taxeditor.preference;\r
-\r
-import org.eclipse.jface.dialogs.Dialog;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.layout.GridData;\r
-import org.eclipse.swt.layout.GridLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;\r
-import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;\r
-\r
-/** \r
- * @author p.ciardelli\r
- * @created 05.12.2008\r
- * @version 1.0\r
- */\r
-public class InitNomenclaturalCodePrefDialog extends Dialog {\r
- \r
- /**\r
- * If the user makes no change, or cancels, preferred nom. code will be set to the default\r
- */\r
- private NomenclaturalCode preferredCode = NomenclaturalCodeHelper.getDefaultCode();\r
-\r
- /**\r
- * Create the dialog\r
- * @param parentShell\r
- */\r
- public InitNomenclaturalCodePrefDialog(Shell parentShell) {\r
- super(parentShell);\r
- }\r
- \r
- /**\r
- * Create contents of the dialog\r
- * @param parent\r
- */\r
- @Override\r
- protected Control createDialogArea(Composite parent) {\r
-\r
- Composite container = (Composite) super.createDialogArea(parent);\r
-\r
- // Create label with description of dialog\r
- final Label chooseANomenclaturalLabel = new Label(container, SWT.WRAP);\r
- chooseANomenclaturalLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- chooseANomenclaturalLabel.setText("Welcome to the EDIT Taxonomic Editor.\n\nBefore proceeding, please choose a nomenclatural code. This code will be used to create new names and to parse name text.");\r
-\r
- // Create composite to show radio buttons\r
- final Composite buttonsComposite = new Composite(container, SWT.NONE);\r
- final GridData gd_buttonsComposite = new GridData();\r
- gd_buttonsComposite.horizontalIndent = 20;\r
- buttonsComposite.setLayoutData(gd_buttonsComposite);\r
- buttonsComposite.setLayout(new GridLayout());\r
-\r
- NomenclaturalCode defaultCode = NomenclaturalCodeHelper.getDefaultCode();\r
- \r
- for (final NomenclaturalCode code : NomenclaturalCodeHelper.getSupportedCodes()) {\r
- Button button = new Button(buttonsComposite, SWT.RADIO);\r
- button.setText(NomenclaturalCodeHelper.getDescription(code));\r
- button.setSelection(defaultCode.equals(code));\r
- button.addSelectionListener(new SelectionAdapter() {\r
- public void widgetSelected(SelectionEvent e) {\r
- setPreferredCode(code);\r
- }\r
- });\r
- }\r
- \r
- // More dialog text\r
- String defaultCodeDescription = NomenclaturalCodeHelper.getDescription(defaultCode);\r
- final Label chooseANomenclaturalLabel_1 = new Label(container, SWT.WRAP);\r
- chooseANomenclaturalLabel_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));\r
- chooseANomenclaturalLabel_1.setText("If you hit \"Cancel\", " + defaultCodeDescription + \r
- " will be set as your default nomenclatural code.\n\nYou can change the nomenclatural code at any time in the \"Preferences\" menu.");\r
- //\r
- return container;\r
- }\r
-\r
- protected void setPreferredCode(NomenclaturalCode code) {\r
- this.preferredCode = code;\r
- }\r
-\r
- /**\r
- * Return the initial size of the dialog\r
- */\r
- @Override\r
- protected Point getInitialSize() {\r
- return new Point(500, 375);\r
- }\r
- \r
- protected void configureShell(Shell newShell) {\r
- super.configureShell(newShell);\r
- newShell.setText("Choose a nomenclatural code");\r
- }\r
- \r
- public boolean close() {\r
- \r
- // Save preferred nomenclatural code before closing\r
- PreferencesUtil.setPreferredNomenclaturalCode(preferredCode);\r
- \r
- return super.close();\r
- }\r
- \r
- \r
-}\r
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.preference;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
+
+/**
+ * <p>InitNomenclaturalCodePrefDialog class.</p>
+ *
+ * @author p.ciardelli
+ * @created 05.12.2008
+ * @version 1.0
+ */
+public class InitNomenclaturalCodePrefDialog extends Dialog {
+
+ /**
+ * If the user makes no change, or cancels, preferred nom. code will be set to the default
+ */
+ private NomenclaturalCode preferredCode = NomenclaturalCodeHelper.getDefaultCode();
+
+ /**
+ * Create the dialog
+ *
+ * @param parentShell a {@link org.eclipse.swt.widgets.Shell} object.
+ */
+ public InitNomenclaturalCodePrefDialog(Shell parentShell) {
+ super(parentShell);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Create contents of the dialog
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ Composite container = (Composite) super.createDialogArea(parent);
+
+ // Create label with description of dialog
+ final Label chooseANomenclaturalLabel = new Label(container, SWT.WRAP);
+ chooseANomenclaturalLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ chooseANomenclaturalLabel.setText("Welcome to the EDIT Taxonomic Editor.\n\nBefore proceeding, please choose a nomenclatural code. This code will be used to create new names and to parse name text.");
+
+ // Create composite to show radio buttons
+ final Composite buttonsComposite = new Composite(container, SWT.NONE);
+ final GridData gd_buttonsComposite = new GridData();
+ gd_buttonsComposite.horizontalIndent = 20;
+ buttonsComposite.setLayoutData(gd_buttonsComposite);
+ buttonsComposite.setLayout(new GridLayout());
+
+ NomenclaturalCode defaultCode = NomenclaturalCodeHelper.getDefaultCode();
+
+ for (final NomenclaturalCode code : NomenclaturalCodeHelper.getSupportedCodes()) {
+ Button button = new Button(buttonsComposite, SWT.RADIO);
+ button.setText(NomenclaturalCodeHelper.getDescription(code));
+ button.setSelection(defaultCode.equals(code));
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ setPreferredCode(code);
+ }
+ });
+ }
+
+ // More dialog text
+ String defaultCodeDescription = NomenclaturalCodeHelper.getDescription(defaultCode);
+ final Label chooseANomenclaturalLabel_1 = new Label(container, SWT.WRAP);
+ chooseANomenclaturalLabel_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ chooseANomenclaturalLabel_1.setText("If you hit \"Cancel\", " + defaultCodeDescription +
+ " will be set as your default nomenclatural code.\n\nYou can change the nomenclatural code at any time in the \"Preferences\" menu.");
+ //
+ return container;
+ }
+
+ /**
+ * <p>Setter for the field <code>preferredCode</code>.</p>
+ *
+ * @param code a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
+ */
+ protected void setPreferredCode(NomenclaturalCode code) {
+ this.preferredCode = code;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Return the initial size of the dialog
+ */
+ @Override
+ protected Point getInitialSize() {
+ return new Point(500, 375);
+ }
+
+ /** {@inheritDoc} */
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText("Choose a nomenclatural code");
+ }
+
+ /**
+ * <p>close</p>
+ *
+ * @return a boolean.
+ */
+ public boolean close() {
+
+ // Save preferred nomenclatural code before closing
+ PreferencesUtil.setPreferredNomenclaturalCode(preferredCode);
+
+ return super.close();
+ }
+
+
+}