From 95cef3423465b45fe3c374adc67f440f974ff966 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 21 Jan 2021 16:09:16 +0100 Subject: [PATCH] remove unnecessary awtReavealer and trayModule --- .../ui/traymenu/TrayMenuComponent.java | 2 +- .../ui/traymenu/TrayMenuController.java | 9 +++---- .../ui/traymenu/TrayMenuModule.java | 27 ------------------- 3 files changed, 5 insertions(+), 33 deletions(-) delete mode 100644 main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuModule.java diff --git a/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuComponent.java b/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuComponent.java index 75e1b793c..c4cbfd456 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuComponent.java +++ b/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(); diff --git a/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuController.java b/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuController.java index 9d45b1b68..3311450e9 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuController.java +++ b/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 vaults; - private final Volume.Revealer revealer; private final PopupMenu menu; @Inject - TrayMenuController(ResourceBundle resourceBundle, AppLifecycleListener appLifecycle, FxApplicationStarter fxApplicationStarter, ObservableList vaults, Volume.Revealer revealer) { + TrayMenuController(ResourceBundle resourceBundle, AppLifecycleListener appLifecycle, FxApplicationStarter fxApplicationStarter, ObservableList 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) { diff --git a/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuModule.java b/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuModule.java deleted file mode 100644 index 99cf3d441..000000000 --- a/main/ui/src/main/java/org/cryptomator/ui/traymenu/TrayMenuModule.java +++ /dev/null @@ -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."); - } - }; - } -}