Type module largely complete.
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / propertysheet / type / wizard / ListTypeWizardPage.java
index 98386f6f53b9c00b62a7d59ef8187034a77e20b7..6c2c20d45292ee875c438c3f709aceae01e93053 100644 (file)
@@ -51,12 +51,11 @@ public class ListTypeWizardPage extends WizardPage {
        /**\r
         * @param name\r
         */\r
-       public ListTypeWizardPage(TaxonNameBase name) {\r
+       public ListTypeWizardPage(TaxonNameBase name, WritableList typeDesignationsList) {\r
                super("");\r
                this.name = name;\r
                \r
-//             this.typeDesignationsList.addAll(name.getSpecimenTypeDesignations());\r
-               createDesignationList();\r
+               this.typeDesignationsList = typeDesignationsList;\r
 \r
                setTitle("Type designations for \""\r
                                + CdmUtil.getDisplayName(name) + "\".");\r
@@ -69,7 +68,6 @@ public class ListTypeWizardPage extends WizardPage {
        private Button btnRemove;\r
        private Button btnEdit;\r
 \r
-       private boolean isZoological = false;\r
        private SpecimenTypeDesignation typeDesignation;\r
        private TableViewer tableViewer;\r
 \r
@@ -84,6 +82,13 @@ public class ListTypeWizardPage extends WizardPage {
 \r
                btnEdit = new Button(container, SWT.NONE);\r
                btnEdit.setText("Edit ...");\r
+               btnEdit.addSelectionListener(new SelectionAdapter() {\r
+                       public void widgetSelected(SelectionEvent e) {\r
+                               if (getSelectedTypeDesignation() != null) {     \r
+                                       createTypeDesignationWizard(getSelectedTypeDesignation());\r
+                               }\r
+                       }\r
+               });\r
 \r
                btnRemove = new Button(container, SWT.NONE);\r
                btnRemove.setText("Remove");\r
@@ -171,18 +176,17 @@ public class ListTypeWizardPage extends WizardPage {
        }\r
        \r
        private void createTypeDesignationWizard(SpecimenTypeDesignation typeDesignation) {\r
-               Wizard wizard = new TypeDesignationWizard(typeDesignation, name);\r
+               Wizard wizard = new TypeDesignationWizard(typeDesignation, name, typeDesignationsList);\r
                \r
                WizardDialog dialog = new WizardDialog(GlobalController.getShell(), wizard);\r
                dialog.create();\r
-               if (dialog.open() == Window.OK) {\r
-                       createDesignationList();\r
-               }\r
+               dialog.open();\r
+//             if (dialog.open() == Window.OK) ...\r
        }\r
 \r
        protected void setEnableTypeDesignationButtons(boolean enabled) {\r
                btnRemove.setEnabled(enabled);\r
-               btnEdit.setEnabled(false);\r
+               btnEdit.setEnabled(enabled);\r
        }\r
 \r
        private Image getTypeDesignationImage(SpecimenTypeDesignation typeDesignation) {\r
@@ -202,10 +206,4 @@ public class ListTypeWizardPage extends WizardPage {
                \r
                return str;\r
        }\r
-       \r
-       private void createDesignationList() {\r
-               this.typeDesignationsList.clear();\r
-               this.typeDesignationsList.addAll(name.getSpecimenTypeDesignations());\r
-       }\r
-\r
 }\r