import java.nio.file.Paths;
import java.util.Map;
import java.util.Optional;
+import java.util.function.Consumer;
import javax.inject.Named;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import org.simantics.fileimport.FileImportService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ImportFileHandler {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ImportFileHandler.class);
+
@CanExecute
public boolean canExecute() {
return !FileImportService.supportedExtensionsWithFilters().isEmpty();
final String fileName = dialog.open();
if (fileName == null)
return;
- FileImportService.performFileImport(Paths.get(fileName), Optional.empty());
+
+ FileImportService.performFileImport(Paths.get(fileName), Optional.of((Consumer<Throwable>) t -> {
+ LOGGER.error("Could not import file " + fileName, t);
+ }));
}
}
\ No newline at end of file