X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FPopupMenu.java;h=88752880345bdce8a48b339f1eb053a962b2fe7e;hb=bc1a3842b31a35a7794f4afec4911ad421c7c3e4;hp=1c3ab8fcbbdd9e5a49240f34d068836704187303;hpb=cb8e52fbbc5f725e3f7f48c672cdddb0690bd978;p=jalview.git
diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java
index 1c3ab8f..8875288 100644
--- a/src/jalview/gui/PopupMenu.java
+++ b/src/jalview/gui/PopupMenu.java
@@ -20,8 +20,6 @@
*/
package jalview.gui;
-import java.util.Locale;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
@@ -34,6 +32,7 @@ import java.util.Collections;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.SortedMap;
@@ -359,14 +358,15 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
}
/**
- * Constructor for a PopupMenu for a click in the alignment panel (on a residue)
+ * Constructor for a PopupMenu for a click in the alignment panel (on a
+ * residue)
*
* @param ap
- * the panel in which the mouse is clicked
+ * the panel in which the mouse is clicked
* @param seq
- * the sequence under the mouse
+ * the sequence under the mouse
* @throws NullPointerException
- * if seq is null
+ * if seq is null
*/
public PopupMenu(final AlignmentPanel ap, SequenceI seq, int column)
{
@@ -377,13 +377,13 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
* Constructor for a PopupMenu for a click in the sequence id panel
*
* @param alignPanel
- * the panel in which the mouse is clicked
+ * the panel in which the mouse is clicked
* @param seq
- * the sequence under the mouse click
+ * the sequence under the mouse click
* @param groupLinks
- * templates for sequence external links
+ * templates for sequence external links
* @throws NullPointerException
- * if seq is null
+ * if seq is null
*/
public PopupMenu(final AlignmentPanel alignPanel, final SequenceI seq,
List" + MessageManager.formatMessage(
"label.create_sequence_details_report_annotation_for",
new Object[]
- { seq.getDisplayId(true) }) + "
"); + { seq.getDisplayId(true) }) + "
\n"); new SequenceAnnotationReport(false).createSequenceAnnotationReport( contents, seq, true, true, ap.getSeqPanel().seqCanvas.fr); contents.append("
"); @@ -1832,6 +1834,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 @@ -1983,15 +1986,10 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener MessageManager.getString("label.group_description")); dialog.showDialog(ap.alignFrame, MessageManager.getString("label.edit_group_name_description"), - new Runnable() - { - @Override - public void run() - { - sg.setName(dialog.getName()); - sg.setDescription(dialog.getDescription()); - refresh(); - } + () -> { + sg.setName(dialog.getName()); + sg.setDescription(dialog.getDescription()); + refresh(); }); } @@ -2014,8 +2012,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener /** * Shows a dialog where the sequence name and description may be edited. If a - * name containing spaces is entered, these are converted to underscores, with a - * warning message. + * name containing spaces is entered, these are converted to underscores, with + * a warning message. */ void sequenceName_actionPerformed() { @@ -2023,32 +2021,30 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener sequence.getDescription(), MessageManager.getString("label.sequence_name"), MessageManager.getString("label.sequence_description")); - dialog.showDialog(ap.alignFrame, - MessageManager.getString( - "label.edit_sequence_name_description"), - new Runnable() - { - @Override - public void run() + dialog.showDialog(ap.alignFrame, MessageManager + .getString("label.edit_sequence_name_description"), () -> { + if (dialog.getName() != null) { - if (dialog.getName() != null) + if (dialog.getName().indexOf(" ") > -1) { - if (dialog.getName().indexOf(" ") > -1) - { - JvOptionPane.showMessageDialog(ap, - MessageManager.getString( - "label.spaces_converted_to_underscores"), - MessageManager.getString( - "label.no_spaces_allowed_sequence_name"), - JvOptionPane.WARNING_MESSAGE); - } - sequence.setName(dialog.getName().replace(' ', '_')); - ap.paintAlignment(false, false); + String ok = MessageManager.getString("action.ok"); + String cancel = MessageManager.getString("action.cancel"); + String message = MessageManager.getString( + "label.spaces_converted_to_underscores"); + String title = MessageManager.getString( + "label.no_spaces_allowed_sequence_name"); + Object[] options = new Object[] { ok, cancel }; + + JvOptionPane.frameDialog(message, title, + JvOptionPane.WARNING_MESSAGE, null, null, null, + false); } - sequence.setDescription(dialog.getDescription()); - ap.av.firePropertyChange("alignment", null, - ap.av.getAlignment().getSequences()); + sequence.setName(dialog.getName().replace(' ', '_')); + ap.paintAlignment(false, false); } + sequence.setDescription(dialog.getDescription()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); }); } @@ -2078,8 +2074,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener */ protected void outline_actionPerformed() { - String title = MessageManager - .getString("label.select_outline_colour"); + String title = MessageManager.getString("label.select_outline_colour"); ColourChooserListener listener = new ColourChooserListener() { @Override @@ -2089,8 +2084,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener refresh(); } }; - JalviewColourChooser.showColourChooser(Desktop.getDesktop(), - title, Color.BLUE, listener); + JalviewColourChooser.showColourChooser(Desktop.getDesktop(), title, + Color.BLUE, listener); } /** @@ -2195,7 +2190,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 @@ -2271,25 +2267,19 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener seq.getSequenceAsString(sg.getStartRes(), sg.getEndRes() + 1), null, MessageManager.getString("label.edit_sequence"), null); dialog.showDialog(ap.alignFrame, - MessageManager.getString("label.edit_sequence"), - new Runnable() - { - @Override - public void run() - { - EditCommand editCommand = new EditCommand( - MessageManager.getString("label.edit_sequences"), - Action.REPLACE, - dialog.getName().replace(' ', - ap.av.getGapCharacter()), - sg.getSequencesAsArray( - ap.av.getHiddenRepSequences()), - sg.getStartRes(), sg.getEndRes() + 1, - ap.av.getAlignment()); - ap.alignFrame.addHistoryItem(editCommand); - ap.av.firePropertyChange("alignment", null, - ap.av.getAlignment().getSequences()); - } + MessageManager.getString("label.edit_sequence"), () -> { + EditCommand editCommand = new EditCommand( + MessageManager.getString("label.edit_sequences"), + Action.REPLACE, + dialog.getName().replace(' ', + ap.av.getGapCharacter()), + sg.getSequencesAsArray( + ap.av.getHiddenRepSequences()), + sg.getStartRes(), sg.getEndRes() + 1, + ap.av.getAlignment()); + ap.alignFrame.addHistoryItem(editCommand); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); }); } }