JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / gui / SliderPanel.java
index 0a80292..46b47a2 100755 (executable)
 package jalview.gui;
 
 import jalview.analysis.Conservation;
-import jalview.bin.Instance;
 import jalview.datamodel.SequenceGroup;
 import jalview.jbgui.GSliderPanel;
 import jalview.renderer.ResidueShaderI;
 import jalview.util.MessageManager;
 
+import java.awt.event.ActionEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.beans.PropertyVetoException;
@@ -45,11 +45,14 @@ import javax.swing.event.InternalFrameEvent;
  * @author $author$
  * @version $Revision$
  */
-@SuppressWarnings("serial")
 public class SliderPanel extends GSliderPanel
 {
   private static final String BACKGROUND = "Background";
 
+  static JInternalFrame conservationSlider;
+
+  static JInternalFrame PIDSlider;
+
   AlignmentPanel ap;
 
   boolean forConservation = true;
@@ -63,12 +66,6 @@ public class SliderPanel extends GSliderPanel
    */
   public static SliderPanel getSliderPanel()
   {
-
-    JInternalFrame conservationSlider = Instance
-            .getDesktop().conservationSlider;
-
-    JInternalFrame PIDSlider = Instance.getDesktop().PIDSlider;
-
     if (conservationSlider != null && conservationSlider.isVisible())
     {
       return (SliderPanel) conservationSlider.getContentPane();
@@ -156,14 +153,10 @@ public class SliderPanel extends GSliderPanel
   {
     SliderPanel sliderPanel = null;
 
-    JInternalFrame conservationSlider = Instance
-            .getDesktop().conservationSlider;
-
     if (conservationSlider == null)
     {
       sliderPanel = new SliderPanel(ap, rs.getConservationInc(), true, rs);
-      conservationSlider = Instance
-              .getDesktop().conservationSlider = new JInternalFrame();
+      conservationSlider = new JInternalFrame();
       conservationSlider.setContentPane(sliderPanel);
       conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);
     }
@@ -199,14 +192,12 @@ public class SliderPanel extends GSliderPanel
    */
   public static void hidePIDSlider()
   {
-    JInternalFrame PIDSlider = Instance.getDesktop().PIDSlider;
-
     if (PIDSlider != null)
     {
       try
       {
         PIDSlider.setClosed(true);
-        Instance.getDesktop().PIDSlider = null;
+        PIDSlider = null;
       } catch (PropertyVetoException ex)
       {
       }
@@ -218,15 +209,12 @@ public class SliderPanel extends GSliderPanel
    */
   public static void hideConservationSlider()
   {
-    JInternalFrame conservationSlider = Instance
-            .getDesktop().conservationSlider;
-
     if (conservationSlider != null)
     {
       try
       {
         conservationSlider.setClosed(true);
-        Instance.getDesktop().conservationSlider = null;
+        conservationSlider = null;
       } catch (PropertyVetoException ex)
       {
       }
@@ -240,9 +228,6 @@ public class SliderPanel extends GSliderPanel
   {
     hidePIDSlider();
 
-    JInternalFrame conservationSlider = Instance
-            .getDesktop().conservationSlider;
-
     if (!conservationSlider.isVisible())
     {
       Desktop.addInternalFrame(conservationSlider,
@@ -253,7 +238,7 @@ public class SliderPanel extends GSliderPanel
         @Override
         public void internalFrameClosed(InternalFrameEvent e)
         {
-          Instance.getDesktop().conservationSlider = null;
+          conservationSlider = null;
         }
       });
       conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);
@@ -279,12 +264,10 @@ public class SliderPanel extends GSliderPanel
 
     SliderPanel sliderPanel = null;
 
-    JInternalFrame PIDSlider = Instance.getDesktop().PIDSlider;
-
     if (PIDSlider == null)
     {
       sliderPanel = new SliderPanel(ap, threshold, false, rs);
-      PIDSlider = Instance.getDesktop().PIDSlider = new JInternalFrame();
+      PIDSlider = new JInternalFrame();
       PIDSlider.setContentPane(sliderPanel);
       PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
     }
@@ -322,8 +305,6 @@ public class SliderPanel extends GSliderPanel
   {
     hideConservationSlider();
 
-    JInternalFrame PIDSlider = Instance.getDesktop().PIDSlider;
-
     if (!PIDSlider.isVisible())
     {
       Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), true,
@@ -334,7 +315,7 @@ public class SliderPanel extends GSliderPanel
         @Override
         public void internalFrameClosed(InternalFrameEvent e)
         {
-          Instance.getDesktop().PIDSlider = null;
+          PIDSlider = null;
         }
       });
       PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
@@ -470,7 +451,7 @@ public class SliderPanel extends GSliderPanel
 
   public static int getConservationValue()
   {
-    return getValue(Instance.getDesktop().conservationSlider);
+    return getValue(conservationSlider);
   }
 
   static int getValue(JInternalFrame slider)
@@ -481,7 +462,7 @@ public class SliderPanel extends GSliderPanel
 
   public static int getPIDValue()
   {
-    return getValue(Instance.getDesktop().PIDSlider);
+    return getValue(PIDSlider);
   }
 
   /**
@@ -504,10 +485,6 @@ public class SliderPanel extends GSliderPanel
   public String getTitle()
   {
     String title = null;
-    JInternalFrame conservationSlider = Instance
-            .getDesktop().conservationSlider;
-    JInternalFrame PIDSlider = Instance.getDesktop().PIDSlider;
-
     if (isForConservation())
     {
       if (conservationSlider != null)