ref #5971: add an admin page to the prefs and add cdm pref nomenclatural code
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / preference / InitNomenclaturalCodePrefDialog.java
index 291c80ffdf1ed8fac71d8d3405e48a6dd87bc656..ae03356050a4166904c701827a869a0d475d4c56 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -33,7 +33,7 @@ import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
  * @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
         */
@@ -47,7 +47,7 @@ public class InitNomenclaturalCodePrefDialog extends Dialog {
        public InitNomenclaturalCodePrefDialog(Shell parentShell) {
                super(parentShell);
        }
-       
+
        /**
         * {@inheritDoc}
         *
@@ -71,23 +71,24 @@ public class InitNomenclaturalCodePrefDialog extends Dialog {
                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) {
+                               @Override
+                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 + 
+               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;
@@ -111,25 +112,27 @@ public class InitNomenclaturalCodePrefDialog extends Dialog {
        protected Point getInitialSize() {
                return new Point(500, 375);
        }
-       
+
        /** {@inheritDoc} */
-       protected void configureShell(Shell newShell) {
+       @Override
+    protected void configureShell(Shell newShell) {
                super.configureShell(newShell);
                newShell.setText("Choose a nomenclatural code");
        }
-               
+
        /**
         * <p>close</p>
         *
         * @return a boolean.
         */
-       public boolean close() {
-               
+       @Override
+    public boolean close() {
+
                // Save preferred nomenclatural code before closing
-               PreferencesUtil.setPreferredNomenclaturalCode(preferredCode);
-               
+               PreferencesUtil.setPreferredNomenclaturalCode(preferredCode, true);
+
                return super.close();
        }
-       
-       
+
+
 }