From 191cd49b290bd3bdcab8b9219579c18f6bf425c0 Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 14 Nov 2024 15:24:57 +0000 Subject: [PATCH] Reformat --- .../file/BrowserFileSystemTabModel.java | 18 ++++++++------- .../file/BrowserTerminalDockTabModel.java | 10 ++++++--- .../xpipe/app/core/window/ModifiedStage.java | 5 ++++- .../core/window/NativeWinWindowControl.java | 2 -- .../xpipe/app/issue/TerminalErrorHandler.java | 6 +---- .../app/terminal/ExternalTerminalType.java | 16 +++++++++----- .../xpipe/app/terminal/GnomeTerminalType.java | 3 ++- .../xpipe/app/terminal/KittyTerminalType.java | 3 +-- .../app/terminal/MobaXTermTerminalType.java | 22 ++++++++++++++----- .../app/terminal/SecureCrtTerminalType.java | 18 +++++++++++---- .../terminal/TerminalLaunchConfiguration.java | 12 +++++++--- .../xpipe/app/terminal/TerminalLauncher.java | 3 ++- .../app/terminal/TerminalOpenFormat.java | 1 - .../io/xpipe/app/terminal/TerminalView.java | 16 +++++++++----- .../app/terminal/TermiusTerminalType.java | 16 ++++++++++---- .../xpipe/app/terminal/WarpTerminalType.java | 21 +++++++++++------- .../app/terminal/WindowsTerminalType.java | 10 ++++++--- .../app/terminal/XShellTerminalType.java | 19 +++++++++++----- .../app/update/UpdateAvailableAlert.java | 1 - .../io/xpipe/app/update/UpdateHandler.java | 3 +-- .../java/io/xpipe/app/util/FileOpener.java | 4 ++-- .../io/xpipe/app/util/LicensedFeature.java | 1 - .../io/xpipe/app/util/OptionsBuilder.java | 8 +------ .../ext/base/browser/MultiExecuteAction.java | 14 +++++++----- .../browser/MultiExecuteSelectionAction.java | 14 +++++++----- .../ext/base/browser/OpenTerminalAction.java | 13 ++++++----- 26 files changed, 162 insertions(+), 97 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java index f89d4342f..e746914f4 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileSystemTabModel.java @@ -279,12 +279,11 @@ public final class BrowserFileSystemTabModel extends BrowserStoreSessionTab { if (fileSystem == null) { return; @@ -550,9 +550,11 @@ public final class BrowserFileSystemTabModel extends BrowserStoreSessionTab terminalRequests.contains(s.getRequest()) && s.getTerminal().isRunning()) + var tv = sessions.stream() + .filter(s -> terminalRequests.contains(s.getRequest()) + && s.getTerminal().isRunning()) .map(s -> s.getTerminal().controllable()) .flatMap(Optional::stream) .toList(); @@ -72,7 +73,10 @@ public final class BrowserTerminalDockTabModel extends BrowserSessionTab { @Override public void onTerminalClosed(TerminalView.TerminalSession instance) { var sessions = TerminalView.get().getSessions(); - var remaining = sessions.stream().filter(s -> terminalRequests.contains(s.getRequest()) && s.getTerminal().isRunning()).toList(); + var remaining = sessions.stream() + .filter(s -> terminalRequests.contains(s.getRequest()) + && s.getTerminal().isRunning()) + .toList(); if (remaining.isEmpty()) { ((BrowserFullSessionModel) browserModel).unsplitTab(BrowserTerminalDockTabModel.this); } diff --git a/app/src/main/java/io/xpipe/app/core/window/ModifiedStage.java b/app/src/main/java/io/xpipe/app/core/window/ModifiedStage.java index 0c55e177b..1498d2544 100644 --- a/app/src/main/java/io/xpipe/app/core/window/ModifiedStage.java +++ b/app/src/main/java/io/xpipe/app/core/window/ModifiedStage.java @@ -88,7 +88,10 @@ public class ModifiedStage extends Stage { NativeWinWindowControl.DmwaWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE.get(), AppPrefs.get().theme.getValue().isDark()); boolean seamlessFrame; - if (AppPrefs.get().performanceMode().get() || !mergeFrame() || AppMainWindow.getInstance() == null || stage != AppMainWindow.getInstance().getStage()) { + if (AppPrefs.get().performanceMode().get() + || !mergeFrame() + || AppMainWindow.getInstance() == null + || stage != AppMainWindow.getInstance().getStage()) { seamlessFrame = false; } else { seamlessFrame = ctrl.setWindowBackdrop(NativeWinWindowControl.DwmSystemBackDropType.MICA_ALT); diff --git a/app/src/main/java/io/xpipe/app/core/window/NativeWinWindowControl.java b/app/src/main/java/io/xpipe/app/core/window/NativeWinWindowControl.java index bcde86cf9..6fc1a973e 100644 --- a/app/src/main/java/io/xpipe/app/core/window/NativeWinWindowControl.java +++ b/app/src/main/java/io/xpipe/app/core/window/NativeWinWindowControl.java @@ -19,8 +19,6 @@ import lombok.SneakyThrows; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicReference; @Getter @EqualsAndHashCode diff --git a/app/src/main/java/io/xpipe/app/issue/TerminalErrorHandler.java b/app/src/main/java/io/xpipe/app/issue/TerminalErrorHandler.java index 7aa953894..287153182 100644 --- a/app/src/main/java/io/xpipe/app/issue/TerminalErrorHandler.java +++ b/app/src/main/java/io/xpipe/app/issue/TerminalErrorHandler.java @@ -3,7 +3,6 @@ package io.xpipe.app.issue; import io.xpipe.app.core.*; import io.xpipe.app.core.mode.OperationMode; import io.xpipe.app.core.window.AppWindowHelper; -import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.update.XPipeDistributionType; import io.xpipe.app.util.Hyperlinks; import io.xpipe.app.util.ThreadHelper; @@ -74,10 +73,7 @@ public class TerminalErrorHandler extends GuiErrorHandlerBase implements ErrorHa } try { - var rel = XPipeDistributionType.get() - .getUpdateHandler() - .refreshUpdateCheck( - false, false); + var rel = XPipeDistributionType.get().getUpdateHandler().refreshUpdateCheck(false, false); if (rel != null && rel.isUpdate()) { var update = AppWindowHelper.showBlockingAlert(alert -> { alert.setAlertType(Alert.AlertType.INFORMATION); diff --git a/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java index db24fca56..edd58a6c8 100644 --- a/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java @@ -126,7 +126,10 @@ public interface ExternalTerminalType extends PrefsChoiceValue { // Note for later: When debugging konsole launches, it will always open as a child process of // IntelliJ/XPipe even though we try to detach it. // This is not the case for production where it works as expected - return CommandBuilder.of().addIf(configuration.isPreferTabs(), "--new-tab").add("-e").addFile(configuration.getScriptFile()); + return CommandBuilder.of() + .addIf(configuration.isPreferTabs(), "--new-tab") + .add("-e") + .addFile(configuration.getScriptFile()); } }; ExternalTerminalType XFCE = new SimplePathType("app.xfce", "xfce4-terminal", true) { @@ -153,7 +156,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue { @Override protected CommandBuilder toCommand(TerminalLaunchConfiguration configuration) { return CommandBuilder.of() - .addIf(configuration.isPreferTabs(),"--tab") + .addIf(configuration.isPreferTabs(), "--tab") .add("--title") .addQuoted(configuration.getColoredTitle()) .add("--command") @@ -213,7 +216,10 @@ public interface ExternalTerminalType extends PrefsChoiceValue { @Override protected CommandBuilder toCommand(TerminalLaunchConfiguration configuration) { - return CommandBuilder.of().addIf(configuration.isPreferTabs(), "--new-tab").add("-e").addFile(configuration.getScriptFile()); + return CommandBuilder.of() + .addIf(configuration.isPreferTabs(), "--new-tab") + .add("-e") + .addFile(configuration.getScriptFile()); } }; ExternalTerminalType TILIX = new SimplePathType("app.tilix", "tilix", true) { @@ -642,7 +648,8 @@ public interface ExternalTerminalType extends PrefsChoiceValue { default void launch(TerminalLaunchConfiguration configuration) throws Exception {} - default FailableFunction remoteLaunchCommand(ShellDialect systemDialect) { + default FailableFunction remoteLaunchCommand( + ShellDialect systemDialect) { return null; } @@ -713,5 +720,4 @@ public interface ExternalTerminalType extends PrefsChoiceValue { protected abstract CommandBuilder toCommand(TerminalLaunchConfiguration configuration) throws Exception; } - } diff --git a/app/src/main/java/io/xpipe/app/terminal/GnomeTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/GnomeTerminalType.java index 91a344d6a..61b9a8c90 100644 --- a/app/src/main/java/io/xpipe/app/terminal/GnomeTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/GnomeTerminalType.java @@ -51,7 +51,8 @@ public class GnomeTerminalType extends ExternalTerminalType.PathCheckType implem } @Override - public FailableFunction remoteLaunchCommand(ShellDialect systemDialect) { + public FailableFunction remoteLaunchCommand( + ShellDialect systemDialect) { return launchConfiguration -> { var toExecute = CommandBuilder.of() .add(executable, "-v", "--title") diff --git a/app/src/main/java/io/xpipe/app/terminal/KittyTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/KittyTerminalType.java index 8c0e1f20c..70daca1ba 100644 --- a/app/src/main/java/io/xpipe/app/terminal/KittyTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/KittyTerminalType.java @@ -27,8 +27,7 @@ public interface KittyTerminalType extends ExternalTerminalType, TrackableTermin } } - private static void open(TerminalLaunchConfiguration configuration, CommandBuilder socketWrite) - throws Exception { + private static void open(TerminalLaunchConfiguration configuration, CommandBuilder socketWrite) throws Exception { try (var sc = LocalShell.getShell().start()) { var payload = JsonNodeFactory.instance.objectNode(); var args = configuration.getDialectLaunchCommand().buildBaseParts(sc); diff --git a/app/src/main/java/io/xpipe/app/terminal/MobaXTermTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/MobaXTermTerminalType.java index edc01c31f..dad2d89a0 100644 --- a/app/src/main/java/io/xpipe/app/terminal/MobaXTermTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/MobaXTermTerminalType.java @@ -13,7 +13,9 @@ import java.util.Optional; public class MobaXTermTerminalType extends ExternalTerminalType.WindowsType { - public MobaXTermTerminalType() {super("app.mobaXterm", "MobaXterm");} + public MobaXTermTerminalType() { + super("app.mobaXterm", "MobaXterm"); + } @Override public TerminalOpenFormat getOpenFormat() { @@ -23,7 +25,8 @@ public class MobaXTermTerminalType extends ExternalTerminalType.WindowsType { @Override protected Optional determineInstallation() { try { - var r = WindowsRegistry.local().readValue(WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\mobaxterm\\DefaultIcon"); + var r = WindowsRegistry.local() + .readValue(WindowsRegistry.HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\mobaxterm\\DefaultIcon"); return r.map(Path::of); } catch (Exception e) { ErrorEvent.fromThrowable(e).omit().handle(); @@ -51,14 +54,23 @@ public class MobaXTermTerminalType extends ExternalTerminalType.WindowsType { try (var sc = LocalShell.getShell()) { SshLocalBridge.init(); var b = SshLocalBridge.get(); - var command = CommandBuilder.of().addFile("ssh").addQuoted(b.getUser() + "@localhost").add("-i").add( - "\"$(cygpath \"" + b.getIdentityKey().toString() + "\")\"").add("-p").add("" + b.getPort()); + var command = CommandBuilder.of() + .addFile("ssh") + .addQuoted(b.getUser() + "@localhost") + .add("-i") + .add("\"$(cygpath \"" + b.getIdentityKey().toString() + "\")\"") + .add("-p") + .add("" + b.getPort()); // Don't use local shell to build as it uses cygwin var rawCommand = command.buildSimple(); var script = ScriptHelper.getExecScriptFile(sc, "sh"); Files.writeString(Path.of(script.toString()), rawCommand); var fixedFile = script.toString().replaceAll("\\\\", "/").replaceAll("\\s", "\\$0"); - sc.command(CommandBuilder.of().addFile(file.toString()).add("-newtab").add(fixedFile)).execute(); + sc.command(CommandBuilder.of() + .addFile(file.toString()) + .add("-newtab") + .add(fixedFile)) + .execute(); } } } diff --git a/app/src/main/java/io/xpipe/app/terminal/SecureCrtTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/SecureCrtTerminalType.java index b08e9edba..389902fac 100644 --- a/app/src/main/java/io/xpipe/app/terminal/SecureCrtTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/SecureCrtTerminalType.java @@ -11,7 +11,9 @@ import java.util.Optional; public class SecureCrtTerminalType extends ExternalTerminalType.WindowsType { - public SecureCrtTerminalType() {super("app.secureCrt", "SecureCRT");} + public SecureCrtTerminalType() { + super("app.secureCrt", "SecureCRT"); + } @Override public TerminalOpenFormat getOpenFormat() { @@ -21,7 +23,8 @@ public class SecureCrtTerminalType extends ExternalTerminalType.WindowsType { @Override protected Optional determineInstallation() { try (var sc = LocalShell.getShell().start()) { - var env = sc.executeSimpleStringCommand(sc.getShellDialect().getPrintEnvironmentVariableCommand("ProgramFiles")); + var env = sc.executeSimpleStringCommand( + sc.getShellDialect().getPrintEnvironmentVariableCommand("ProgramFiles")); var file = Path.of(env, "VanDyke Software\\SecureCRT\\SecureCRT.exe"); if (!Files.exists(file)) { return Optional.empty(); @@ -54,8 +57,15 @@ public class SecureCrtTerminalType extends ExternalTerminalType.WindowsType { try (var sc = LocalShell.getShell()) { SshLocalBridge.init(); var b = SshLocalBridge.get(); - var command = CommandBuilder.of().addFile(file.toString()).add("/T").add("/SSH2", "/ACCEPTHOSTKEYS", "/I").addFile( - b.getIdentityKey().toString()).add("/P", "" + b.getPort()).add("/L").addQuoted(b.getUser()).add("localhost"); + var command = CommandBuilder.of() + .addFile(file.toString()) + .add("/T") + .add("/SSH2", "/ACCEPTHOSTKEYS", "/I") + .addFile(b.getIdentityKey().toString()) + .add("/P", "" + b.getPort()) + .add("/L") + .addQuoted(b.getUser()) + .add("localhost"); sc.executeSimpleCommand(command); } } diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchConfiguration.java b/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchConfiguration.java index c44d13b86..fcf3dca87 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchConfiguration.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalLaunchConfiguration.java @@ -16,6 +16,7 @@ import io.xpipe.core.process.OsType; import io.xpipe.core.process.ShellDialect; import io.xpipe.core.process.ShellDialects; import io.xpipe.core.store.FilePath; + import lombok.Value; import lombok.With; @@ -41,8 +42,8 @@ public class TerminalLaunchConfiguration { DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss").withZone(ZoneId.systemDefault()); public static TerminalLaunchConfiguration create( - UUID request, DataStoreEntry entry, String cleanTitle, String adjustedTitle, boolean preferTabs - ) throws Exception { + UUID request, DataStoreEntry entry, String cleanTitle, String adjustedTitle, boolean preferTabs) + throws Exception { var color = entry != null ? DataStorage.get().getEffectiveColor(entry) : null; var d = ProcessControlProvider.get().getEffectiveLocalDialect(); var launcherScript = d.terminalLauncherScript(request, adjustedTitle); @@ -84,7 +85,12 @@ public class TerminalLaunchConfiguration { logFile.getFileName().toString()); var ps = ScriptHelper.createExecScript(ShellDialects.POWERSHELL, sc, content); var config = new TerminalLaunchConfiguration( - entry != null ? color : null, adjustedTitle, cleanTitle, preferTabs, ps, ShellDialects.POWERSHELL); + entry != null ? color : null, + adjustedTitle, + cleanTitle, + preferTabs, + ps, + ShellDialects.POWERSHELL); return config; } else { var found = sc.command(sc.getShellDialect().getWhichCommand("script")) diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java b/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java index 52ad4b8a9..b60bd9455 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalLauncher.java @@ -49,7 +49,8 @@ public class TerminalLauncher { open(entry, title, directory, cc, UUID.randomUUID(), true); } - public static void open(DataStoreEntry entry, String title, String directory, ProcessControl cc, UUID request, boolean preferTabs) + public static void open( + DataStoreEntry entry, String title, String directory, ProcessControl cc, UUID request, boolean preferTabs) throws Exception { var type = AppPrefs.get().terminalType().getValue(); if (type == null) { diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalOpenFormat.java b/app/src/main/java/io/xpipe/app/terminal/TerminalOpenFormat.java index aa217d735..d7500a02e 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalOpenFormat.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalOpenFormat.java @@ -1,7 +1,6 @@ package io.xpipe.app.terminal; public enum TerminalOpenFormat { - NEW_WINDOW, TABBED, NEW_WINDOW_OR_TABBED; diff --git a/app/src/main/java/io/xpipe/app/terminal/TerminalView.java b/app/src/main/java/io/xpipe/app/terminal/TerminalView.java index 225d231d9..c210c5cda 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TerminalView.java +++ b/app/src/main/java/io/xpipe/app/terminal/TerminalView.java @@ -49,13 +49,17 @@ public class TerminalView { public static interface Listener { - default void onSessionOpened(ShellSession session) {}; + default void onSessionOpened(ShellSession session) {} + ; - default void onSessionClosed(ShellSession session) {}; + default void onSessionClosed(ShellSession session) {} + ; - default void onTerminalOpened(TerminalSession instance) {}; + default void onTerminalOpened(TerminalSession instance) {} + ; - default void onTerminalClosed(TerminalSession instance) {}; + default void onTerminalClosed(TerminalSession instance) {} + ; } private final List sessions = new ArrayList<>(); @@ -130,7 +134,9 @@ public class TerminalView { yield Optional.empty(); } - var existing = terminalInstances.stream().map(terminalSession -> ((WindowsTerminalSession) terminalSession).getControl()).toList(); + var existing = terminalInstances.stream() + .map(terminalSession -> ((WindowsTerminalSession) terminalSession).getControl()) + .toList(); controls.removeAll(existing); if (controls.isEmpty()) { yield Optional.empty(); diff --git a/app/src/main/java/io/xpipe/app/terminal/TermiusTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/TermiusTerminalType.java index 33d5810af..7890cfb81 100644 --- a/app/src/main/java/io/xpipe/app/terminal/TermiusTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/TermiusTerminalType.java @@ -10,6 +10,7 @@ import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.SshLocalBridge; import io.xpipe.app.util.WindowsRegistry; import io.xpipe.core.process.OsType; + import javafx.scene.control.Alert; import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonType; @@ -41,7 +42,8 @@ public class TermiusTerminalType implements ExternalTerminalType { yield Files.exists(Path.of("/Applications/Termius.app")); } case OsType.Windows windows -> { - var r = WindowsRegistry.local().readValue(WindowsRegistry.HKEY_CURRENT_USER, "SOFTWARE\\Classes\\termius"); + var r = WindowsRegistry.local() + .readValue(WindowsRegistry.HKEY_CURRENT_USER, "SOFTWARE\\Classes\\termius"); yield r.isPresent(); } }; @@ -78,7 +80,8 @@ public class TermiusTerminalType implements ExternalTerminalType { var port = b.getPort(); var user = b.getUser(); var name = b.getIdentityKey().getFileName().toString(); - Hyperlinks.open("termius://app/host-sharing#label=" + name + "&ip=" + host + "&port=" + port + "&username=" + user + "&os=undefined"); + Hyperlinks.open("termius://app/host-sharing#label=" + name + "&ip=" + host + "&port=" + port + "&username=" + + user + "&os=undefined"); } private boolean showInfo() throws IOException { @@ -93,8 +96,13 @@ public class TermiusTerminalType implements ExternalTerminalType { alert.setTitle(AppI18n.get("termiusSetup")); alert.setAlertType(Alert.AlertType.NONE); - var activated = AppI18n.get().getMarkdownDocumentation("app:termiusSetup").formatted(b.getIdentityKey(), keyContent); - var markdown = new MarkdownComp(activated, s -> s).prefWidth(450).prefHeight(450).createRegion(); + var activated = AppI18n.get() + .getMarkdownDocumentation("app:termiusSetup") + .formatted(b.getIdentityKey(), keyContent); + var markdown = new MarkdownComp(activated, s -> s) + .prefWidth(450) + .prefHeight(450) + .createRegion(); alert.getDialogPane().setContent(markdown); alert.getButtonTypes().add(new ButtonType(AppI18n.get("ok"), ButtonBar.ButtonData.OK_DONE)); diff --git a/app/src/main/java/io/xpipe/app/terminal/WarpTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/WarpTerminalType.java index 8748a1994..ef814fbfe 100644 --- a/app/src/main/java/io/xpipe/app/terminal/WarpTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/WarpTerminalType.java @@ -9,7 +9,9 @@ import io.xpipe.core.util.FailableFunction; public class WarpTerminalType extends ExternalTerminalType.MacOsType { - public WarpTerminalType() {super("app.warp", "Warp");} + public WarpTerminalType() { + super("app.warp", "Warp"); + } @Override public TerminalOpenFormat getOpenFormat() { @@ -43,18 +45,21 @@ public class WarpTerminalType extends ExternalTerminalType.MacOsType { @Override public void launch(TerminalLaunchConfiguration configuration) throws Exception { - LocalShell.getShell().executeSimpleCommand(CommandBuilder.of() - .add("open", "-a") - .addQuoted("Warp.app") - .addFile(configuration.getScriptFile())); + LocalShell.getShell() + .executeSimpleCommand(CommandBuilder.of() + .add("open", "-a") + .addQuoted("Warp.app") + .addFile(configuration.getScriptFile())); } @Override public FailableFunction remoteLaunchCommand( - ShellDialect systemDialect - ) { + ShellDialect systemDialect) { return launchConfiguration -> { - var toExecute = CommandBuilder.of().add("open", "-a").addQuoted("Warp.app").addFile(launchConfiguration.getScriptFile()); + var toExecute = CommandBuilder.of() + .add("open", "-a") + .addQuoted("Warp.app") + .addFile(launchConfiguration.getScriptFile()); return toExecute.buildSimple(); }; } diff --git a/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java index cce15eaa2..6f2b0e727 100644 --- a/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java @@ -19,7 +19,9 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm ExternalTerminalType WINDOWS_TERMINAL_CANARY = new Canary(); private static CommandBuilder toCommand(TerminalLaunchConfiguration configuration) throws Exception { - var cmd = CommandBuilder.of().addIf(configuration.isPreferTabs(), "-w", "1").add("nt"); + var cmd = CommandBuilder.of() + .addIf(configuration.isPreferTabs(), "-w", "1") + .add("nt"); if (configuration.getColor() != null) { cmd.add("--tabColor").addQuoted(configuration.getColor().toHexString()); @@ -105,7 +107,8 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm @Override public void launch(TerminalLaunchConfiguration configuration) throws Exception { if (!isAvailable()) { - throw ErrorEvent.expected(new IllegalArgumentException("Windows Terminal Preview is not installed at " + getPath())); + throw ErrorEvent.expected( + new IllegalArgumentException("Windows Terminal Preview is not installed at " + getPath())); } LocalShell.getShell() @@ -140,7 +143,8 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm @Override public void launch(TerminalLaunchConfiguration configuration) throws Exception { if (!isAvailable()) { - throw ErrorEvent.expected(new IllegalArgumentException("Windows Terminal Canary is not installed at " + getPath())); + throw ErrorEvent.expected( + new IllegalArgumentException("Windows Terminal Canary is not installed at " + getPath())); } LocalShell.getShell() diff --git a/app/src/main/java/io/xpipe/app/terminal/XShellTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/XShellTerminalType.java index 954c836c1..63cb52bbd 100644 --- a/app/src/main/java/io/xpipe/app/terminal/XShellTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/XShellTerminalType.java @@ -9,6 +9,7 @@ import io.xpipe.app.util.LocalShell; import io.xpipe.app.util.SshLocalBridge; import io.xpipe.app.util.WindowsRegistry; import io.xpipe.core.process.CommandBuilder; + import javafx.scene.control.Alert; import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonType; @@ -18,7 +19,9 @@ import java.util.Optional; public class XShellTerminalType extends ExternalTerminalType.WindowsType { - public XShellTerminalType() {super("app.xShell", "Xshell");} + public XShellTerminalType() { + super("app.xShell", "Xshell"); + } @Override public TerminalOpenFormat getOpenFormat() { @@ -28,8 +31,10 @@ public class XShellTerminalType extends ExternalTerminalType.WindowsType { @Override protected Optional determineInstallation() { try { - var r = WindowsRegistry.local().readValue(WindowsRegistry.HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Xshell.exe"); + var r = WindowsRegistry.local() + .readValue( + WindowsRegistry.HKEY_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Xshell.exe"); return r.map(Path::of); } catch (Exception e) { ErrorEvent.fromThrowable(e).omit().handle(); @@ -83,8 +88,12 @@ public class XShellTerminalType extends ExternalTerminalType.WindowsType { alert.setTitle(AppI18n.get("xshellSetup")); alert.setAlertType(Alert.AlertType.NONE); - var activated = AppI18n.get().getMarkdownDocumentation("app:xshellSetup").formatted(b.getIdentityKey(), keyName); - var markdown = new MarkdownComp(activated, s -> s).prefWidth(450).prefHeight(400).createRegion(); + var activated = + AppI18n.get().getMarkdownDocumentation("app:xshellSetup").formatted(b.getIdentityKey(), keyName); + var markdown = new MarkdownComp(activated, s -> s) + .prefWidth(450) + .prefHeight(400) + .createRegion(); alert.getDialogPane().setContent(markdown); alert.getButtonTypes().add(new ButtonType(AppI18n.get("ok"), ButtonBar.ButtonData.OK_DONE)); diff --git a/app/src/main/java/io/xpipe/app/update/UpdateAvailableAlert.java b/app/src/main/java/io/xpipe/app/update/UpdateAvailableAlert.java index 99e178e0e..7b09f853f 100644 --- a/app/src/main/java/io/xpipe/app/update/UpdateAvailableAlert.java +++ b/app/src/main/java/io/xpipe/app/update/UpdateAvailableAlert.java @@ -3,7 +3,6 @@ package io.xpipe.app.update; import io.xpipe.app.comp.base.MarkdownComp; import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.window.AppWindowHelper; -import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.util.Hyperlinks; import javafx.event.ActionEvent; diff --git a/app/src/main/java/io/xpipe/app/update/UpdateHandler.java b/app/src/main/java/io/xpipe/app/update/UpdateHandler.java index da703f4a9..8169db97d 100644 --- a/app/src/main/java/io/xpipe/app/update/UpdateHandler.java +++ b/app/src/main/java/io/xpipe/app/update/UpdateHandler.java @@ -214,8 +214,7 @@ public abstract class UpdateHandler { // We only do that here to minimize the sent requests by only executing when it's really necessary var available = XPipeDistributionType.get() .getUpdateHandler() - .refreshUpdateCheckSilent( - false, preparedUpdate.getValue().isSecurityOnly()); + .refreshUpdateCheckSilent(false, preparedUpdate.getValue().isSecurityOnly()); if (preparedUpdate.getValue() == null) { return; } diff --git a/app/src/main/java/io/xpipe/app/util/FileOpener.java b/app/src/main/java/io/xpipe/app/util/FileOpener.java index 71785e231..4b1dd6ada 100644 --- a/app/src/main/java/io/xpipe/app/util/FileOpener.java +++ b/app/src/main/java/io/xpipe/app/util/FileOpener.java @@ -4,7 +4,6 @@ import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.OsType; -import io.xpipe.core.process.ShellDialect; import io.xpipe.core.process.ShellDialects; import java.io.ByteArrayInputStream; @@ -59,7 +58,8 @@ public class FileOpener { try (var pc = LocalShell.getShell().start()) { if (pc.getOsType().equals(OsType.WINDOWS)) { if (pc.getShellDialect() == ShellDialects.POWERSHELL) { - pc.command(CommandBuilder.of().add("Invoke-Item").addFile(localFile)).execute(); + pc.command(CommandBuilder.of().add("Invoke-Item").addFile(localFile)) + .execute(); } else { pc.executeSimpleCommand("start \"\" \"" + localFile + "\""); } diff --git a/app/src/main/java/io/xpipe/app/util/LicensedFeature.java b/app/src/main/java/io/xpipe/app/util/LicensedFeature.java index 8641934c9..e253b945d 100644 --- a/app/src/main/java/io/xpipe/app/util/LicensedFeature.java +++ b/app/src/main/java/io/xpipe/app/util/LicensedFeature.java @@ -2,7 +2,6 @@ package io.xpipe.app.util; import io.xpipe.app.core.AppI18n; -import javafx.beans.binding.Bindings; import javafx.beans.value.ObservableValue; import java.util.Optional; diff --git a/app/src/main/java/io/xpipe/app/util/OptionsBuilder.java b/app/src/main/java/io/xpipe/app/util/OptionsBuilder.java index b8a7e03e8..4fc51e949 100644 --- a/app/src/main/java/io/xpipe/app/util/OptionsBuilder.java +++ b/app/src/main/java/io/xpipe/app/util/OptionsBuilder.java @@ -10,7 +10,6 @@ import io.xpipe.core.util.InPlaceSecretValue; import javafx.beans.property.*; import javafx.beans.value.ObservableValue; import javafx.geometry.Orientation; -import javafx.scene.control.Label; import javafx.scene.layout.Region; import atlantafx.base.controls.Spacer; @@ -138,12 +137,7 @@ public class OptionsBuilder { public OptionsBuilder addTitle(ObservableValue title) { finishCurrent(); - entries.add(new OptionsComp.Entry( - null, - null, - null, - null, - new LabelComp(title).styleClass("title-header"))); + entries.add(new OptionsComp.Entry(null, null, null, null, new LabelComp(title).styleClass("title-header"))); return this; } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/MultiExecuteAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/MultiExecuteAction.java index 82256c61d..e17184d37 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/MultiExecuteAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/MultiExecuteAction.java @@ -6,14 +6,12 @@ import io.xpipe.app.browser.file.BrowserEntry; import io.xpipe.app.browser.file.BrowserFileSystemTabModel; import io.xpipe.app.core.AppI18n; import io.xpipe.app.prefs.AppPrefs; -import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.ShellControl; import javafx.beans.value.ObservableValue; import java.util.List; -import java.util.UUID; public abstract class MultiExecuteAction implements BrowserBranchAction { @@ -36,10 +34,14 @@ public abstract class MultiExecuteAction implements BrowserBranchAction { } var cmd = pc.command(c); - model.openTerminalAsync(entry.getRawFileEntry().getName(), model.getCurrentDirectory() != null - ? model.getCurrentDirectory() - .getPath() - : null, cmd, entries.size() == 1); + model.openTerminalAsync( + entry.getRawFileEntry().getName(), + model.getCurrentDirectory() != null + ? model.getCurrentDirectory() + .getPath() + : null, + cmd, + entries.size() == 1); } }, false); diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/MultiExecuteSelectionAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/MultiExecuteSelectionAction.java index 24302678a..92fa99f91 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/MultiExecuteSelectionAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/MultiExecuteSelectionAction.java @@ -7,7 +7,6 @@ import io.xpipe.app.browser.file.BrowserFileSystemTabModel; import io.xpipe.app.core.AppI18n; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.prefs.AppPrefs; -import io.xpipe.app.terminal.TerminalLauncher; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.ProcessOutputException; import io.xpipe.core.process.ShellControl; @@ -15,7 +14,6 @@ import io.xpipe.core.process.ShellControl; import javafx.beans.value.ObservableValue; import java.util.List; -import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; public abstract class MultiExecuteSelectionAction implements BrowserBranchAction { @@ -40,10 +38,14 @@ public abstract class MultiExecuteSelectionAction implements BrowserBranchAction } var cmd = pc.command(c); - model.openTerminalAsync(getTerminalTitle(), model.getCurrentDirectory() != null - ? model.getCurrentDirectory() - .getPath() - : null, cmd, true); + model.openTerminalAsync( + getTerminalTitle(), + model.getCurrentDirectory() != null + ? model.getCurrentDirectory() + .getPath() + : null, + cmd, + true); }, false); } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenTerminalAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenTerminalAction.java index d35cfe3df..d9500e84e 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenTerminalAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/OpenTerminalAction.java @@ -1,10 +1,8 @@ package io.xpipe.ext.base.browser; -import io.xpipe.app.browser.BrowserFullSessionModel; import io.xpipe.app.browser.action.BrowserLeafAction; import io.xpipe.app.browser.file.BrowserEntry; import io.xpipe.app.browser.file.BrowserFileSystemTabModel; -import io.xpipe.app.browser.file.BrowserTerminalDockTabModel; import io.xpipe.app.core.AppI18n; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.core.store.FileKind; @@ -17,7 +15,6 @@ import javafx.scene.input.KeyCombination; import org.kordamp.ikonli.javafx.FontIcon; -import java.util.Collection; import java.util.Collections; import java.util.List; @@ -25,9 +22,13 @@ public class OpenTerminalAction implements BrowserLeafAction { @Override public void execute(BrowserFileSystemTabModel model, List entries) { - var dirs = entries.size() > 0 ? entries.stream().map(browserEntry -> browserEntry.getRawFileEntry().getPath()).toList() : model.getCurrentDirectory() != null - ? List.of(model.getCurrentDirectory().getPath()) - : Collections.singletonList((String) null); + var dirs = entries.size() > 0 + ? entries.stream() + .map(browserEntry -> browserEntry.getRawFileEntry().getPath()) + .toList() + : model.getCurrentDirectory() != null + ? List.of(model.getCurrentDirectory().getPath()) + : Collections.singletonList((String) null); for (String dir : dirs) { var name = (dir != null ? dir + " - " : "") + model.getName(); model.openTerminalAsync(name, dir, model.getFileSystem().getShell().orElseThrow(), dirs.size() == 1);