From ddc55cb591947f7e90c01a1362003893a5a22da4 Mon Sep 17 00:00:00 2001 From: rbouckaert Date: Mon, 8 Jan 2024 13:47:19 +1300 Subject: [PATCH] robustify for drag/dropping alignments. fixes #72 --- .../inputeditor/AlignmentListInputEditor.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/beastfx/app/inputeditor/AlignmentListInputEditor.java b/src/beastfx/app/inputeditor/AlignmentListInputEditor.java index 81f49e7..3c6a8ef 100644 --- a/src/beastfx/app/inputeditor/AlignmentListInputEditor.java +++ b/src/beastfx/app/inputeditor/AlignmentListInputEditor.java @@ -1240,7 +1240,22 @@ private void addItem(File[] fileArray) { break; } } - alignments.add(likelihood.dataInput.get()); + if (likelihood != null) { + alignments.add(likelihood.dataInput.get()); + } else { + // alignment maybe wrapped in a FilteredAlignment + for (BEASTInterface o2 : b.getOutputs()) { + if (o2 instanceof FilteredAlignment) { + for (BEASTInterface o : ((FilteredAlignment) o2).getOutputs()) { + if (o instanceof GenericTreeLikelihood) { + likelihood = (GenericTreeLikelihood) o; + alignments.add(likelihood.dataInput.get()); + break; + } + } + } + } + } } partitionCount = alignments.size(); tableData = null;