X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPopupMenu.java;h=6903034f1ca18d5f08e7adff8fb5b85e9040b3b6;hb=70a6730dba4ab0af6906fd8f874fe853c02efef0;hp=415054ec38313c1a7c525ecdbe6e17f88c2d5b1b;hpb=83dd6154fdf5f727bc587ef58790c08e8404b757;p=jalview.git diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 415054e..6903034 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -20,12 +20,43 @@ */ package jalview.gui; +import java.util.Locale; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.BitSet; +import java.util.Collection; +import java.util.Collections; +import java.util.Hashtable; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.Vector; + +import javax.swing.ButtonGroup; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JInternalFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JScrollPane; + import jalview.analysis.AAFrequency; import jalview.analysis.AlignmentAnnotationUtils; import jalview.analysis.AlignmentUtils; import jalview.analysis.Conservation; import jalview.api.AlignViewportI; -import jalview.bin.Cache; +import jalview.bin.Console; import jalview.commands.ChangeCaseCommand; import jalview.commands.EditCommand; import jalview.commands.EditCommand.Action; @@ -39,6 +70,7 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.ColourMenuHelper.ColourChangeListener; +import jalview.gui.JalviewColourChooser.ColourChooserListener; import jalview.io.FileFormatI; import jalview.io.FileFormats; import jalview.io.FormatAdapter; @@ -52,35 +84,11 @@ import jalview.util.Comparison; import jalview.util.GroupUrlLink; import jalview.util.GroupUrlLink.UrlStringTooLongException; import jalview.util.MessageManager; +import jalview.util.Platform; import jalview.util.StringUtils; import jalview.util.UrlLink; import jalview.viewmodel.seqfeatures.FeatureRendererModel; -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.BitSet; -import java.util.Collection; -import java.util.Collections; -import java.util.Hashtable; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.SortedMap; -import java.util.TreeMap; -import java.util.Vector; - -import javax.swing.ButtonGroup; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JColorChooser; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.JRadioButtonMenuItem; - /** * The popup menu that is displayed on right-click on a sequence id, or in the * sequence alignment. @@ -88,6 +96,11 @@ import javax.swing.JRadioButtonMenuItem; public class PopupMenu extends JPopupMenu implements ColourChangeListener { /* + * maximum length of feature description to include in popup menu item text + */ + private static final int FEATURE_DESC_MAX = 40; + + /* * true for ID Panel menu, false for alignment panel menu */ private final boolean forIdPanel; @@ -217,13 +230,13 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener urlLink = new UrlLink(link); } catch (Exception foo) { - Cache.log.error("Exception for URLLink '" + link + "'", foo); + Console.error("Exception for URLLink '" + link + "'", foo); continue; } if (!urlLink.isValid()) { - Cache.log.error(urlLink.getInvalidMessage()); + Console.error(urlLink.getInvalidMessage()); continue; } @@ -346,14 +359,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) { @@ -364,13 +378,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 groupLinks) @@ -386,11 +400,10 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener * @param alignPanel * @param seq * @param column - * aligned column position (0...) + * aligned column position (0...) * @param groupLinks */ - private PopupMenu(boolean fromIdPanel, - final AlignmentPanel alignPanel, + private PopupMenu(boolean fromIdPanel, final AlignmentPanel alignPanel, final SequenceI seq, final int column, List groupLinks) { Objects.requireNonNull(seq); @@ -430,9 +443,10 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener /* * And repeat for the current selection group (if there is one): */ - final List selectedGroup = (alignPanel.av.getSelectionGroup() == null - ? Collections. emptyList() - : alignPanel.av.getSelectionGroup().getSequences()); + final List selectedGroup = (alignPanel.av + .getSelectionGroup() == null + ? Collections. emptyList() + : alignPanel.av.getSelectionGroup().getSequences()); buildAnnotationTypesMenus(groupShowAnnotationsMenu, groupHideAnnotationsMenu, selectedGroup); configureReferenceAnnotationsMenu(groupAddReferenceAnnotations, @@ -658,7 +672,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener buildGroupURLMenu(sg, groupLinks); } // Add a 'show all structures' for the current selection - Hashtable pdbe = new Hashtable<>(), reppdb = new Hashtable<>(); + Hashtable pdbe = new Hashtable<>(), + reppdb = new Hashtable<>(); SequenceI sqass = null; for (SequenceI sq : alignPanel.av.getSequenceSelection()) @@ -695,7 +710,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener { createGroupMenuItem.setVisible(true); unGroupMenuItem.setVisible(false); - editGroupMenu.setText(MessageManager.getString("action.edit_new_group")); + editGroupMenu + .setText(MessageManager.getString("action.edit_new_group")); } else { @@ -722,8 +738,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener *
  • positional feature links (alignment panel popup menu)
  • *
  • feature details links (alignment panel popup menu)
  • * - * If this panel is also showed complementary (CDS/protein) features, then links - * to their feature details are also added. + * If this panel is also showed complementary (CDS/protein) features, then + * links to their feature details are also added. * * @param seq * @param column @@ -750,14 +766,16 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } /** - * Add a link to show feature details for each sequence feature + * Add a menu item to show feature details for each sequence feature. Any + * linked 'virtual' features (CDS/protein) are also optionally found and + * included. * * @param features - * @param column * @param seq + * @param column */ protected void addFeatureDetails(List features, - SequenceI seq, int column) + final SequenceI seq, final int column) { /* * add features in CDS/protein complement at the corresponding @@ -792,90 +810,131 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener String name = seq.getName(); for (final SequenceFeature sf : features) { - addFeatureDetailsMenuItem(details, name, sf); + addFeatureDetailsMenuItem(details, name, sf, null); } if (mf != null) { - name = mf.fromSeq == seq ? mf.mapping.getTo().getName() - : mf.fromSeq.getName(); for (final SequenceFeature sf : mf.features) { - addFeatureDetailsMenuItem(details, name, sf); + addFeatureDetailsMenuItem(details, name, sf, mf); } } } /** - * A helper method to add one menu item whose action is to show details for one - * feature + * A helper method to add one menu item whose action is to show details for + * one feature. The menu text includes feature description, but this may be + * truncated. * * @param details * @param seqName * @param sf + * @param mf */ void addFeatureDetailsMenuItem(JMenu details, final String seqName, - final SequenceFeature sf) + final SequenceFeature sf, MappedFeatures mf) { int start = sf.getBegin(); int end = sf.getEnd(); - String desc = null; - if (start == end) + if (mf != null) { - desc = String.format("%s %d", sf.getType(), start); + /* + * show local rather than linked feature coordinates + */ + int[] localRange = mf.getMappedPositions(start, end); + if (localRange == null) + { + // e.g. variant extending to stop codon so not mappable + return; + } + start = localRange[0]; + end = localRange[localRange.length - 1]; } - else + StringBuilder desc = new StringBuilder(); + desc.append(sf.getType()).append(" ").append(String.valueOf(start)); + if (start != end) { - desc = String.format("%s %d-%d", sf.getType(), start, end); + desc.append(sf.isContactFeature() ? ":" : "-"); + desc.append(String.valueOf(end)); } - String tooltip = desc; String description = sf.getDescription(); if (description != null) { + desc.append(" "); description = StringUtils.stripHtmlTags(description); - if (description.length() > 12) - { - desc = desc + " " + description.substring(0, 12) + ".."; - } - else + + /* + * truncate overlong descriptions unless they contain an href + * (as truncation could leave corrupted html) + */ + boolean hasLink = description.indexOf("a href") > -1; + if (description.length() > FEATURE_DESC_MAX && !hasLink) { - desc = desc + " " + description; + description = description.substring(0, FEATURE_DESC_MAX) + "..."; } - tooltip = tooltip + " " + description; + desc.append(description); } - if (sf.getFeatureGroup() != null) + String featureGroup = sf.getFeatureGroup(); + if (featureGroup != null) { - tooltip = tooltip + (" (" + sf.getFeatureGroup() + ")"); + desc.append(" (").append(featureGroup).append(")"); } - JMenuItem item = new JMenuItem(desc); - item.setToolTipText(tooltip); + String htmlText = JvSwingUtils.wrapTooltip(true, desc.toString()); + JMenuItem item = new JMenuItem(htmlText); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - showFeatureDetails(seqName, sf); + showFeatureDetails(sf, seqName, mf); } }); details.add(item); } /** - * Opens a panel showing a text report of feature dteails - * - * @param seqName + * Opens a panel showing a text report of feature details * * @param sf + * @param seqName + * @param mf */ - protected void showFeatureDetails(String seqName, SequenceFeature sf) + protected void showFeatureDetails(SequenceFeature sf, String seqName, + MappedFeatures mf) { - CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer(); - // it appears Java's CSS does not support border-collapse :-( - cap.addStylesheetRule("table { border-collapse: collapse;}"); - cap.addStylesheetRule("table, td, th {border: 1px solid black;}"); - cap.setText(sf.getDetailsReport(seqName)); - - Desktop.addInternalFrame(cap, + JInternalFrame details; + if (Platform.isJS()) + { + details = new JInternalFrame(); + JPanel panel = new JPanel(new BorderLayout()); + panel.setOpaque(true); + panel.setBackground(Color.white); + // TODO JAL-3026 set style of table correctly for feature details + JLabel reprt = new JLabel(MessageManager + .formatMessage("label.html_content", new Object[] + { sf.getDetailsReport(seqName, mf) })); + reprt.setBackground(Color.WHITE); + reprt.setOpaque(true); + panel.add(reprt, BorderLayout.CENTER); + details.setContentPane(panel); + details.pack(); + } + else + /** + * Java only + * + * @j2sIgnore + */ + { + CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer(); + // it appears Java's CSS does not support border-collapse :-( + cap.addStylesheetRule("table { border-collapse: collapse;}"); + cap.addStylesheetRule("table, td, th {border: 1px solid black;}"); + cap.setText(sf.getDetailsReport(seqName, mf)); + details = cap; + } + Desktop.addInternalFrame(details, MessageManager.getString("label.feature_details"), 500, 500); } @@ -1068,12 +1127,14 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener { sqi = sqi.getDatasetSequence(); } - DBRefEntry[] dbr = sqi.getDBRefs(); - if (dbr != null && dbr.length > 0) + List dbr = sqi.getDBRefs(); + int nd; + if (dbr != null && (nd = dbr.size()) > 0) { - for (int d = 0; d < dbr.length; d++) + for (int d = 0; d < nd; d++) { - String src = dbr[d].getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase(); + DBRefEntry e = dbr.get(d); + String src = e.getSource(); // jalview.util.DBRefUtils.getCanonicalName(dbr[d].getSource()).toUpperCase(Locale.ROOT); Object[] sarray = commonDbrefs.get(src); if (sarray == null) { @@ -1086,10 +1147,10 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener if (((String[]) sarray[1])[sq] == null) { - if (!dbr[d].hasMap() || (dbr[d].getMap() - .locateMappedRange(start, end) != null)) + if (!e.hasMap() + || (e.getMap().locateMappedRange(start, end) != null)) { - ((String[]) sarray[1])[sq] = dbr[d].getAccessionId(); + ((String[]) sarray[1])[sq] = e.getAccessionId(); ((int[]) sarray[0])[0]++; } } @@ -1107,20 +1168,19 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener urlLink = new GroupUrlLink(link); } catch (Exception foo) { - Cache.log.error("Exception for GroupURLLink '" + link + "'", foo); + Console.error("Exception for GroupURLLink '" + link + "'", foo); continue; } - ; if (!urlLink.isValid()) { - Cache.log.error(urlLink.getInvalidMessage()); + Console.error(urlLink.getInvalidMessage()); continue; } final String label = urlLink.getLabel(); boolean usingNames = false; // Now see which parts of the group apply for this URL String ltarget = urlLink.getTarget(); // jalview.util.DBRefUtils.getCanonicalName(urlLink.getTarget()); - Object[] idset = commonDbrefs.get(ltarget.toUpperCase()); + Object[] idset = commonDbrefs.get(ltarget.toUpperCase(Locale.ROOT)); String[] seqstr, ids; // input to makeUrl if (idset != null) { @@ -1410,7 +1470,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener @Override public void actionPerformed(ActionEvent actionEvent) { - editSequence_actionPerformed(actionEvent); + editSequence_actionPerformed(); } }); makeReferenceSeq.setText( @@ -1727,7 +1787,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } inserts.and(sq.getInsertionsAsBits()); } - hidden.clearAndHideColumns(inserts, ap.av.getSelectionGroup().getStartRes(), + hidden.clearAndHideColumns(inserts, + ap.av.getSelectionGroup().getStartRes(), ap.av.getSelectionGroup().getEndRes()); } @@ -1749,21 +1810,47 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener public void createSequenceDetailsReport(SequenceI[] sequences) { - CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer(); StringBuilder contents = new StringBuilder(128); + contents.append(""); for (SequenceI seq : sequences) { contents.append("

    " + MessageManager.formatMessage( "label.create_sequence_details_report_annotation_for", new Object[] - { seq.getDisplayId(true) }) + "

    "); - new SequenceAnnotationReport(null).createSequenceAnnotationReport( + { seq.getDisplayId(true) }) + "

    \n

    "); + new SequenceAnnotationReport(false).createSequenceAnnotationReport( contents, seq, true, true, ap.getSeqPanel().seqCanvas.fr); contents.append("

    "); } - cap.setText("" + contents.toString() + ""); + contents.append(""); + String report = contents.toString(); + + JInternalFrame frame; + if (Platform.isJS()) + { + JLabel textLabel = new JLabel(); + textLabel.setText(report); + textLabel.setBackground(Color.WHITE); + JPanel pane = new JPanel(new BorderLayout()); + pane.setOpaque(true); + pane.setBackground(Color.WHITE); + pane.add(textLabel, BorderLayout.NORTH); + frame = new JInternalFrame(); + frame.getContentPane().add(new JScrollPane(pane)); + } + else + /** + * Java only + * + * @j2sIgnore + */ + { + CutAndPasteHtmlTransfer cap = new CutAndPasteHtmlTransfer(); + cap.setText(report); + frame = cap; + } - Desktop.addInternalFrame(cap, + Desktop.addInternalFrame(frame, MessageManager.formatMessage("label.sequence_details_for", (sequences.length == 1 ? new Object[] { sequences[0].getDisplayId(true) } @@ -1771,7 +1858,6 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener { MessageManager .getString("label.selection") })), 500, 400); - } protected void showNonconserved_actionPerformed() @@ -1890,30 +1976,27 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } /** - * DOCUMENT ME! - * - * @param e - * DOCUMENT ME! + * Shows a dialog where group name and description may be edited */ protected void groupName_actionPerformed() { - SequenceGroup sg = getGroup(); EditNameDialog dialog = new EditNameDialog(sg.getName(), sg.getDescription(), - " " + MessageManager.getString("label.group_name") + " ", - MessageManager.getString("label.group_description") + " ", + MessageManager.getString("label.group_name"), + MessageManager.getString("label.group_description")); + dialog.showDialog(ap.alignFrame, MessageManager.getString("label.edit_group_name_description"), - ap.alignFrame); - - if (!dialog.accept) - { - return; - } - - sg.setName(dialog.getName()); - sg.setDescription(dialog.getDescription()); - refresh(); + new Runnable() + { + @Override + public void run() + { + sg.setName(dialog.getName()); + sg.setDescription(dialog.getDescription()); + refresh(); + } + }); } /** @@ -1935,48 +2018,40 @@ 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() { EditNameDialog dialog = new EditNameDialog(sequence.getName(), sequence.getDescription(), - " " + MessageManager.getString("label.sequence_name") - + " ", - MessageManager.getString("label.sequence_description") + " ", - MessageManager.getString( - "label.edit_sequence_name_description"), - ap.alignFrame); - - if (!dialog.accept) - { - return; - } - - String name = dialog.getName(); - if (name != null) - { - if (name.indexOf(" ") > -1) - { - JvOptionPane.showMessageDialog(ap, - MessageManager - .getString("label.spaces_converted_to_backslashes"), - MessageManager - .getString("label.no_spaces_allowed_sequence_name"), - JvOptionPane.WARNING_MESSAGE); - name = name.replace(' ', '_'); - } - - sequence.setName(name); - ap.paintAlignment(false, false); - } - - sequence.setDescription(dialog.getDescription()); - - ap.av.firePropertyChange("alignment", null, - ap.av.getAlignment().getSequences()); - + 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() + { + if (dialog.getName() != null) + { + 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); + } + sequence.setDescription(dialog.getDescription()); + ap.av.firePropertyChange("alignment", null, + ap.av.getAlignment().getSequences()); + } + }); } /** @@ -2001,24 +2076,22 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } /** - * DOCUMENT ME! - * - * @param e - * DOCUMENT ME! + * Offers a colour chooser and sets the selected colour as the group outline */ protected void outline_actionPerformed() { - SequenceGroup sg = getGroup(); - Color col = JColorChooser.showDialog(this, - MessageManager.getString("label.select_outline_colour"), - Color.BLUE); - - if (col != null) + String title = MessageManager.getString("label.select_outline_colour"); + ColourChooserListener listener = new ColourChooserListener() { - sg.setOutlineColour(col); - } - - refresh(); + @Override + public void colourSelected(Color c) + { + getGroup().setOutlineColour(c); + refresh(); + } + }; + JalviewColourChooser.showColourChooser(Desktop.getDesktop(), title, + Color.BLUE, listener); } /** @@ -2064,12 +2137,12 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener public void copy_actionPerformed() { - ap.alignFrame.copy_actionPerformed(null); + ap.alignFrame.copy_actionPerformed(); } public void cut_actionPerformed() { - ap.alignFrame.cut_actionPerformed(null); + ap.alignFrame.cut_actionPerformed(); } void changeCase(ActionEvent e) @@ -2165,13 +2238,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener */ if (!seqs.isEmpty()) { - if (ap.getSeqPanel().seqCanvas.getFeatureRenderer() - .amendFeatures(seqs, features, true, ap)) - { - ap.alignFrame.setShowSeqFeatures(true); - ap.av.setSearchResults(null); // clear highlighting - ap.repaint(); // draw new/amended features - } + new FeatureEditor(ap, seqs, features, true).showDialog(); } } @@ -2184,7 +2251,12 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } } - public void editSequence_actionPerformed(ActionEvent actionEvent) + /** + * Shows a dialog where sequence characters may be edited. Any changes are + * applied, and added as an available 'Undo' item in the edit commands + * history. + */ + public void editSequence_actionPerformed() { SequenceGroup sg = ap.av.getSelectionGroup(); @@ -2197,26 +2269,29 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener } EditNameDialog dialog = new EditNameDialog( - seq.getSequenceAsString(sg.getStartRes(), - sg.getEndRes() + 1), - null, MessageManager.getString("label.edit_sequence"), null, + seq.getSequenceAsString(sg.getStartRes(), sg.getEndRes() + 1), + null, MessageManager.getString("label.edit_sequence"), null); + dialog.showDialog(ap.alignFrame, MessageManager.getString("label.edit_sequence"), - ap.alignFrame); - - if (dialog.accept) - { - 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()); - } + 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()); + } + }); } }