JAL-3168 include feature type in colour chooser dialog title
[jalview.git] / src / jalview / gui / FeatureSettings.java
index b82cf86..6a59e19 100644 (file)
@@ -293,8 +293,7 @@ public class FeatureSettings extends JPanel
         if (evt.isPopupTrigger())
         {
           Object colour = table.getValueAt(selectedRow, COLOUR_COLUMN);
-          popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(),
-                  evt.getY());
+          showPopupMenu(selectedRow, type, colour, evt.getPoint());
         }
         else if (evt.getClickCount() == 2)
         {
@@ -315,8 +314,7 @@ public class FeatureSettings extends JPanel
         {
           String type = (String) table.getValueAt(selectedRow, TYPE_COLUMN);
           Object colour = table.getValueAt(selectedRow, COLOUR_COLUMN);
-          popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(),
-                  evt.getY());
+          showPopupMenu(selectedRow, type, colour, evt.getPoint());
         }
       }
     });
@@ -407,9 +405,17 @@ public class FeatureSettings extends JPanel
     inConstruction = false;
   }
 
-  protected void popupSort(final int rowSelected, final String type,
-          final Object typeCol, final Map<String, float[][]> minmax, int x,
-          int y)
+       /**
+        * Constructs and shows a popup menu of possible actions on the selected row and
+        * feature type
+        * 
+        * @param rowSelected
+        * @param type
+        * @param typeCol
+        * @param pt
+        */
+  protected void showPopupMenu(final int rowSelected, final String type,
+          final Object typeCol, final Point pt)
   {
     final FeatureColourI featureColour = (FeatureColourI) typeCol;
 
@@ -430,7 +436,6 @@ public class FeatureSettings extends JPanel
                 .sortAlignmentByFeatureScore(Arrays.asList(new String[]
                 { type }));
       }
-
     });
     JMenuItem dens = new JMenuItem(
             MessageManager.getString("label.sort_by_density"));
@@ -444,7 +449,6 @@ public class FeatureSettings extends JPanel
                 .sortAlignmentByFeatureDensity(Arrays.asList(new String[]
                 { type }));
       }
-
     });
     men.add(dens);
 
@@ -481,7 +485,7 @@ public class FeatureSettings extends JPanel
             /*
              * toggle variable to simple colour - show colour chooser
              */
-            String title = MessageManager.getString("label.select_colour");
+            String title = MessageManager.formatMessage("label.select_colour_for", type);
             ColourChooserListener listener = new ColourChooserListener()
             {
               @Override
@@ -498,7 +502,8 @@ public class FeatureSettings extends JPanel
             JalviewColourChooser.showColourChooser(me, title, featureColour.getMaxColour(), listener);
           }
         }
-        else    {
+        else    
+        {
           if (e.getSource() instanceof FeatureTypeSettings)
           {
             /*
@@ -511,7 +516,6 @@ public class FeatureSettings extends JPanel
           }
         }
       }
-
     });
 
     JMenuItem selCols = new JMenuItem(
@@ -560,7 +564,7 @@ public class FeatureSettings extends JPanel
     men.add(clearCols);
     men.add(hideCols);
     men.add(hideOtherCols);
-    men.show(table, x, y);
+    men.show(table, pt.x, pt.y);
   }
 
   @Override
@@ -1738,7 +1742,7 @@ public class FeatureSettings extends JPanel
           /*
            * simple colour chooser
            */
-          String ttl = MessageManager.getString("label.select_colour");
+          String ttl = MessageManager.formatMessage("label.select_colour_for", type);
           ColourChooserListener listener = new ColourChooserListener() 
           {
             @Override