Revision 661914be
Added by Ben Stöver over 7 years ago
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java | ||
---|---|---|
17 | 17 |
import info.bioinfweb.jphyloio.factory.JPhyloIOReaderWriterFactory; |
18 | 18 |
import info.bioinfweb.jphyloio.objecttranslation.ObjectTranslatorFactory; |
19 | 19 |
|
20 |
import java.io.File; |
|
20 | 21 |
import java.io.IOException; |
21 | 22 |
|
22 | 23 |
import org.eclipse.core.commands.AbstractHandler; |
... | ... | |
68 | 69 |
parameters.put(ReadWriteParameterNames.KEY_OBJECT_TRANSLATOR_FACTORY, translatorFactory); |
69 | 70 |
|
70 | 71 |
// Create writer and document adapters: |
71 |
JPhyloIOEventWriter writer = factory.getWriter(wizard.getSelectedFormat().getFormatID());
|
|
72 |
JPhyloIOEventWriter writer = factory.getWriter(wizard.getModel().getFormatInfo().getFormatID());
|
|
72 | 73 |
ListBasedDocumentDataAdapter document = new ListBasedDocumentDataAdapter(); |
73 |
document.getMatrices().add(new CDMSequenceMatrixAdapter(sequence, wizard.getConsensusSequenceLabel())); |
|
74 |
document.getMatrices().add(new CDMSequenceMatrixAdapter(sequence, wizard.getModel().getConsensusSequenceLabel()));
|
|
74 | 75 |
|
75 | 76 |
// Write document: |
77 |
File file = new File(wizard.getModel().getFileName()); |
|
76 | 78 |
try { |
77 |
writer.writeDocument(document, wizard.getSelectedFile(), parameters);
|
|
79 |
writer.writeDocument(document, file, parameters);
|
|
78 | 80 |
} |
79 | 81 |
catch (IOException e) { |
80 | 82 |
e.printStackTrace(); |
81 | 83 |
MessagingUtils.errorDialog("IO error", this, |
82 | 84 |
"An error occured when trying to export a consensus sequence alignment to the file \"" + |
83 |
wizard.getSelectedFile().getAbsolutePath() + "\".", TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID
|
|
85 |
file.getAbsolutePath() + "\".", TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID
|
|
84 | 86 |
//TODO Use multi language error message. |
85 | 87 |
} |
86 | 88 |
} |
Also available in: Unified diff
Intermediate commit in implementing wizard validation (before moving to MultiValidator).
Plug-in dependencies added to molecular.