remove unnecessary awtReavealer and trayModule

This commit is contained in:
Armin Schrenk
2021-01-21 16:09:16 +01:00
parent 8977440697
commit 95cef34234
3 changed files with 5 additions and 33 deletions

View File

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

View File

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

View File

@@ -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.");
}
};
}
}