remmoved setting of database name to empty when cloning
authorCherian Mathew <c.mathew@bgbm.org>
Thu, 8 May 2014 08:30:39 +0000 (08:30 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Thu, 8 May 2014 08:30:39 +0000 (08:30 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceCredentialsWizardPage.java

index 7fce2d5dd6ecbb3baae8654ceffeaeb0cb9e0a27..ce01a198a15c74cdc477729bccb0f39b221d9b1d 100644 (file)
@@ -168,13 +168,8 @@ public abstract class CdmDataSourceCredentialsWizardPage extends WizardPage impl
                setControl(composite);
                                
                init();
-               
-               if(mode == CdmDataSourceWizard.Mode.CLONE) {
-                       getDataSource().setName("");
-                       getDataSource().setDatabase("");
-                       text_dataSourceName.setText("");
-                       text_databaseName.setText("");
-               }
+
+                               
        }
 
        /**
@@ -231,6 +226,14 @@ public abstract class CdmDataSourceCredentialsWizardPage extends WizardPage impl
                // add listeners after setting text to avoid the modify event being called
                // for the initial value
                addListeners();
+               
+               // in the case of cloning we use the same datasource info
+               // except for the name
+               if(mode == CdmDataSourceWizard.Mode.CLONE) {
+                       getDataSource().setName("");                    
+                       text_dataSourceName.setText("");                        
+               }
+               
        }
        
        private void addListeners() {
@@ -387,7 +390,7 @@ public abstract class CdmDataSourceCredentialsWizardPage extends WizardPage impl
         */
        /** {@inheritDoc} */
        public void modifyText(ModifyEvent e) {
-               //this.setPageComplete(false);
+               
                name = text_dataSourceName.getText();
                database = text_databaseName.getText();
 
@@ -410,6 +413,7 @@ public abstract class CdmDataSourceCredentialsWizardPage extends WizardPage impl
                                name = "";
                                setErrorMessage("DataSource name must not be empty.");
                                this.setPageComplete(false);
+                               return;
                        } else if (CdmDataSourceRepository.getDataSource(name) != null) {
                                name = "";
                                setErrorMessage("DataSource with the same name already exists");