JAL-4392 Fixed failed test cases
[jalview.git] / src / jalview / gui / PopupMenu.java
index 83f424b..9d23474 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
@@ -1762,8 +1764,34 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
   {
     final AlignmentI alignment = this.ap.getAlignment();
     AlignmentUtils.addReferenceAnnotations(candidates, alignment, null);
-    refresh();
+        
+    if(AlignmentUtils.isSSAnnotationPresent(candidates)) {
+      
+      restartSSConsensusWorker();
+      ap.validateAnnotationDimensions(true);
+      ap.fontChanged();
+      ap.av.alignmentChanged(ap);
+      ap.adjustAnnotationHeight();
+      restartSSConsensusWorker();
+      //ap.alignFrame.getViewport().getCalcManager().restartWorkers();
+    }
+        
+  }
+  
+  
+  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)
   {