ref #10463 again try to fix disabling database select
authorAndreas Müller <a.mueller@bgbm.org>
Thu, 25 Jan 2024 14:26:50 +0000 (15:26 +0100)
committerAndreas Müller <a.mueller@bgbm.org>
Thu, 25 Jan 2024 14:26:50 +0000 (15:26 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java

index b1573a4e19b808c66e6042fc99d4b50525e48f0a..f45b0cf5cb1c877f5786f990861a0b7086ecba59 100644 (file)
@@ -151,7 +151,9 @@ public class RemotingLoginDialog extends Dialog implements ICdmServerError {
     private Text txtCdmInstanceStatus;
 
     private Combo comboCdmServer;
+    boolean allowServerChange = true;
     private Combo comboCdmInstance;
+    boolean allowInstanceChange = true;
     private Button btnConnect;
 
     private Composite remotingComposite;
@@ -222,10 +224,11 @@ public class RemotingLoginDialog extends Dialog implements ICdmServerError {
             this.setInstanceName(contextPath == null? "" : contextPath.substring(contextPath.lastIndexOf("/") + 1)); //$NON-NLS-1$
         }
         //disable datasource selection if datasource is given, see #10463
-        this.comboCdmServer.setEnabled(false);
-        this.comboCdmServer.setVisible(false);
-        this.comboCdmInstance.setEnabled(false);
-        this.comboCdmInstance.setListVisible(false);
+        
+        allowServerChange = false;
+        allowInstanceChange = false;
+        this.comboCdmServer.setEnabled(allowServerChange);
+        this.comboCdmInstance.setEnabled(allowInstanceChange);
         
         return open(getServerName(), getInstanceName(), loadLoginPrefs, autoConnect);
     }
@@ -589,7 +592,11 @@ public class RemotingLoginDialog extends Dialog implements ICdmServerError {
         getServerInfoMap().put(csii.getName(), csii);
     }
     public void onRefreshCdmServer() {
-        try{
+       if (!allowServerChange) {
+               return;
+        }
+
+       try{
             txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY);
             clearOnServerChange();
             emptyCredentials();
@@ -685,7 +692,11 @@ public class RemotingLoginDialog extends Dialog implements ICdmServerError {
     }
 
     protected void populateCdmInstanceCombo(final boolean forceRefresh) {
-        comboCdmInstance.removeAll();
+        if (!allowInstanceChange) {
+               return;
+        }
+       
+       comboCdmInstance.removeAll();
         comboCdmInstance.setEnabled(false);
         btnConnect.setEnabled(false);
         txtCdmInstanceStatus.setText(STATUS_RETRIEVING);