Browse Source

fixing use of desktop features on headless platform

Sebastian Stenzel 7 years ago
parent
commit
b8ee19b395

+ 7 - 3
main/launcher/src/main/java/org/cryptomator/launcher/FileOpenRequestHandler.java

@@ -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) {

+ 3 - 2
main/pom.xml

@@ -310,8 +310,9 @@
 				<artifactId>maven-compiler-plugin</artifactId>
 				<version>3.7.0</version>
 				<configuration>
-					<source>1.8</source>
-					<target>1.8</target>
+					<source>9</source>
+					<target>9</target>
+					<release>9</release>
 				</configuration>
 			</plugin>
 		</plugins>

+ 7 - 3
main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java

@@ -128,9 +128,13 @@ public class MainController implements ViewController {
 		EasyBind.subscribe(areAllVaultsLocked, Platform::setImplicitExit);
 		autoUnlocker.unlockAllSilently();
 
-		Desktop.getDesktop().setPreferencesHandler(e -> {
-			Platform.runLater(this::toggleShowSettings);
-		});
+		try {
+			Desktop.getDesktop().setPreferencesHandler(e -> {
+				Platform.runLater(this::toggleShowSettings);
+			});
+		} catch (UnsupportedOperationException e) {
+			LOG.info("Unable to setPreferencesHandler, probably not supported on this OS.");
+		}
 	}
 
 	@FXML