Revision 80e535dd
Added by Ben Stöver over 7 years ago
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/wizard/ExportSingleReadAlignmentWizardModel.java | ||
---|---|---|
14 | 14 |
import info.bioinfweb.jphyloio.factory.JPhyloIOReaderWriterFactory; |
15 | 15 |
import info.bioinfweb.jphyloio.formatinfo.JPhyloIOFormatInfo; |
16 | 16 |
|
17 |
import java.util.ArrayList; |
|
17 | 18 |
import java.util.Collections; |
18 |
import java.util.Map; |
|
19 |
import java.util.TreeMap; |
|
19 |
import java.util.List; |
|
20 | 20 |
|
21 | 21 |
import org.eclipse.core.databinding.observable.value.IObservableValue; |
22 | 22 |
import org.eclipse.core.databinding.observable.value.WritableValue; |
... | ... | |
31 | 31 |
*/ |
32 | 32 |
public class ExportSingleReadAlignmentWizardModel { |
33 | 33 |
protected static final JPhyloIOReaderWriterFactory READER_WRITER_FACTORY = new JPhyloIOReaderWriterFactory(); |
34 |
protected static final Map<String, JPhyloIOFormatInfo> FORMAT_NAMES_TO_INFO_MAP = createFormatInfoList();
|
|
34 |
protected static final List<JPhyloIOFormatInfo> FORMATS = createFormatInfoList();
|
|
35 | 35 |
|
36 | 36 |
|
37 |
private IObservableValue formatInfo = new WritableValue(null, String.class);
|
|
37 |
private IObservableValue formatInfo = new WritableValue(0, Integer.class);
|
|
38 | 38 |
private IObservableValue fileName = new WritableValue(null, String.class); |
39 | 39 |
private IObservableValue exportSingleReads = new WritableValue(true, Boolean.class); |
40 | 40 |
private IObservableValue exportConsensusSequence = new WritableValue(true, Boolean.class); |
... | ... | |
43 | 43 |
private IObservableValue useGapToken = new WritableValue(true, Boolean.class); |
44 | 44 |
|
45 | 45 |
|
46 |
private static Map<String, JPhyloIOFormatInfo> createFormatInfoList() {
|
|
47 |
Map<String, JPhyloIOFormatInfo> result = new TreeMap<String, JPhyloIOFormatInfo>();
|
|
46 |
private static List<JPhyloIOFormatInfo> createFormatInfoList() {
|
|
47 |
List<JPhyloIOFormatInfo> result = new ArrayList<JPhyloIOFormatInfo>();
|
|
48 | 48 |
for (String formatID : READER_WRITER_FACTORY.getFormatIDsSet()) { |
49 | 49 |
JPhyloIOFormatInfo info = READER_WRITER_FACTORY.getFormatInfo(formatID); |
50 | 50 |
if (info.isElementModeled(EventContentType.ALIGNMENT, false)) { // Check if the current format allows to write alignments. |
51 |
result.put(info.getFormatName(), info);
|
|
51 |
result.add(info);
|
|
52 | 52 |
} |
53 | 53 |
} |
54 |
return Collections.unmodifiableMap(result);
|
|
54 |
return Collections.unmodifiableList(result);
|
|
55 | 55 |
} |
56 | 56 |
|
57 | 57 |
|
... | ... | |
66 | 66 |
* @return the format info |
67 | 67 |
*/ |
68 | 68 |
public JPhyloIOFormatInfo getFormatInfo() { |
69 |
return FORMAT_NAMES_TO_INFO_MAP.get(formatInfo.getValue());
|
|
69 |
return FORMATS.get((Integer)formatInfo.getValue());
|
|
70 | 70 |
} |
71 | 71 |
|
72 | 72 |
|
... | ... | |
133 | 133 |
protected IObservableValue getUseGapTokenObservable() { |
134 | 134 |
return useGapToken; |
135 | 135 |
} |
136 |
|
|
137 |
|
|
138 | 136 |
} |
Also available in: Unified diff
Additional strings externalized in molecular plugin.
Wizard for exporting single read alignments now warns and prompts if files are overwritten.
Bug fix: Changes in the format selection in the wizard now trigger validation again.
ExportSingleReadAlignmentWizardModel uses format list instead of map again.