JAL-3210 Improvements to eclipse detection. New src tree and SwingJS updated from...
[jalview.git] / src / jalview / gui / FeatureEditor.java
index b829ec7..4fe9a65 100644 (file)
@@ -10,7 +10,6 @@ import jalview.io.FeaturesFile;
 import jalview.schemes.FeatureColour;
 import jalview.util.ColorUtils;
 import jalview.util.MessageManager;
-import jalview.util.dialogrunner.RunResponse;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -100,7 +99,12 @@ public class FeatureEditor
    * 
    * @param alignPanel
    * @param seqs
+   *          one or more Sequence if create is true; a singleton if create is
+   *          false
    * @param feats
+   *          a list of new SequenceFeature instances if create is true,
+   *          otherwise a list of known features for this sequence at this
+   *          position
    * @param create
    *          if true create a new feature, else amend or delete an existing
    *          feature
@@ -223,7 +227,7 @@ public class FeatureEditor
               updateColourButton(mainPanel, colour, featureColour);
             };
           };
-          JalviewColourChooser.showColourChooser(Desktop.getDesktop(),
+          JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(),
                   title, featureColour.getColour(), listener);
         }
         else
@@ -406,18 +410,18 @@ public class FeatureEditor
    */
   public void showDialog()
   {
-    RunResponse okAction = forCreate ? getCreateAction() : getAmendAction();
-    RunResponse cancelAction = getCancelAction();
+         Runnable okAction = forCreate ? getCreateAction() : getAmendAction();
+         Runnable cancelAction = getCancelAction();
 
     /*
      * set dialog action handlers for OK (create/Amend) and Cancel options
      * also for Delete if applicable (when amending features)
      */
-    JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop)
-            .addResponse(0, okAction).addResponse(2, cancelAction);
+    JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane())
+            .setResponseHandler(0, okAction).setResponseHandler(2, cancelAction);
     if (!forCreate)
     {
-      dialog.addResponse(1, getDeleteAction());
+      dialog.setResponseHandler(1, getDeleteAction());
     }
 
     String title = null;
@@ -453,9 +457,9 @@ public class FeatureEditor
    * 
    * @return
    */
-  protected RunResponse getCancelAction()
+  protected Runnable getCancelAction()
   {
-    RunResponse okAction = new RunResponse(JvOptionPane.CANCEL_OPTION)
+       Runnable okAction = new Runnable()
     {
       @Override
       public void run()
@@ -477,12 +481,13 @@ public class FeatureEditor
    * 
    * @return
    */
-  protected RunResponse getCreateAction()
+  protected Runnable getCreateAction()
   {
-    RunResponse okAction = new RunResponse(JvOptionPane.OK_OPTION)
+       Runnable okAction = new Runnable()
     {
       boolean useLastDefaults = features.get(0).getType() == null;
 
+      @Override
       public void run()
       {
         final String enteredType = name.getText().trim();
@@ -535,10 +540,11 @@ public class FeatureEditor
    * 
    * @return
    */
-  protected RunResponse getDeleteAction()
+  protected Runnable getDeleteAction()
   {
-    RunResponse deleteAction = new RunResponse(JvOptionPane.NO_OPTION)
+         Runnable deleteAction = new Runnable()
     {
+      @Override
       public void run()
       {
         SequenceFeature sf = features.get(featureIndex);
@@ -637,9 +643,9 @@ public class FeatureEditor
    * 
    * @return
    */
-  protected RunResponse getAmendAction()
+  protected Runnable getAmendAction()
   {
-    RunResponse okAction = new RunResponse(JvOptionPane.OK_OPTION)
+       Runnable okAction = new Runnable()
     {
       boolean useLastDefaults = features.get(0).getType() == null;
   
@@ -647,6 +653,7 @@ public class FeatureEditor
   
       String featureGroup = group.getText();
   
+      @Override
       public void run()
       {
         final String enteredType = name.getText().trim();