fixing use of desktop features on headless platform

This commit is contained in:
Sebastian Stenzel
2017-12-30 21:05:01 +01:00
parent 08cfcffa72
commit b8ee19b395
3 changed files with 17 additions and 8 deletions
@@ -24,9 +24,13 @@ class FileOpenRequestHandler {
public FileOpenRequestHandler(BlockingQueue<Path> fileOpenRequests) {
this.fileOpenRequests = fileOpenRequests;
Desktop.getDesktop().setOpenFileHandler(e -> {
e.getFiles().stream().map(File::toPath).forEach(fileOpenRequests::add);
});
try {
Desktop.getDesktop().setOpenFileHandler(e -> {
e.getFiles().stream().map(File::toPath).forEach(fileOpenRequests::add);
});
} catch (UnsupportedOperationException e) {
LOG.info("Unable to setOpenFileHandler, probably not supported on this OS.");
}
}
public void handleLaunchArgs(String[] args) {