Merge branch 'patch/JAL-4281_idwidthandannotHeight_in_project' into develop
[jalview.git] / src / jalview / gui / FeatureEditor.java
index 6a7bee6..606d843 100644 (file)
@@ -1,16 +1,25 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.gui;
 
-import jalview.api.FeatureColourI;
-import jalview.datamodel.SearchResults;
-import jalview.datamodel.SearchResultsI;
-import jalview.datamodel.SequenceFeature;
-import jalview.datamodel.SequenceI;
-import jalview.gui.JalviewColourChooser.ColourChooserListener;
-import jalview.io.FeaturesFile;
-import jalview.schemes.FeatureColour;
-import jalview.util.ColorUtils;
-import jalview.util.MessageManager;
-
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Dimension;
@@ -39,6 +48,17 @@ import javax.swing.event.ChangeListener;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
 
+import jalview.api.FeatureColourI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.JalviewColourChooser.ColourChooserListener;
+import jalview.io.FeaturesFile;
+import jalview.schemes.FeatureColour;
+import jalview.util.ColorUtils;
+import jalview.util.MessageManager;
+
 /**
  * Provides a dialog allowing the user to add new features, or amend or delete
  * existing features
@@ -233,7 +253,7 @@ public class FeatureEditor
            */
           final String ft = features.get(featureIndex).getType();
           final String type = ft == null ? lastFeatureAdded : ft;
-          FeatureTypeSettings fcc = new FeatureTypeSettings(fr, type);
+          FeatureTypeSettings fcc = new FeatureTypeSettings(fr, type,true);
           fcc.setRequestFocusEnabled(true);
           fcc.requestFocus();
           fcc.addActionListener(new ActionListener()
@@ -414,7 +434,7 @@ public class FeatureEditor
      * 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)
+    JvOptionPane dialog = JvOptionPane.newOptionDialog(ap.alignFrame)
             .setResponseHandler(0, okAction)
             .setResponseHandler(2, cancelAction);
     if (!forCreate)
@@ -456,14 +476,9 @@ public class FeatureEditor
    */
   protected Runnable getCancelAction()
   {
-    Runnable okAction = new Runnable()
-    {
-      @Override
-      public void run()
-      {
-        ap.highlightSearchResults(null);
-        ap.paintAlignment(false, false);
-      }
+    Runnable okAction = () -> {
+      ap.highlightSearchResults(null);
+      ap.paintAlignment(false, false);
     };
     return okAction;
   }
@@ -484,6 +499,7 @@ public class FeatureEditor
     {
       boolean useLastDefaults = features.get(0).getType() == null;
 
+      @Override
       public void run()
       {
         final String enteredType = name.getText().trim();
@@ -538,16 +554,12 @@ public class FeatureEditor
    */
   protected Runnable getDeleteAction()
   {
-    Runnable deleteAction = new Runnable()
-    {
-      public void run()
-      {
-        SequenceFeature sf = features.get(featureIndex);
-        sequences.get(0).getDatasetSequence().deleteFeature(sf);
-        fr.featuresAdded();
-        ap.getSeqPanel().seqCanvas.highlightSearchResults(null);
-        ap.paintAlignment(true, true);
-      }
+    Runnable deleteAction = () -> {
+      SequenceFeature sf = features.get(featureIndex);
+      sequences.get(0).getDatasetSequence().deleteFeature(sf);
+      fr.featuresAdded();
+      ap.getSeqPanel().seqCanvas.highlightSearchResults(null);
+      ap.paintAlignment(true, true);
     };
     return deleteAction;
   }
@@ -648,6 +660,7 @@ public class FeatureEditor
 
       String featureGroup = group.getText();
 
+      @Override
       public void run()
       {
         final String enteredType = name.getText().trim();