dset.deleteSequence(0);
}
- firePropertyChange("Alignment", null, null);
+ firePropertyChange("Alignment", null, viewport.alignment.getSequences());
updateEditMenuBar();
}
public void save_actionPerformed(ActionEvent e)
{
- if(fileName==null || currentFileFormat==null)
+ if(fileName==null
+ || currentFileFormat==null
+ || fileName.startsWith("http")
+ )
saveAs_actionPerformed(null);
else
saveAlignment(fileName, currentFileFormat);
public boolean saveAlignment(String file, String format)
{
+ boolean success = true;
+
if (format.equalsIgnoreCase("Jalview"))
{
String shortName = title;
java.io.File.separatorChar) + 1);
}
- new Jalview2XML().SaveAlignment(this, file, shortName);
+ success = new Jalview2XML().SaveAlignment(this, file, shortName);
statusBar.setText("Successfully saved to file: "
+fileName+" in "
+format +" format.");
-
- // USE Jalview2XML to save this file
- return true;
}
else
{
if (output == null)
{
- return false;
- }
-
- try
- {
- java.io.PrintWriter out = new java.io.PrintWriter(
- new java.io.FileWriter(file));
-
- out.print(output);
- out.close();
- this.setTitle(file);
- statusBar.setText("Successfully saved to file: "
- +fileName+" in "
- +format +" format.");
- return true;
+ success = false;
}
- catch (Exception ex)
+ else
{
- ex.printStackTrace();
+ try
+ {
+ java.io.PrintWriter out = new java.io.PrintWriter(
+ new java.io.FileWriter(file));
+
+ out.print(output);
+ out.close();
+ this.setTitle(file);
+ statusBar.setText("Successfully saved to file: "
+ + fileName + " in "
+ + format + " format.");
+ }
+ catch (Exception ex)
+ {
+ success = false;
+ ex.printStackTrace();
+ }
}
}
- return false;
+
+ if (!success)
+ JOptionPane.showInternalMessageDialog(
+ this, "Couldn't save file: " + fileName,
+ "Error Saving File",
+ JOptionPane.WARNING_MESSAGE);
+
+ return success;
}
/**
if(originalSource!=null)
{
originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
- originalSource.firePropertyChange("alignment", null,null);
+ originalSource.firePropertyChange("alignment",
+ null,
+ originalSource.alignment.getSequences());
}
}
if(originalSource!=null)
{
originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;
- originalSource.firePropertyChange("alignment", null,null);
+ originalSource.firePropertyChange("alignment",
+ null,
+ originalSource.alignment.getSequences());
}
}
}
else
{
- sequences = new FormatAdapter().readFile(str, "Paste", format);
+ sequences = new FormatAdapter().readFile(str, "Paste", format).getSequencesArray();
}
AlignmentI alignment = null;
protected void deleteGroups_actionPerformed(ActionEvent e)
{
viewport.alignment.deleteAllGroups();
- viewport.sequenceColours.clear();
+ viewport.sequenceColours = null;
viewport.setSelectionGroup(null);
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
alignPanel.repaint();
sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false);
}
+ alignPanel.repaint();
+
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());
}
tp = new TreePanel(alignPanel, type, pwType);
}
- title = title + " from " + this.title;
+ title += " from ";
+
if(viewport.viewName!=null)
- title+= " ("+viewport.viewName+")";
+ title+= viewport.viewName+" of ";
+
+ title += this.title;
Desktop.addInternalFrame(tp, title, 600, 500);
}
}
boolean isAnnotation = new AnnotationFile().readAnnotationFile(viewport.
- alignment, file);
+ alignment, file, protocol);
if (!isAnnotation)
{