SwingUtilities.invokeLater(() -> {
final AddMediaDialog dialog = new AddMediaDialog(templates, preselectedFiles);
final int value = dialog.showDialog();
if (value == JOptionPane.OK_OPTION) {
final AddModel model = dialog.getModel();
<BUG>final File[] files1 = model.getMediaFiles();

if (files1.length > 0) {

core.addMedia(files1, model.getTemplate(), model.getExternalMetadataSource());
</BUG>
}

SwingUtilities.invokeLater(() -> {
previews.removeAll();
editContainer.removeAll();
validate();
for (final Media media : core.getMedia()) {
add(media);
