JAL-3446 JAL-3253 Preferences
authorBobHanson <hansonr@stolaf.edu>
Tue, 2 Jun 2020 15:20:30 +0000 (10:20 -0500)
committerBobHanson <hansonr@stolaf.edu>
Tue, 2 Jun 2020 15:20:30 +0000 (10:20 -0500)
- unnecessary static initialization of StructureViewer

src/jalview/gui/Preferences.java
src/jalview/jbgui/GPreferences.java

index de67768..55345e0 100755 (executable)
@@ -444,8 +444,11 @@ public class Preferences extends GPreferences
     addSecondaryStructure.setEnabled(structSelected);
     addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false));
     addTempFactor.setEnabled(structSelected);
-    structViewer.setSelectedItem(
+    if (!Platform.isJS())
+    {
+      structViewer.setSelectedItem(
             Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name()));
+    }
     chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, ""));
     chimeraPath.addActionListener(new ActionListener()
     {
index 6de3888..60f17ab 100755 (executable)
@@ -1284,20 +1284,23 @@ public class GPreferences extends JPanel
     viewerLabel.setBounds(new Rectangle(10, ypos, 200, height));
     structureTab.add(viewerLabel);
 
-    structViewer.setFont(LABEL_FONT);
-    structViewer.setBounds(new Rectangle(160, ypos, 120, height));
-    structViewer.addItem(ViewerType.JMOL.name());
-    structViewer.addItem(ViewerType.CHIMERA.name());
-    structViewer.addActionListener(new ActionListener()
+    if (!Platform.isJS())
     {
-      @Override
-      public void actionPerformed(ActionEvent e)
+      structViewer.setFont(LABEL_FONT);
+      structViewer.setBounds(new Rectangle(160, ypos, 120, height));
+      structViewer.addItem(ViewerType.JMOL.name());
+      structViewer.addItem(ViewerType.CHIMERA.name());
+      structViewer.addActionListener(new ActionListener()
       {
-        structureViewer_actionPerformed(
-                (String) structViewer.getSelectedItem());
-      }
-    });
-    structureTab.add(structViewer);
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          structureViewer_actionPerformed(
+                  (String) structViewer.getSelectedItem());
+        }
+      });
+      structureTab.add(structViewer);
+    }
 
     ypos += lineSpacing;
     JLabel pathLabel = new JLabel();
@@ -1360,14 +1363,14 @@ public class GPreferences extends JPanel
     /*
      * hide Chimera options in JalviewJS
      */
-    if (Platform.isJS()) 
+    if (Platform.isJS())
     {
       pathLabel.setVisible(false);
       chimeraPath.setVisible(false);
       viewerLabel.setVisible(false);
       structViewer.setVisible(false);
     }
-    
+
     return structureTab;
   }