Bladeren bron

remove unnecessary awtReavealer and trayModule

Armin Schrenk 4 jaren geleden
bovenliggende
commit
95cef34234

+ 1 - 1
main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuComponent.java

@@ -10,7 +10,7 @@ import dagger.Subcomponent;
 import java.awt.SystemTray;
 
 @TrayMenuScoped
-@Subcomponent(modules = TrayMenuModule.class)
+@Subcomponent
 public interface TrayMenuComponent {
 
 	Lazy<TrayIconController> trayIconController();

+ 4 - 5
main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuController.java

@@ -1,7 +1,6 @@
 package org.cryptomator.ui.traymenu;
 
 import org.cryptomator.common.vaults.Vault;
-import org.cryptomator.common.vaults.Volume;
 import org.cryptomator.ui.fxapp.FxApplication;
 import org.cryptomator.ui.launcher.AppLifecycleListener;
 import org.cryptomator.ui.launcher.FxApplicationStarter;
@@ -28,16 +27,14 @@ class TrayMenuController {
 	private final AppLifecycleListener appLifecycle;
 	private final FxApplicationStarter fxApplicationStarter;
 	private final ObservableList<Vault> vaults;
-	private final Volume.Revealer revealer;
 	private final PopupMenu menu;
 
 	@Inject
-	TrayMenuController(ResourceBundle resourceBundle, AppLifecycleListener appLifecycle, FxApplicationStarter fxApplicationStarter, ObservableList<Vault> vaults, Volume.Revealer revealer) {
+	TrayMenuController(ResourceBundle resourceBundle, AppLifecycleListener appLifecycle, FxApplicationStarter fxApplicationStarter, ObservableList<Vault> vaults) {
 		this.resourceBundle = resourceBundle;
 		this.appLifecycle = appLifecycle;
 		this.fxApplicationStarter = fxApplicationStarter;
 		this.vaults = vaults;
-		this.revealer = revealer;
 		this.menu = new PopupMenu();
 	}
 
@@ -124,7 +121,9 @@ class TrayMenuController {
 	}
 
 	private void revealVault(Vault vault) {
-		showMainAppAndThen(app -> app.getVaultService().reveal(vault, revealer));
+		showMainAppAndThen(app -> //
+				app.getVaultService().reveal(vault, p -> app.getHostServices().showDocument(p.toUri().toString())) //
+		);
 	}
 
 	void showMainWindow(@SuppressWarnings("unused") ActionEvent actionEvent) {

+ 0 - 27
main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuModule.java

@@ -1,27 +0,0 @@
-package org.cryptomator.ui.traymenu;
-
-import dagger.Module;
-import dagger.Provides;
-import org.cryptomator.common.vaults.Volume;
-
-import java.awt.Desktop;
-import java.io.IOException;
-
-@Module
-abstract class TrayMenuModule {
-
-	@Provides
-	static Volume.Revealer provideAwtRevealer(){
-		return p -> {
-			if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
-				try {
-					Desktop.getDesktop().open(p.toFile());
-				} catch (IOException e) {
-					throw new Volume.VolumeException(e);
-				}
-			} else {
-				throw new Volume.VolumeException("API to browse files not supported. Please try again from inside the application.");
-			}
-		};
-	}
-}