Merge branch 'develop' into features/JAL-4219_extended_fasta_rna_ss
[jalview.git] / src / jalview / gui / PopupMenu.java
index 88c1292..09cd9a0 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
@@ -906,6 +908,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
     if (Platform.isJS())
     {
       details = new JInternalFrame();
+      details.setFrameIcon(null);
       JPanel panel = new JPanel(new BorderLayout());
       panel.setOpaque(true);
       panel.setBackground(Color.white);
@@ -1385,6 +1388,29 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
         cut_actionPerformed();
       }
     });
+    JMenuItem justifyLeftMenuItem = new JMenuItem(
+            MessageManager.getString("action.left_justify"));
+    justifyLeftMenuItem.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        ap.alignFrame.avc.justify_Region(true);
+      }
+    });
+    JMenuItem justifyRightMenuItem = new JMenuItem(
+            MessageManager.getString("action.right_justify"));
+    justifyRightMenuItem.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        ap.alignFrame.avc.justify_Region(false);
+      }
+    });
+
     upperCase.setText(MessageManager.getString("label.to_upper_case"));
     upperCase.addActionListener(new ActionListener()
     {
@@ -1533,6 +1559,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
 
     editMenu.add(copy);
     editMenu.add(cut);
+    editMenu.add(justifyLeftMenuItem);
+    editMenu.add(justifyRightMenuItem);
     editMenu.add(editSequence);
     editMenu.add(upperCase);
     editMenu.add(lowerCase);
@@ -1735,10 +1763,29 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
           Map<SequenceI, List<AlignmentAnnotation>> candidates)
   {
     final AlignmentI alignment = this.ap.getAlignment();
-    AlignmentUtils.addReferenceAnnotations(candidates, alignment,
-            null);
+    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)
   {
@@ -1834,6 +1881,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
       pane.setBackground(Color.WHITE);
       pane.add(textLabel, BorderLayout.NORTH);
       frame = new JInternalFrame();
+      frame.setFrameIcon(null);
       frame.getContentPane().add(new JScrollPane(pane));
     }
     else
@@ -2189,7 +2237,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
 
     String[] omitHidden = null;
 
-    System.out.println("PROMPT USER HERE"); // TODO: decide if a prompt happens
+    jalview.bin.Console.outPrintln("PROMPT USER HERE"); // TODO: decide if a
+                                                        // prompt happens
     // or we simply trust the user wants
     // wysiwig behaviour