- public void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
- new String[]{"fa", "fasta", "fastq", "blc", "msf", "pfam", "aln", "pir"}, "Alignment files");\r
- chooser.setFileView(new JalviewFileView());\r
- chooser.setDialogTitle("Open local file");\r
- chooser.setToolTipText("Open");\r
- int value = chooser.showOpenDialog(this);\r
- if(value == JalviewFileChooser.APPROVE_OPTION)\r
- {\r
- String choice = chooser.getSelectedFile().getPath();\r
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
- String format = IdentifyFile.Identify(choice, "File");\r
- LoadFile(choice, "File", format);\r
- }\r
- }\r
-\r
- public void LoadFile(String file, String protocol, String format)\r
- {\r
- SequenceI [] sequences = null;\r
-\r
- if (FormatProperties.contains(format))\r
- sequences = FormatAdapter.read(file, protocol, format);\r
-\r
- if (sequences != null && sequences.length>0)\r
- {\r
- AlignFrame af = new AlignFrame(new Alignment(sequences));\r
- addInternalFrame(af, file, 700, 500);\r
- af.statusBar.setText("Successfully loaded file " + file);\r
-\r
- }\r
- else\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop, "Couldn't open file.\n"\r
- + "Formats currently supported are\n"\r
- + "Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM" // JBPNote - message should be generated through FormatAdapter!\r
- ,"Error loading file",\r
- JOptionPane.WARNING_MESSAGE);\r
-\r
- }\r
-\r
- public void inputURLMenuItem_actionPerformed(ActionEvent e)\r
- {\r
- String url = JOptionPane.showInternalInputDialog(Desktop.desktop,"Enter url of input file",\r
- "Input alignment from URL",\r
- JOptionPane.QUESTION_MESSAGE);\r
- if (url == null)\r
- return;\r
-\r
- String format = IdentifyFile.Identify(url, "URL");\r
-\r
- if (format.equals("URL NOT FOUND"))\r
- {\r
- JOptionPane.showInternalMessageDialog(Desktop.desktop,"Couldn't locate " + url,\r
- "URL not found",\r
- JOptionPane.WARNING_MESSAGE);\r
- return;\r
- }\r