diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserOverviewComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserOverviewComp.java index d6165f71..12201e17 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserOverviewComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserOverviewComp.java @@ -63,9 +63,7 @@ public class BrowserOverviewComp extends SimpleComp { var commonPane = new SimpleTitledPaneComp(AppI18n.observable("common"), commonOverview) .apply(struc -> VBox.setVgrow(struc.get(), Priority.NEVER)); - var roots = model.getFileSystem() - .listRoots() - .stream() + var roots = model.getFileSystem().listRoots().stream() .map(s -> FileEntry.ofDirectory(model.getFileSystem(), s)) .toList(); var rootsOverview = new BrowserFileOverviewComp(model, FXCollections.observableArrayList(roots), false); diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserEntry.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserEntry.java index c386c576..616693aa 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserEntry.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserEntry.java @@ -5,6 +5,7 @@ import io.xpipe.app.browser.icon.BrowserIconFileType; import io.xpipe.core.store.FileEntry; import io.xpipe.core.store.FileKind; import io.xpipe.core.store.FileNames; + import lombok.Getter; @Getter diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java index 21a49155..3d1a694c 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListComp.java @@ -1,7 +1,5 @@ package io.xpipe.app.browser.file; -import atlantafx.base.controls.Spacer; -import atlantafx.base.theme.Styles; import io.xpipe.app.browser.action.BrowserAction; import io.xpipe.app.comp.base.LazyTextFieldComp; import io.xpipe.app.core.AppI18n; @@ -14,6 +12,7 @@ import io.xpipe.core.store.FileEntry; import io.xpipe.core.store.FileInfo; import io.xpipe.core.store.FileKind; import io.xpipe.core.store.FileNames; + import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.property.*; @@ -34,6 +33,9 @@ import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.scene.layout.Region; +import atlantafx.base.controls.Spacer; +import atlantafx.base.theme.Styles; + import java.time.Duration; import java.time.Instant; import java.time.ZoneId; @@ -104,7 +106,9 @@ public final class BrowserFileListComp extends SimpleComp { var modeCol = new TableColumn(); modeCol.textProperty().bind(AppI18n.observable("attributes")); modeCol.setCellValueFactory(param -> new SimpleObjectProperty<>( - param.getValue().getRawFileEntry().resolved().getInfo() instanceof FileInfo.Unix u ? u.getPermissions() : null)); + param.getValue().getRawFileEntry().resolved().getInfo() instanceof FileInfo.Unix u + ? u.getPermissions() + : null)); modeCol.setCellFactory(col -> new FileModeCell()); modeCol.setResizable(false); modeCol.setPrefWidth(120); @@ -134,7 +138,11 @@ public final class BrowserFileListComp extends SimpleComp { return true; }); table.setFixedCellSize(32.0); - var os = fileList.getFileSystemModel().getFileSystem().getShell().orElseThrow().getOsType(); + var os = fileList.getFileSystemModel() + .getFileSystem() + .getShell() + .orElseThrow() + .getOsType(); table.widthProperty().subscribe((newValue) -> { if (os != OsType.WINDOWS && os != OsType.MACOS) { ownerCol.setVisible(newValue.doubleValue() > 1000); @@ -143,12 +151,15 @@ public final class BrowserFileListComp extends SimpleComp { filenameCol.setPrefWidth(width); }); - table.lookupAll(".scroll-bar").stream().filter(node -> node.getPseudoClassStates().contains(PseudoClass.getPseudoClass("horizontal"))).findFirst().ifPresent(node -> { - Region region = (Region) node; - region.setMinHeight(0); - region.setPrefHeight(0); - region.setMaxHeight(0); - }); + table.lookupAll(".scroll-bar").stream() + .filter(node -> node.getPseudoClassStates().contains(PseudoClass.getPseudoClass("horizontal"))) + .findFirst() + .ifPresent(node -> { + Region region = (Region) node; + region.setMinHeight(0); + region.setPrefHeight(0); + region.setMaxHeight(0); + }); prepareTableSelectionModel(table); prepareTableShortcuts(table); @@ -160,9 +171,12 @@ public final class BrowserFileListComp extends SimpleComp { } private double getFilenameWidth(TableView tableView) { - var sum = tableView.getColumns().stream().filter(tableColumn -> tableColumn.isVisible() && - tableView.getColumns().indexOf(tableColumn) != 0) - .mapToDouble(value -> value.getPrefWidth()).sum() + 7; + var sum = tableView.getColumns().stream() + .filter(tableColumn -> tableColumn.isVisible() + && tableView.getColumns().indexOf(tableColumn) != 0) + .mapToDouble(value -> value.getPrefWidth()) + .sum() + + 7; return tableView.getWidth() - sum; } @@ -173,10 +187,18 @@ public final class BrowserFileListComp extends SimpleComp { } var m = fileList.getFileSystemModel(); - var user = unix.getUser() != null ? unix.getUser() : m.getCache().getUsers().get(unix.getUid()); - var group = unix.getGroup() != null ? unix.getGroup() : m.getCache().getGroups().get(unix.getGid()); - var uid = String.valueOf(unix.getUid() != null ? unix.getUid() : m.getCache().getUidForUser(user)).replaceAll("000$", "k"); - var gid = String.valueOf(unix.getGid() != null ? unix.getGid() : m.getCache().getGidForGroup(group)).replaceAll("000$", "k"); + var user = unix.getUser() != null + ? unix.getUser() + : m.getCache().getUsers().get(unix.getUid()); + var group = unix.getGroup() != null + ? unix.getGroup() + : m.getCache().getGroups().get(unix.getGid()); + var uid = String.valueOf( + unix.getUid() != null ? unix.getUid() : m.getCache().getUidForUser(user)) + .replaceAll("000$", "k"); + var gid = String.valueOf( + unix.getGid() != null ? unix.getGid() : m.getCache().getGidForGroup(group)) + .replaceAll("000$", "k"); if (uid.equals(gid)) { return user + " [" + uid + "]"; } @@ -428,19 +450,27 @@ public final class BrowserFileListComp extends SimpleComp { var newItems = new ArrayList<>(fileList.getShown().getValue()); table.getItems().clear(); - var hasModifiedDate = newItems.size() == 0 || newItems.stream().anyMatch(entry -> entry.getRawFileEntry().getDate() != null); + var hasModifiedDate = newItems.size() == 0 + || newItems.stream() + .anyMatch(entry -> entry.getRawFileEntry().getDate() != null); if (!hasModifiedDate) { mtimeCol.setVisible(false); } else { mtimeCol.setVisible(true); } - ownerWidth.set(fileList.getAll().getValue().stream().map(browserEntry -> formatOwner(browserEntry)).map( - s -> s != null ? s.length() * 9 : 0).max(Comparator.naturalOrder()).orElse(150)); + ownerWidth.set(fileList.getAll().getValue().stream() + .map(browserEntry -> formatOwner(browserEntry)) + .map(s -> s != null ? s.length() * 9 : 0) + .max(Comparator.naturalOrder()) + .orElse(150)); ownerCol.setPrefWidth(ownerWidth.get()); if (fileList.getFileSystemModel().getFileSystem() != null) { - var shell = fileList.getFileSystemModel().getFileSystem().getShell().orElseThrow(); + var shell = fileList.getFileSystemModel() + .getFileSystem() + .getShell() + .orElseThrow(); if (OsType.WINDOWS.equals(shell.getOsType()) || OsType.MACOS.equals(shell.getOsType())) { modeCol.setVisible(false); ownerCol.setVisible(false); @@ -601,18 +631,14 @@ public final class BrowserFileListComp extends SimpleComp { var quickAccess = new BrowserQuickAccessButtonComp( () -> getTableRow().getItem(), fileList.getFileSystemModel()) .hide(Bindings.createBooleanBinding( - () -> { - var item = getTableRow().getItem(); - var notDir = item.getRawFileEntry() - .resolved() - .getKind() - != FileKind.DIRECTORY; - var isParentLink = item.getRawFileEntry() - .equals(fileList.getFileSystemModel() - .getCurrentParentDirectory()); - return notDir || isParentLink; - }, - itemProperty())) + () -> { + var item = getTableRow().getItem(); + var notDir = item.getRawFileEntry().resolved().getKind() != FileKind.DIRECTORY; + var isParentLink = item.getRawFileEntry() + .equals(fileList.getFileSystemModel().getCurrentParentDirectory()); + return notDir || isParentLink; + }, + itemProperty())) .focusTraversable(false) .createRegion(); @@ -719,7 +745,9 @@ public final class BrowserFileListComp extends SimpleComp { .getPath() : getTableRow().getItem().getFileName(); var fileName = normalName; - var hidden = getTableRow().getItem().getRawFileEntry().getInfo().explicitlyHidden() || fileName.startsWith("."); + var hidden = + getTableRow().getItem().getRawFileEntry().getInfo().explicitlyHidden() + || fileName.startsWith("."); getTableRow().pseudoClassStateChanged(HIDDEN, hidden); text.set(fileName); // Visibility seems to be bugged, so use opacity diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListModel.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListModel.java index e679a24f..ea1a023f 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListModel.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileListModel.java @@ -99,7 +99,8 @@ public final class BrowserFileListModel { } public BrowserEntry rename(BrowserEntry old, String newName) { - if (old == null || newName == null + if (old == null + || newName == null || fileSystemModel == null || fileSystemModel.isClosed() || fileSystemModel.getCurrentPath().get() == null) { diff --git a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileTransferOperation.java b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileTransferOperation.java index 357c6977..65af868a 100644 --- a/app/src/main/java/io/xpipe/app/browser/file/BrowserFileTransferOperation.java +++ b/app/src/main/java/io/xpipe/app/browser/file/BrowserFileTransferOperation.java @@ -222,11 +222,7 @@ public class BrowserFileTransferOperation { } private void transfer( - FileEntry sourceFile, - String targetFile, - AtomicLong transferred, - AtomicLong totalSize, - Instant start) + FileEntry sourceFile, String targetFile, AtomicLong transferred, AtomicLong totalSize, Instant start) throws Exception { InputStream inputStream = null; OutputStream outputStream = null; diff --git a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemCache.java b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemCache.java index 6d8a4c78..66ac5a46 100644 --- a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemCache.java +++ b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemCache.java @@ -5,6 +5,7 @@ import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.OsType; import io.xpipe.core.process.ShellControl; import io.xpipe.core.process.ShellDialect; + import lombok.Getter; import java.util.LinkedHashMap; @@ -31,11 +32,19 @@ public class OpenFileSystemCache extends ShellControlCache { } public int getUidForUser(String name) { - return users.entrySet().stream().filter(e -> e.getValue().equals(name)).findFirst().map(e -> e.getKey()).orElse(0); + return users.entrySet().stream() + .filter(e -> e.getValue().equals(name)) + .findFirst() + .map(e -> e.getKey()) + .orElse(0); } public int getGidForGroup(String name) { - return groups.entrySet().stream().filter(e -> e.getValue().equals(name)).findFirst().map(e -> e.getKey()).orElse(0); + return groups.entrySet().stream() + .filter(e -> e.getValue().equals(name)) + .findFirst() + .map(e -> e.getKey()) + .orElse(0); } private void loadUsers() throws Exception { @@ -44,7 +53,9 @@ public class OpenFileSystemCache extends ShellControlCache { return; } - var lines = sc.command(CommandBuilder.of().add("cat").addFile("/etc/passwd")).readStdoutIfPossible().orElse(""); + var lines = sc.command(CommandBuilder.of().add("cat").addFile("/etc/passwd")) + .readStdoutIfPossible() + .orElse(""); lines.lines().forEach(s -> { var split = s.split(":"); users.putIfAbsent(Integer.parseInt(split[2]), split[0]); @@ -61,7 +72,9 @@ public class OpenFileSystemCache extends ShellControlCache { return; } - var lines = sc.command(CommandBuilder.of().add("cat").addFile("/etc/group")).readStdoutIfPossible().orElse(""); + var lines = sc.command(CommandBuilder.of().add("cat").addFile("/etc/group")) + .readStdoutIfPossible() + .orElse(""); lines.lines().forEach(s -> { var split = s.split(":"); groups.putIfAbsent(Integer.parseInt(split[2]), split[0]); diff --git a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java index c425c115..6c814929 100644 --- a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java +++ b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java @@ -305,8 +305,7 @@ public final class OpenFileSystemModel extends BrowserSessionTab, Exception> consumer) - throws Exception { + public void withFiles(String dir, FailableConsumer, Exception> consumer) throws Exception { BooleanScope.executeExclusive(busy, () -> { if (dir != null) { startIfNeeded(); @@ -357,8 +356,7 @@ public final class OpenFileSystemModel extends BrowserSessionTab files, BrowserFileTransferMode mode) { + public void dropFilesIntoAsync(FileEntry target, List files, BrowserFileTransferMode mode) { // We don't have to do anything in this case if (files.isEmpty()) { return; diff --git a/app/src/main/java/io/xpipe/app/browser/icon/BrowserIconDirectoryType.java b/app/src/main/java/io/xpipe/app/browser/icon/BrowserIconDirectoryType.java index a3b28796..f5ff68c9 100644 --- a/app/src/main/java/io/xpipe/app/browser/icon/BrowserIconDirectoryType.java +++ b/app/src/main/java/io/xpipe/app/browser/icon/BrowserIconDirectoryType.java @@ -3,8 +3,8 @@ package io.xpipe.app.browser.icon; import io.xpipe.app.core.AppResources; import io.xpipe.core.store.FileEntry; import io.xpipe.core.store.FileKind; - import io.xpipe.core.store.FileNames; + import lombok.Getter; import java.io.BufferedReader; diff --git a/app/src/main/java/io/xpipe/app/browser/icon/BrowserIconFileType.java b/app/src/main/java/io/xpipe/app/browser/icon/BrowserIconFileType.java index 9ec05337..d955481f 100644 --- a/app/src/main/java/io/xpipe/app/browser/icon/BrowserIconFileType.java +++ b/app/src/main/java/io/xpipe/app/browser/icon/BrowserIconFileType.java @@ -3,8 +3,8 @@ package io.xpipe.app.browser.icon; import io.xpipe.app.core.AppResources; import io.xpipe.core.store.FileEntry; import io.xpipe.core.store.FileKind; - import io.xpipe.core.store.FileNames; + import lombok.Getter; import java.io.BufferedReader; @@ -86,9 +86,7 @@ public abstract class BrowserIconFileType { var name = FileNames.getFileName(entry.getPath()); var ext = FileNames.getExtension(entry.getPath()); - return (ext != null - && endings.contains("." + ext.toLowerCase(Locale.ROOT))) - || endings.contains(name); + return (ext != null && endings.contains("." + ext.toLowerCase(Locale.ROOT))) || endings.contains(name); } @Override diff --git a/app/src/main/java/io/xpipe/app/browser/session/BrowserSessionTabsComp.java b/app/src/main/java/io/xpipe/app/browser/session/BrowserSessionTabsComp.java index 0de95084..9a133127 100644 --- a/app/src/main/java/io/xpipe/app/browser/session/BrowserSessionTabsComp.java +++ b/app/src/main/java/io/xpipe/app/browser/session/BrowserSessionTabsComp.java @@ -364,7 +364,8 @@ public class BrowserSessionTabsComp extends SimpleComp { StackPane c = (StackPane) tabs.lookup("#" + id + " .tab-container"); c.getStyleClass().add("color-box"); - var color = DataStorage.get().getEffectiveColor(model.getEntry().get()); + var color = + DataStorage.get().getEffectiveColor(model.getEntry().get()); if (color != null) { c.getStyleClass().add(color.getId()); } diff --git a/app/src/main/java/io/xpipe/app/comp/base/MultiContentComp.java b/app/src/main/java/io/xpipe/app/comp/base/MultiContentComp.java index 89e388ac..1ae59c2c 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/MultiContentComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/MultiContentComp.java @@ -47,25 +47,25 @@ public class MultiContentComp extends SimpleComp { return stack; } -// Lazy impl -// @Override -// protected Region createSimple() { -// var stack = new StackPane(); -// for (Map.Entry, ObservableValue> e : content.entrySet()) { -// var r = e.getKey().createRegion(); -// e.getValue().subscribe(val -> { -// PlatformThread.runLaterIfNeeded(() -> { -// r.setManaged(val); -// r.setVisible(val); -// if (val && !stack.getChildren().contains(r)) { -// stack.getChildren().add(r); -// } else { -// stack.getChildren().remove(r); -// } -// }); -// }); -// } -// -// return stack; -// } + // Lazy impl + // @Override + // protected Region createSimple() { + // var stack = new StackPane(); + // for (Map.Entry, ObservableValue> e : content.entrySet()) { + // var r = e.getKey().createRegion(); + // e.getValue().subscribe(val -> { + // PlatformThread.runLaterIfNeeded(() -> { + // r.setManaged(val); + // r.setVisible(val); + // if (val && !stack.getChildren().contains(r)) { + // stack.getChildren().add(r); + // } else { + // stack.getChildren().remove(r); + // } + // }); + // }); + // } + // + // return stack; + // } } diff --git a/app/src/main/java/io/xpipe/app/comp/base/SideMenuBarComp.java b/app/src/main/java/io/xpipe/app/comp/base/SideMenuBarComp.java index ab5c1cf9..73811eb8 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/SideMenuBarComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/SideMenuBarComp.java @@ -83,21 +83,30 @@ public class SideMenuBarComp extends Comp> { b.accessibleText(e.name()); var indicator = Comp.empty().styleClass("indicator"); - var stack = new StackComp(List.of(indicator, b)).apply(struc -> struc.get().setAlignment(Pos.CENTER_RIGHT)); + var stack = new StackComp(List.of(indicator, b)) + .apply(struc -> struc.get().setAlignment(Pos.CENTER_RIGHT)); stack.apply(struc -> { var indicatorRegion = (Region) struc.get().getChildren().getFirst(); indicatorRegion.setMaxWidth(7); - indicatorRegion.backgroundProperty().bind(Bindings.createObjectBinding(() -> { - if (value.getValue().equals(e)) { - return selectedBorder.get(); - } + indicatorRegion + .backgroundProperty() + .bind(Bindings.createObjectBinding( + () -> { + if (value.getValue().equals(e)) { + return selectedBorder.get(); + } - if (struc.get().isHover()) { - return hoverBorder.get(); - } + if (struc.get().isHover()) { + return hoverBorder.get(); + } - return noneBorder.get(); - }, struc.get().hoverProperty(), value, hoverBorder, selectedBorder, noneBorder)); + return noneBorder.get(); + }, + struc.get().hoverProperty(), + value, + hoverBorder, + selectedBorder, + noneBorder)); }); if (shortcut != null) { stack.apply(struc -> struc.get().getProperties().put("shortcut", shortcut)); diff --git a/app/src/main/java/io/xpipe/app/comp/base/StoreToggleComp.java b/app/src/main/java/io/xpipe/app/comp/base/StoreToggleComp.java index 87f415f0..98d644c0 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/StoreToggleComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/StoreToggleComp.java @@ -58,14 +58,9 @@ public class StoreToggleComp extends SimpleComp { ObservableValue g = val.map(aBoolean -> aBoolean ? new LabelGraphic.IconGraphic("mdi2c-circle-slice-8") : new LabelGraphic.IconGraphic("mdi2p-power")); - var t = new StoreToggleComp( - nameKey, - g, - section, - value, - v -> { - setter.accept(section.getWrapper().getEntry().getStore().asNeeded(), v); - }); + var t = new StoreToggleComp(nameKey, g, section, value, v -> { + setter.accept(section.getWrapper().getEntry().getStore().asNeeded(), v); + }); t.tooltipKey("enabled"); t.value.subscribe((newValue) -> { val.set(newValue); diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreCategoryWrapper.java b/app/src/main/java/io/xpipe/app/comp/store/StoreCategoryWrapper.java index 33441988..621c0a29 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreCategoryWrapper.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreCategoryWrapper.java @@ -3,10 +3,10 @@ package io.xpipe.app.comp.store; import io.xpipe.app.core.AppI18n; import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.prefs.AppPrefs; +import io.xpipe.app.storage.DataColor; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreCategory; -import io.xpipe.app.storage.DataColor; import javafx.beans.property.*; import javafx.collections.FXCollections; import javafx.collections.ObservableList; diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryComp.java b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryComp.java index 99ce1ce4..c0811869 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryComp.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryComp.java @@ -16,8 +16,8 @@ import io.xpipe.app.fxcomps.util.BindingsHelper; import io.xpipe.app.fxcomps.util.DerivedObservableList; import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.prefs.AppPrefs; -import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataColor; +import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.update.XPipeDistributionType; import io.xpipe.app.util.*; diff --git a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java index 5ccca858..adb9cce0 100644 --- a/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java +++ b/app/src/main/java/io/xpipe/app/comp/store/StoreEntryWrapper.java @@ -4,9 +4,9 @@ import io.xpipe.app.ext.ActionProvider; import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.prefs.AppPrefs; +import io.xpipe.app.storage.DataColor; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreCategory; -import io.xpipe.app.storage.DataColor; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.util.ThreadHelper; diff --git a/app/src/main/java/io/xpipe/app/core/AppDesktopIntegration.java b/app/src/main/java/io/xpipe/app/core/AppDesktopIntegration.java index a1a88e74..276af8ab 100644 --- a/app/src/main/java/io/xpipe/app/core/AppDesktopIntegration.java +++ b/app/src/main/java/io/xpipe/app/core/AppDesktopIntegration.java @@ -9,10 +9,10 @@ import io.xpipe.app.util.PlatformState; import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.process.OsType; -import javax.imageio.ImageIO; import java.awt.*; import java.awt.desktop.*; import java.util.List; +import javax.imageio.ImageIO; public class AppDesktopIntegration { diff --git a/app/src/main/java/io/xpipe/app/core/AppImages.java b/app/src/main/java/io/xpipe/app/core/AppImages.java index 344374c1..f0101fad 100644 --- a/app/src/main/java/io/xpipe/app/core/AppImages.java +++ b/app/src/main/java/io/xpipe/app/core/AppImages.java @@ -2,8 +2,10 @@ package io.xpipe.app.core; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.TrackEvent; + import javafx.scene.image.Image; import javafx.scene.image.WritableImage; + import org.apache.commons.io.FilenameUtils; import java.awt.image.BufferedImage; diff --git a/app/src/main/java/io/xpipe/app/ext/EnabledParentStoreProvider.java b/app/src/main/java/io/xpipe/app/ext/EnabledParentStoreProvider.java index 609569a7..6baf88ac 100644 --- a/app/src/main/java/io/xpipe/app/ext/EnabledParentStoreProvider.java +++ b/app/src/main/java/io/xpipe/app/ext/EnabledParentStoreProvider.java @@ -10,6 +10,7 @@ import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.util.ThreadHelper; import io.xpipe.core.store.EnabledStoreState; import io.xpipe.core.store.StatefulDataStore; + import javafx.beans.property.SimpleBooleanProperty; public interface EnabledParentStoreProvider extends DataStoreProvider { @@ -32,11 +33,14 @@ public interface EnabledParentStoreProvider extends DataStoreProvider { var state = s.getState().toBuilder().enabled(aBoolean).build(); s.setState(state); - var children = DataStorage.get().getStoreChildren(sec.getWrapper().getEntry()); + var children = + DataStorage.get().getStoreChildren(sec.getWrapper().getEntry()); ThreadHelper.runFailableAsync(() -> { for (DataStoreEntry child : children) { if (child.getStorePersistentState() instanceof EnabledStoreState enabledStoreState) { - child.setStorePersistentState(enabledStoreState.toBuilder().enabled(aBoolean).build()); + child.setStorePersistentState(enabledStoreState.toBuilder() + .enabled(aBoolean) + .build()); } } }); diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/StoreCategoryComp.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/StoreCategoryComp.java index c2ebf7a2..9480e216 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/StoreCategoryComp.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/StoreCategoryComp.java @@ -17,6 +17,7 @@ import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreCategory; import io.xpipe.app.util.ContextMenuHelper; import io.xpipe.app.util.DataStoreFormatter; + import javafx.beans.binding.Bindings; import javafx.beans.property.SimpleBooleanProperty; import javafx.css.PseudoClass; @@ -31,6 +32,7 @@ import javafx.scene.input.KeyCodeCombination; import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseButton; import javafx.scene.layout.Region; + import lombok.EqualsAndHashCode; import lombok.Value; import org.kordamp.ikonli.javafx.FontIcon; @@ -57,13 +59,15 @@ public class StoreCategoryComp extends SimpleComp { var expandIcon = Bindings.createStringBinding( () -> { - var exp = category.getExpanded().get() && category.getChildren().size() > 0; + var exp = category.getExpanded().get() + && category.getChildren().size() > 0; return exp ? "mdal-keyboard_arrow_down" : "mdal-keyboard_arrow_right"; }, - category.getExpanded(), category.getChildren()); + category.getExpanded(), + category.getChildren()); var expandButton = new IconButtonComp(expandIcon, () -> { - category.toggleExpanded(); - }) + category.toggleExpanded(); + }) .apply(struc -> AppFont.medium(struc.get())) .apply(struc -> { struc.get().setAlignment(Pos.CENTER); @@ -87,7 +91,8 @@ public class StoreCategoryComp extends SimpleComp { return category.getShare().getValue() ? "mdi2g-git" : "mdi2a-account-cancel"; }, - category.getShare(), hover); + category.getShare(), + hover); var statusButton = new IconButtonComp(statusIcon) .apply(struc -> AppFont.small(struc.get())) .apply(struc -> { @@ -98,10 +103,10 @@ public class StoreCategoryComp extends SimpleComp { }) .apply(new ContextMenuAugment<>( mouseEvent -> mouseEvent.getButton() == MouseButton.PRIMARY, null, () -> { - var cm = createContextMenu(name); - showing.bind(cm.showingProperty()); - return cm; - })) + var cm = createContextMenu(name); + showing.bind(cm.showingProperty()); + return cm; + })) .styleClass("status-button"); var shownList = new DerivedObservableList<>(category.getContainedEntries(), true) @@ -114,7 +119,8 @@ public class StoreCategoryComp extends SimpleComp { .getList(); var count = new CountComp<>(shownList, category.getContainedEntries(), string -> "(" + string + ")"); - var showStatus = hover.or(new SimpleBooleanProperty(DataStorage.get().supportsSharing())).or(showing); + var showStatus = hover.or(new SimpleBooleanProperty(DataStorage.get().supportsSharing())) + .or(showing); var focus = new SimpleBooleanProperty(); var h = new HorizontalComp(List.of( expandButton, @@ -153,9 +159,13 @@ public class StoreCategoryComp extends SimpleComp { new ListBoxViewComp<>(l, l, storeCategoryWrapper -> new StoreCategoryComp(storeCategoryWrapper), false); children.styleClass("children"); - var hide = Bindings.createBooleanBinding(() -> { - return !category.getExpanded().get() || category.getChildren().isEmpty(); - }, category.getChildren(), category.getExpanded()); + var hide = Bindings.createBooleanBinding( + () -> { + return !category.getExpanded().get() + || category.getChildren().isEmpty(); + }, + category.getChildren(), + category.getExpanded()); var v = new VerticalComp(List.of(categoryButton, children.hide(hide))); v.styleClass("category"); v.apply(struc -> { diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/TooltipAugment.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/TooltipAugment.java index cc1bbc47..e7c7aeab 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/TooltipAugment.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/TooltipAugment.java @@ -4,6 +4,7 @@ import io.xpipe.app.core.AppI18n; import io.xpipe.app.fxcomps.CompStructure; import io.xpipe.app.fxcomps.augment.Augment; import io.xpipe.app.fxcomps.util.PlatformThread; + import javafx.beans.binding.Bindings; import javafx.beans.value.ObservableValue; import javafx.scene.control.Tooltip; diff --git a/app/src/main/java/io/xpipe/app/fxcomps/util/LabelGraphic.java b/app/src/main/java/io/xpipe/app/fxcomps/util/LabelGraphic.java index 67c9df2f..12624da8 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/util/LabelGraphic.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/util/LabelGraphic.java @@ -46,7 +46,9 @@ public abstract class LabelGraphic { @Override public Node createGraphicNode() { - return PrettyImageHelper.ofFixedSizeSquare(file, size).styleClass("graphic").createRegion(); + return PrettyImageHelper.ofFixedSizeSquare(file, size) + .styleClass("graphic") + .createRegion(); } } diff --git a/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java b/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java index f8ed8d1e..4ce84dad 100644 --- a/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java +++ b/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java @@ -1,8 +1,5 @@ package io.xpipe.app.issue; -import io.sentry.*; -import io.sentry.protocol.SentryId; -import io.sentry.protocol.User; import io.xpipe.app.core.AppLogs; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppState; @@ -10,6 +7,10 @@ import io.xpipe.app.core.mode.OperationMode; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.update.XPipeDistributionType; import io.xpipe.app.util.LicenseProvider; + +import io.sentry.*; +import io.sentry.protocol.SentryId; +import io.sentry.protocol.User; import org.apache.commons.io.FileUtils; import java.io.ByteArrayInputStream; @@ -163,7 +164,9 @@ public class SentryErrorHandler implements ErrorHandler { s.setTag("licenseRequired", Boolean.toString(ee.isLicenseRequired())); var exMessage = ee.getThrowable() != null ? ee.getThrowable().getMessage() : null; - if (ee.getDescription() != null && !ee.getDescription().equals(exMessage) && (ee.isShouldSendDiagnostics() || ee.isLicenseRequired())) { + if (ee.getDescription() != null + && !ee.getDescription().equals(exMessage) + && (ee.isShouldSendDiagnostics() || ee.isLicenseRequired())) { s.setTag("message", ee.getDescription().lines().collect(Collectors.joining(" "))); } diff --git a/app/src/main/java/io/xpipe/app/prefs/WorkspacesCategory.java b/app/src/main/java/io/xpipe/app/prefs/WorkspacesCategory.java index 53639c14..ebc00a2a 100644 --- a/app/src/main/java/io/xpipe/app/prefs/WorkspacesCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/WorkspacesCategory.java @@ -16,11 +16,17 @@ public class WorkspacesCategory extends AppPrefsCategory { @Override protected Comp create() { return new OptionsBuilder() - .addTitle(AppI18n.observable("manageWorkspaces").map(s -> s + (LicenseProvider.get().getFeature("workspaces").isSupported() ? "" : " (Pro)"))) + .addTitle(AppI18n.observable("manageWorkspaces") + .map(s -> s + + (LicenseProvider.get() + .getFeature("workspaces") + .isSupported() + ? "" + : " (Pro)"))) .sub(new OptionsBuilder() .nameAndDescription("workspaceAdd") .addComp(new ButtonComp(AppI18n.observable("addWorkspace"), WorkspaceCreationAlert::showAsync))) - .disable(!LicenseProvider.get().getFeature("workspaces").isSupported()) + .disable(!LicenseProvider.get().getFeature("workspaces").isSupported()) .buildComp(); } } diff --git a/app/src/main/java/io/xpipe/app/storage/DataColor.java b/app/src/main/java/io/xpipe/app/storage/DataColor.java index e629d09e..3f38e58e 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataColor.java +++ b/app/src/main/java/io/xpipe/app/storage/DataColor.java @@ -1,8 +1,9 @@ package io.xpipe.app.storage; -import com.fasterxml.jackson.annotation.JsonProperty; import javafx.scene.Node; import javafx.scene.paint.Color; + +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import java.util.ArrayList; @@ -45,8 +46,7 @@ public enum DataColor { public static void applyStyleClasses(DataColor color, Node node) { var newList = new ArrayList<>(node.getStyleClass()); newList.removeIf(s -> Arrays.stream(DataColor.values()) - .anyMatch( - dataStoreColor -> dataStoreColor.getId().equals(s))); + .anyMatch(dataStoreColor -> dataStoreColor.getId().equals(s))); newList.remove("gray"); if (color != null) { newList.add(color.getId()); diff --git a/app/src/main/java/io/xpipe/app/storage/DataStorage.java b/app/src/main/java/io/xpipe/app/storage/DataStorage.java index e16403f4..affdefac 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorage.java @@ -700,7 +700,8 @@ public abstract class DataStorage { return root.getColor(); } - var cats = getCategoryParentHierarchy(getStoreCategoryIfPresent(entry.getCategoryUuid()).orElseThrow()); + var cats = getCategoryParentHierarchy( + getStoreCategoryIfPresent(entry.getCategoryUuid()).orElseThrow()); for (DataStoreCategory cat : cats.reversed()) { if (cat.getColor() != null) { return cat.getColor(); diff --git a/app/src/main/java/io/xpipe/app/storage/DataStoreCategory.java b/app/src/main/java/io/xpipe/app/storage/DataStoreCategory.java index 0a85c504..610b183e 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStoreCategory.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStoreCategory.java @@ -1,9 +1,9 @@ package io.xpipe.app.storage; -import com.fasterxml.jackson.core.JsonProcessingException; import io.xpipe.app.comp.store.StoreSortMode; import io.xpipe.core.util.JacksonMapper; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.JsonNodeFactory; @@ -128,8 +128,8 @@ public class DataStoreCategory extends StorageElement { .map(jsonNode -> jsonNode.booleanValue()) .orElse(true); - return Optional.of( - new DataStoreCategory(dir, uuid, name, lastUsed, lastModified, color, false, parentUuid, sortMode, share, expanded)); + return Optional.of(new DataStoreCategory( + dir, uuid, name, lastUsed, lastModified, color, false, parentUuid, sortMode, share, expanded)); } public void setSortMode(StoreSortMode sortMode) { diff --git a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java index 1e6dfbbc..d230267d 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java @@ -107,7 +107,7 @@ public class DataStoreEntry extends StorageElement { Instant lastModified, DataStore store, Order explicitOrder) { - super(directory, uuid, name, lastUsed, lastModified, null, false,false); + super(directory, uuid, name, lastUsed, lastModified, null, false, false); this.categoryUuid = categoryUuid; this.store = store; this.explicitOrder = explicitOrder; @@ -228,13 +228,15 @@ public class DataStoreEntry extends StorageElement { .orElse(true); if (color == null) { - color = Optional.ofNullable(stateJson.get("color")).map(node -> { - try { - return mapper.treeToValue(node, DataColor.class); - } catch (JsonProcessingException e) { - return null; - } - }).orElse(null); + color = Optional.ofNullable(stateJson.get("color")) + .map(node -> { + try { + return mapper.treeToValue(node, DataColor.class); + } catch (JsonProcessingException e) { + return null; + } + }) + .orElse(null); } String notes = null; diff --git a/app/src/main/java/io/xpipe/app/storage/StorageElement.java b/app/src/main/java/io/xpipe/app/storage/StorageElement.java index 641341b3..d1a795e0 100644 --- a/app/src/main/java/io/xpipe/app/storage/StorageElement.java +++ b/app/src/main/java/io/xpipe/app/storage/StorageElement.java @@ -43,12 +43,17 @@ public abstract class StorageElement { @Getter protected boolean expanded; - protected @NonFinal - @Getter DataColor color; - + protected @NonFinal @Getter DataColor color; public StorageElement( - Path directory, UUID uuid, String name, Instant lastUsed, Instant lastModified, DataColor color, boolean expanded, boolean dirty) { + Path directory, + UUID uuid, + String name, + Instant lastUsed, + Instant lastModified, + DataColor color, + boolean expanded, + boolean dirty) { this.directory = directory; this.uuid = uuid; this.name = name; 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 98b1737c..1efb7c96 100644 --- a/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/ExternalTerminalType.java @@ -13,8 +13,8 @@ import io.xpipe.app.util.*; import io.xpipe.core.process.*; import io.xpipe.core.store.FilePath; import io.xpipe.core.util.FailableFunction; - import io.xpipe.core.util.XPipeInstallation; + import javafx.scene.control.Alert; import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonType; @@ -240,12 +240,17 @@ public interface ExternalTerminalType extends PrefsChoiceValue { @Override protected void execute(Path file, LaunchConfiguration configuration) throws Exception { try (var sc = LocalShell.getShell()) { - // Since mobaxterm uses its own cygwin environment, we have to provide the beacon auth secret to the tmp there as well + // Since mobaxterm uses its own cygwin environment, we have to provide the beacon auth secret to the tmp + // there as well // Otherwise it can't connect var slashTemp = Path.of(System.getenv("APPDATA"), "MobaXterm", "slash", "tmp"); if (Files.exists(slashTemp)) { - var authFileName = XPipeInstallation.getLocalBeaconAuthFile().getFileName().toString(); - Files.writeString(Path.of(slashTemp.toString(), authFileName),AppBeaconServer.get().getLocalAuthSecret()); + var authFileName = XPipeInstallation.getLocalBeaconAuthFile() + .getFileName() + .toString(); + Files.writeString( + Path.of(slashTemp.toString(), authFileName), + AppBeaconServer.get().getLocalAuthSecret()); } var fixedFile = configuration diff --git a/app/src/main/java/io/xpipe/app/util/DesktopShortcuts.java b/app/src/main/java/io/xpipe/app/util/DesktopShortcuts.java index ce06f586..a1cbcb3e 100644 --- a/app/src/main/java/io/xpipe/app/util/DesktopShortcuts.java +++ b/app/src/main/java/io/xpipe/app/util/DesktopShortcuts.java @@ -12,7 +12,7 @@ public class DesktopShortcuts { var icon = XPipeInstallation.getLocalDefaultInstallationIcon(); var shortcutPath = DesktopHelper.getDesktopDirectory().resolve(name + ".lnk"); var content = String.format( - """ + """ $TARGET="%s" $SHORTCUT="%s" $ws = New-Object -ComObject WScript.Shell @@ -23,7 +23,8 @@ public class DesktopShortcuts { $S.Arguments = '%s' $S.Save() """, - executable, shortcutPath, icon, args).replaceAll("\n", ";"); + executable, shortcutPath, icon, args) + .replaceAll("\n", ";"); LocalShell.getLocalPowershell().executeSimpleCommand(content); return shortcutPath; } diff --git a/core/src/main/java/io/xpipe/core/store/FileEntry.java b/core/src/main/java/io/xpipe/core/store/FileEntry.java index 33c563f6..8f35644e 100644 --- a/core/src/main/java/io/xpipe/core/store/FileEntry.java +++ b/core/src/main/java/io/xpipe/core/store/FileEntry.java @@ -25,18 +25,23 @@ public class FileEntry { String path; public FileEntry( - FileSystem fileSystem, @NonNull String path, Instant date, long size, FileInfo info, @NonNull FileKind kind - ) { + FileSystem fileSystem, + @NonNull String path, + Instant date, + long size, + FileInfo info, + @NonNull FileKind kind) { this.fileSystem = fileSystem; this.kind = kind; - this.path = kind == FileKind.DIRECTORY ? new FilePath(path).toDirectory().toString() : path; + this.path = + kind == FileKind.DIRECTORY ? new FilePath(path).toDirectory().toString() : path; this.date = date; this.info = info; this.size = size; } public static FileEntry ofDirectory(FileSystem fileSystem, String path) { - return new FileEntry(fileSystem, path, Instant.now(), 0, null, FileKind.DIRECTORY); + return new FileEntry(fileSystem, path, Instant.now(), 0, null, FileKind.DIRECTORY); } public FileEntry resolved() { diff --git a/core/src/main/java/io/xpipe/core/store/FileSystem.java b/core/src/main/java/io/xpipe/core/store/FileSystem.java index 1f27b744..ff03d074 100644 --- a/core/src/main/java/io/xpipe/core/store/FileSystem.java +++ b/core/src/main/java/io/xpipe/core/store/FileSystem.java @@ -66,5 +66,4 @@ public interface FileSystem extends Closeable, AutoCloseable { } List listRoots() throws Exception; - } diff --git a/core/src/main/java/io/xpipe/core/store/LinkFileEntry.java b/core/src/main/java/io/xpipe/core/store/LinkFileEntry.java index a92f1552..da228268 100644 --- a/core/src/main/java/io/xpipe/core/store/LinkFileEntry.java +++ b/core/src/main/java/io/xpipe/core/store/LinkFileEntry.java @@ -14,10 +14,13 @@ public class LinkFileEntry extends FileEntry { FileEntry target; public LinkFileEntry( - FileSystem fileSystem, @NonNull String path, Instant date, long size, @NonNull FileInfo info, - @NonNull FileEntry target - ) { - super(fileSystem, path, date, size, info, FileKind.LINK); + FileSystem fileSystem, + @NonNull String path, + Instant date, + long size, + @NonNull FileInfo info, + @NonNull FileEntry target) { + super(fileSystem, path, date, size, info, FileKind.LINK); this.target = target; } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/ChgrpAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/ChgrpAction.java index 6e9253a4..40f9d01e 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/ChgrpAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/ChgrpAction.java @@ -7,9 +7,11 @@ import io.xpipe.app.browser.fs.OpenFileSystemModel; import io.xpipe.app.core.AppI18n; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.OsType; + import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ObservableValue; import javafx.scene.Node; + import org.kordamp.ikonli.javafx.FontIcon; import java.util.List; @@ -40,8 +42,13 @@ public class ChgrpAction implements BranchAction { @Override public List getBranchingActions(OpenFileSystemModel model, List entries) { return model.getCache().getGroups().entrySet().stream() - .filter(e -> !e.getValue().equals("nohome") && !e.getValue().equals("nogroup") && !e.getValue().equals("nobody") && (e.getKey().equals(0) || e.getKey() >= 1000)) - .map(e -> e.getValue()).map(s -> (LeafAction) new Chgrp(s)).toList(); + .filter(e -> !e.getValue().equals("nohome") + && !e.getValue().equals("nogroup") + && !e.getValue().equals("nobody") + && (e.getKey().equals(0) || e.getKey() >= 1000)) + .map(e -> e.getValue()) + .map(s -> (LeafAction) new Chgrp(s)) + .toList(); } private static class Chgrp implements LeafAction { diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/ChownAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/ChownAction.java index 93821a45..1c92292d 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/ChownAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/ChownAction.java @@ -7,9 +7,11 @@ import io.xpipe.app.browser.fs.OpenFileSystemModel; import io.xpipe.app.core.AppI18n; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.process.OsType; + import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ObservableValue; import javafx.scene.Node; + import org.kordamp.ikonli.javafx.FontIcon; import java.util.List; @@ -40,8 +42,12 @@ public class ChownAction implements BranchAction { @Override public List getBranchingActions(OpenFileSystemModel model, List entries) { return model.getCache().getUsers().entrySet().stream() - .filter(e -> !e.getValue().equals("nohome") && !e.getValue().equals("nobody") && (e.getKey().equals(0) || e.getKey() >= 1000)) - .map(e -> e.getValue()).map(s -> (LeafAction) new Chown(s)).toList(); + .filter(e -> !e.getValue().equals("nohome") + && !e.getValue().equals("nobody") + && (e.getKey().equals(0) || e.getKey() >= 1000)) + .map(e -> e.getValue()) + .map(s -> (LeafAction) new Chown(s)) + .toList(); } private static class Chown implements LeafAction { diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/JavapAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/JavapAction.java index 2c4216c6..9d90c5d3 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/JavapAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/JavapAction.java @@ -4,8 +4,8 @@ import io.xpipe.app.browser.action.BrowserActionFormatter; import io.xpipe.app.browser.file.BrowserEntry; import io.xpipe.app.browser.fs.OpenFileSystemModel; import io.xpipe.app.browser.icon.BrowserIconFileType; - import io.xpipe.core.store.FileNames; + import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ObservableValue; @@ -35,6 +35,7 @@ public class JavapAction extends ToFileCommandAction implements FileTypeAction, @Override protected String createCommand(OpenFileSystemModel model, BrowserEntry entry) { - return "javap -c -p " + FileNames.quoteIfNecessary(entry.getRawFileEntry().getPath()); + return "javap -c -p " + + FileNames.quoteIfNecessary(entry.getRawFileEntry().getPath()); } } 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 d688cdff..394f8b47 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 @@ -71,7 +71,8 @@ public abstract class MultiExecuteSelectionAction implements BranchAction { long exitCode; try (var command = pc.command(cmd) .withWorkingDirectory( - model.getCurrentDirectory().getPath()).start()) { + model.getCurrentDirectory().getPath()) + .start()) { var r = command.readStdoutAndStderr(); out.set(r[0]); err.set(r[1]); @@ -79,7 +80,8 @@ public abstract class MultiExecuteSelectionAction implements BranchAction { } // Only throw actual error output if (exitCode != 0) { - throw ErrorEvent.expected(ProcessOutputException.of(exitCode, out.get(), err.get())); + throw ErrorEvent.expected( + ProcessOutputException.of(exitCode, out.get(), err.get())); } }, false); diff --git a/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptGroupStoreProvider.java b/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptGroupStoreProvider.java index 1e35c181..9831a72f 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptGroupStoreProvider.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptGroupStoreProvider.java @@ -10,10 +10,12 @@ import io.xpipe.app.fxcomps.impl.DataStoreChoiceComp; import io.xpipe.app.storage.DataStoreEntry; import io.xpipe.app.util.OptionsBuilder; import io.xpipe.core.store.DataStore; + import javafx.beans.property.Property; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.value.ObservableValue; + import lombok.SneakyThrows; import java.util.List; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/service/AbstractServiceGroupStoreProvider.java b/ext/base/src/main/java/io/xpipe/ext/base/service/AbstractServiceGroupStoreProvider.java index 9746a8f8..940b4ea4 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/service/AbstractServiceGroupStoreProvider.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/service/AbstractServiceGroupStoreProvider.java @@ -35,20 +35,22 @@ public abstract class AbstractServiceGroupStoreProvider implements DataStoreProv } private StoreToggleComp createToggleComp(StoreSection sec) { - var t = StoreToggleComp.>enableToggle(null, sec, new SimpleBooleanProperty(false), (g, aBoolean) -> { - var children = DataStorage.get().getStoreChildren(sec.getWrapper().getEntry()); - ThreadHelper.runFailableAsync(() -> { - for (DataStoreEntry child : children) { - if (child.getStore() instanceof AbstractServiceStore serviceStore) { - if (aBoolean) { - serviceStore.startSessionIfNeeded(); - } else { - serviceStore.stopSessionIfNeeded(); + var t = StoreToggleComp.>enableToggle( + null, sec, new SimpleBooleanProperty(false), (g, aBoolean) -> { + var children = + DataStorage.get().getStoreChildren(sec.getWrapper().getEntry()); + ThreadHelper.runFailableAsync(() -> { + for (DataStoreEntry child : children) { + if (child.getStore() instanceof AbstractServiceStore serviceStore) { + if (aBoolean) { + serviceStore.startSessionIfNeeded(); + } else { + serviceStore.stopSessionIfNeeded(); + } + } } - } - } - }); - }); + }); + }); t.setCustomVisibility(Bindings.createBooleanBinding( () -> { var children =