From 3d32993c37812a293d61b8cb746ac8a4f246bed0 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 25 Jul 2006 09:38:52 +0000 Subject: [PATCH] FileLoader replaces paste when Dropping files --- src/jalview/gui/AlignFrame.java | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 2ce8f06..5036a0b 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -37,7 +37,6 @@ import jalview.ws.*; import java.awt.dnd.*; import org.biojava.dasobert.eventmodel.*; - /** * DOCUMENT ME! * @@ -479,6 +478,7 @@ public class AlignFrame new AnnotationExporter().exportFeatures(alignPanel); } + public void exportAnnotations_actionPerformed(ActionEvent e) { new AnnotationExporter().exportAnnotations( @@ -767,6 +767,7 @@ public class AlignFrame String format = new IdentifyFile().Identify(str, "Paste"); SequenceI[] sequences; + if(Desktop.jalviewClipboard!=null) { // The clipboard was filled from within Jalview, we must use the sequences @@ -782,32 +783,40 @@ public class AlignFrame if (newAlignment) { + System.out.println(format +" 2"); alignment = new Alignment(sequences); if(Desktop.jalviewClipboard!=null) alignment.setDataset( (Alignment)Desktop.jalviewClipboard[1] ); else alignment.setDataset( null ); + } else { + System.out.println(format +" 24"); alignment = viewport.getAlignment(); //!newAlignment for (int i = 0; i < sequences.length; i++) { - Sequence newseq = new Sequence(sequences[i].getName(), sequences[i].getSequence(), sequences[i].getStart(), sequences[i].getEnd()); alignment.addSequence(newseq); } + + viewport.setEndSeq(alignment.getHeight()); alignment.getWidth(); viewport.firePropertyChange("alignment", null, alignment.getSequences()); } + + + + // Add any annotations attached to sequences for (int i = 0; i < sequences.length; i++) { @@ -1422,7 +1431,7 @@ public class AlignFrame { viewport.hideSequence(seqs[i]); } - repaint(); + alignPanel.repaint(); } public void hideSelColumns_actionPerformed(ActionEvent e) @@ -2842,16 +2851,8 @@ public void drop(DropTargetDropEvent evt) AppletFormatAdapter.FILE); if (!isGroupsFile) { - String protocol = "File"; - String format = new IdentifyFile().Identify(file, protocol); - SequenceI[] sequences = new FormatAdapter().readFile(file, protocol, - format); - - FastaFile ff = new FastaFile(); - Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); - c.setContents(new StringSelection(ff.print(sequences)), Desktop.instance); - - this.paste(false); + String format = new IdentifyFile().Identify(file, FormatAdapter.FILE); + new FileLoader().LoadFile(viewport, file, FormatAdapter.FILE, format); } } else -- 1.7.10.2