ref #9025 fixing button color issue
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Wed, 17 Jun 2020 10:42:50 +0000 (12:42 +0200)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Wed, 17 Jun 2020 10:42:59 +0000 (12:42 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java

index c76d219ca6f378a0bf6bac32060402d4eebddb19..b8d603689de6e3927a53b53601ce8c5ae2a643c4 100644 (file)
@@ -35,6 +35,7 @@ import org.eclipse.swt.events.MouseAdapter;
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -113,7 +114,6 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
     private final static String MESG_UPDATE_SCHEMA_VERSION = Messages.RemotingLoginDialog_MSG_UPDATE_SCHEMA_VERSION;
 
     private static final int BTN_COLOR_ATTENTION = SWT.COLOR_RED;
-    private static final int BTN_COLOR_DEFAULT = SWT.COLOR_BLACK;
 
     private final static String STORE_PREFERENCES_NODE = "eu.etaxonomy.taxeditor.store"; //$NON-NLS-1$
 
@@ -960,7 +960,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         String instanceStatus = STATUS_NOT_AVAILABLE;
         String message = null;
         String connect = LABEL_CONNECT;
-        int color = BTN_COLOR_DEFAULT;
+        Integer color = null;
         String schemaVersion = CdmMetaData.getDbSchemaVersion();
 
         if (!schemaExists(selectedCdmInstance)){
@@ -996,12 +996,16 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         setMessage(message);
     }
 
-    private void setManagedValues(boolean available, String instanceStatus, String connect, int color,
+    private void setManagedValues(boolean available, String instanceStatus, String connect, Integer color,
             String schemaVersion) {
         Display.getDefault().syncExec(()->{
             btnConnect.setEnabled(available);
             btnConnect.setText(connect);
-            btnConnect.setBackground(Display.getCurrent().getSystemColor(color));
+            Color systemColor = null;
+            if(color != null) {
+                systemColor = Display.getCurrent().getSystemColor(color);
+            }
+            btnConnect.setBackground(systemColor);
             btnConnect.requestLayout();
             txtCdmInstanceStatus.setText(instanceStatus);
             txtServerSchemaVersion.setText(schemaVersion);
@@ -1253,7 +1257,7 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
         setMessage(""); //$NON-NLS-1$
         txtServerSchemaVersion.setText(""); //$NON-NLS-1$
         btnConnect.setText(LABEL_CONNECT);
-        btnConnect.setBackground(Display.getCurrent().getSystemColor(BTN_COLOR_DEFAULT));
+        btnConnect.setBackground(null);
         btnConnect.requestLayout();
     }