Cleanup, note: rectangular selection works by holding mouse wheel and s (see line...
[jalview.git] / src / jalview / gui / AnnotationLabels.java
index 4148998..28065c3 100755 (executable)
@@ -485,7 +485,8 @@ public class AnnotationLabels extends JPanel
 
       if (cm.hasGroups())
       {
-        JCheckBoxMenuItem chitem = new JCheckBoxMenuItem("Show Groups on Matrix");
+        JCheckBoxMenuItem chitem = new JCheckBoxMenuItem(MessageManager.getString("action.show_groups_on_matrix"));
+        chitem.setToolTipText(MessageManager.getString("action.show_groups_on_matrix_tooltip"));
         boolean showGroups = alignmentAnnotation.isShowGroupsForContactMatrix();
         final AlignmentAnnotation sel_row=alignmentAnnotation;
         chitem.setState(showGroups);
@@ -496,15 +497,18 @@ public class AnnotationLabels extends JPanel
           public void actionPerformed(ActionEvent e)
           {
             sel_row.setShowGroupsForContactMatrix(chitem.getState());
-            ap.getAnnotationPanel()
-            .paint(ap.getAnnotationPanel().getGraphics());
+            // so any annotation colour changes are propagated - though they
+            // probably won't be unless the annotation row colours are removed
+            // too!
+            ap.alignmentChanged();
           }
         });
         pop.add(chitem);
       }
       if (cm.hasTree())
       {
-        item = new JMenuItem("Show Tree for Matrix");
+        item = new JMenuItem(MessageManager.getString("action.show_tree_for_matrix"));
+        item.setToolTipText(MessageManager.getString("action.show_tree_for_matrix_tooltip"));
         item.addActionListener(new ActionListener()
         {
 
@@ -520,10 +524,10 @@ public class AnnotationLabels extends JPanel
       }
       else
       {
-        item = new JMenuItem("Calculate Tree for Matrix");
+        item = new JMenuItem(MessageManager.getString("action.cluster_matrix"));
+        item.setToolTipText(MessageManager.getString("action.cluster_matrix_tooltip"));
         item.addActionListener(new ActionListener()
         {
-          // TODO - refactor to analysis background thread
           @Override
           public void actionPerformed(ActionEvent e)
           {
@@ -532,9 +536,14 @@ public class AnnotationLabels extends JPanel
               @Override
               public void run()
               {
-                AlignmentAnnotation alan = alignmentAnnotation;
-                cm.setGroupSet(GroupSet.makeGroups(cm, 5f, true));
-                ap.alignFrame.showContactMapTree(alan, cm);
+                final long progBar;
+                ap.alignFrame.setProgressBar(MessageManager.formatMessage("action.clustering_matrix_for",cm.getAnnotDescr(),5f), progBar = System.currentTimeMillis());
+                cm.setGroupSet(GroupSet.makeGroups(cm, true));
+                cm.randomlyReColourGroups();
+                cm.transferGroupColorsTo(alignmentAnnotation);
+                ap.alignmentChanged();
+                ap.alignFrame.showContactMapTree(alignmentAnnotation, cm);
+                ap.alignFrame.setProgressBar(null, progBar);
               }
             }).start();
           }