JAL-4392 Consensus secondary structure: Display Secondary structure consensus for...
[jalview.git] / src / jalview / gui / PopupMenu.java
index 8875288..d2c00eb 100644 (file)
@@ -54,6 +54,7 @@ import jalview.analysis.AAFrequency;
 import jalview.analysis.AlignmentAnnotationUtils;
 import jalview.analysis.AlignmentUtils;
 import jalview.analysis.Conservation;
+import jalview.api.AlignCalcWorkerI;
 import jalview.api.AlignViewportI;
 import jalview.bin.Console;
 import jalview.commands.ChangeCaseCommand;
@@ -87,6 +88,7 @@ import jalview.util.Platform;
 import jalview.util.StringUtils;
 import jalview.util.UrlLink;
 import jalview.viewmodel.seqfeatures.FeatureRendererModel;
+import jalview.workers.SecondaryStructureConsensusThread;
 
 /**
  * The popup menu that is displayed on right-click on a sequence id, or in the
@@ -1737,8 +1739,28 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
   {
     final AlignmentI alignment = this.ap.getAlignment();
     AlignmentUtils.addReferenceAnnotations(candidates, alignment, null);
+        
+    if(AlignmentUtils.isSSAnnotationPresent(candidates)) {
+      restartSSConsensusWorker();
+    }
+        
     refresh();
   }
+  
+  
+  private void restartSSConsensusWorker() {
+    
+    List<AlignCalcWorkerI> workers = ap.alignFrame.getViewport().getCalcManager()
+            .getRegisteredWorkersOfClass(SecondaryStructureConsensusThread.class);
+    if (!workers.isEmpty()) {
+        
+      ap.alignFrame.getViewport().getCalcManager().startWorker(workers.remove(0));
+
+    }
+        
+  }
+  
+  
 
   protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent)
   {