diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserBookmarkList.java b/app/src/main/java/io/xpipe/app/browser/BrowserBookmarkList.java index 788fa2e8..733dc57d 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserBookmarkList.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserBookmarkList.java @@ -67,10 +67,9 @@ final class BrowserBookmarkList extends SimpleComp { .pseudoClassStateChanged( SELECTED, newValue != null - && newValue.getEntry() + && newValue.getEntry().get() .equals(s.getWrapper() - .getEntry() - .getStore())); + .getEntry())); }); struc.get().setOnAction(event -> { ThreadHelper.runFailableAsync(() -> { diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java b/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java index 32b9d2ca..d48485bb 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java @@ -34,7 +34,7 @@ public class BrowserClipboard { static { Toolkit.getDefaultToolkit() .getSystemClipboard() - .addFlavorListener(e -> ThreadHelper.runFailableAsync(new FailableRunnable() { + .addFlavorListener(e -> ThreadHelper.runFailableAsync(new FailableRunnable<>() { @Override @SuppressWarnings("unchecked") public void run() throws Throwable { diff --git a/app/src/main/java/io/xpipe/app/comp/base/MultiStepComp.java b/app/src/main/java/io/xpipe/app/comp/base/MultiStepComp.java index 04b1679e..c126f0f1 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/MultiStepComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/MultiStepComp.java @@ -19,6 +19,7 @@ import javafx.geometry.Pos; import javafx.scene.control.Label; import javafx.scene.control.Tab; import javafx.scene.layout.*; +import lombok.Getter; import java.util.List; @@ -28,7 +29,9 @@ public abstract class MultiStepComp extends Comp> { private static final PseudoClass NEXT = PseudoClass.getPseudoClass("next"); private final Property completed = new SimpleBooleanProperty(); private final Property> currentStep = new SimpleObjectProperty<>(); + @Getter private List entries; + @Getter private int currentIndex = 0; private Step getValue() { @@ -94,10 +97,6 @@ public abstract class MultiStepComp extends Comp> { return entries.indexOf(e) == currentIndex; } - public int getCurrentIndex() { - return currentIndex; - } - public boolean isFirstPage() { return currentIndex == 0; } @@ -260,10 +259,6 @@ public abstract class MultiStepComp extends Comp> { protected abstract void finish(); - public List getEntries() { - return entries; - } - public ReadOnlyProperty completedProperty() { return completed; } diff --git a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreSortMode.java b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreSortMode.java index f551b108..e19d2903 100644 --- a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreSortMode.java +++ b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreSortMode.java @@ -11,7 +11,7 @@ import java.util.stream.Stream; public interface StoreSortMode { - static StoreSortMode ALPHABETICAL_DESC = new StoreSortMode() { + StoreSortMode ALPHABETICAL_DESC = new StoreSortMode() { @Override public String getId() { return "alphabetical-desc"; @@ -19,12 +19,12 @@ public interface StoreSortMode { @Override public Comparator comparator() { - return Comparator.comparing( + return Comparator.comparing( e -> e.getWrapper().nameProperty().getValue().toLowerCase(Locale.ROOT)); } }; - static StoreSortMode ALPHABETICAL_ASC = new StoreSortMode() { + StoreSortMode ALPHABETICAL_ASC = new StoreSortMode() { @Override public String getId() { return "alphabetical-asc"; @@ -38,7 +38,7 @@ public interface StoreSortMode { } }; - static StoreSortMode DATE_DESC = new StoreSortMode() { + StoreSortMode DATE_DESC = new StoreSortMode() { @Override public String getId() { return "date-desc"; @@ -55,7 +55,7 @@ public interface StoreSortMode { } }; - static StoreSortMode DATE_ASC = new StoreSortMode() { + StoreSortMode DATE_ASC = new StoreSortMode() { @Override public String getId() { return "date-asc"; @@ -78,7 +78,7 @@ public interface StoreSortMode { section.getAllChildren().stream().flatMap(section1 -> flatten(section1))); } - static List ALL = List.of(ALPHABETICAL_DESC, ALPHABETICAL_ASC, DATE_DESC, DATE_ASC); + List ALL = List.of(ALPHABETICAL_DESC, ALPHABETICAL_ASC, DATE_DESC, DATE_ASC); static Optional fromId(String id) { return ALL.stream() diff --git a/app/src/main/java/io/xpipe/app/core/App.java b/app/src/main/java/io/xpipe/app/core/App.java index 42370685..9b12224e 100644 --- a/app/src/main/java/io/xpipe/app/core/App.java +++ b/app/src/main/java/io/xpipe/app/core/App.java @@ -12,10 +12,12 @@ import javafx.application.Application; import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.stage.Stage; +import lombok.Getter; import javax.imageio.ImageIO; import java.awt.*; +@Getter public class App extends Application { private static App APP; @@ -116,7 +118,4 @@ public class App extends Application { }); } - public Stage getStage() { - return stage; - } } diff --git a/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java b/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java index 13afd41d..d01b0771 100644 --- a/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java +++ b/app/src/main/java/io/xpipe/app/core/AppExtensionManager.java @@ -8,6 +8,7 @@ import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.TrackEvent; import io.xpipe.core.util.ModuleHelper; import io.xpipe.core.util.XPipeInstallation; +import lombok.Getter; import lombok.Value; import java.io.IOException; @@ -28,6 +29,7 @@ public class AppExtensionManager { private final List leafModuleLayers = new ArrayList<>(); private final List extensionBaseDirectories = new ArrayList<>(); private ModuleLayer baseLayer = ModuleLayer.boot(); + @Getter private ModuleLayer extendedLayer; public AppExtensionManager(boolean loadedProviders) { @@ -314,10 +316,6 @@ public class AppExtensionManager { } } - public ModuleLayer getExtendedLayer() { - return extendedLayer; - } - @Value private static class Extension { Path dir; diff --git a/app/src/main/java/io/xpipe/app/core/AppFileWatcher.java b/app/src/main/java/io/xpipe/app/core/AppFileWatcher.java index fa91f540..c9f8e835 100644 --- a/app/src/main/java/io/xpipe/app/core/AppFileWatcher.java +++ b/app/src/main/java/io/xpipe/app/core/AppFileWatcher.java @@ -3,6 +3,7 @@ package io.xpipe.app.core; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.util.ThreadHelper; +import lombok.Getter; import java.io.IOException; import java.nio.file.*; @@ -106,6 +107,7 @@ public class AppFileWatcher { private class WatchedDirectory { private final BiConsumer> listener; + @Getter private final Path baseDir; private WatchedDirectory(Path dir, BiConsumer> listener) { @@ -183,8 +185,5 @@ public class AppFileWatcher { listener.accept(file, ev.kind()); } - public Path getBaseDir() { - return baseDir; - } } } diff --git a/app/src/main/java/io/xpipe/app/core/AppFont.java b/app/src/main/java/io/xpipe/app/core/AppFont.java index d7fdbfa4..8b19ae65 100644 --- a/app/src/main/java/io/xpipe/app/core/AppFont.java +++ b/app/src/main/java/io/xpipe/app/core/AppFont.java @@ -7,7 +7,6 @@ import javafx.css.SizeUnits; import javafx.scene.Node; import javafx.scene.text.Font; -import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; diff --git a/app/src/main/java/io/xpipe/app/core/AppLogs.java b/app/src/main/java/io/xpipe/app/core/AppLogs.java index 1ab565b6..1b98fd24 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLogs.java +++ b/app/src/main/java/io/xpipe/app/core/AppLogs.java @@ -43,7 +43,9 @@ public class AppLogs { DateTimeFormatter.ofPattern("HH:mm:ss:SSS").withZone(ZoneId.systemDefault()); private static AppLogs INSTANCE; + @Getter private final PrintStream originalSysOut; + @Getter private final PrintStream originalSysErr; private final Path logDir; @@ -299,14 +301,6 @@ public class AppLogs { } } - public PrintStream getOriginalSysOut() { - return originalSysOut; - } - - public PrintStream getOriginalSysErr() { - return originalSysErr; - } - public Path getLogsDirectory() { return logDir.getParent(); } diff --git a/app/src/main/java/io/xpipe/app/core/AppTheme.java b/app/src/main/java/io/xpipe/app/core/AppTheme.java index c4fd4e8d..e35abad8 100644 --- a/app/src/main/java/io/xpipe/app/core/AppTheme.java +++ b/app/src/main/java/io/xpipe/app/core/AppTheme.java @@ -164,7 +164,7 @@ public class AppTheme { public String toTranslatedString() { return name; } - }; + } @AllArgsConstructor public static class Theme implements PrefsChoiceValue { diff --git a/app/src/main/java/io/xpipe/app/core/AppTray.java b/app/src/main/java/io/xpipe/app/core/AppTray.java index fdc40b93..b6524f70 100644 --- a/app/src/main/java/io/xpipe/app/core/AppTray.java +++ b/app/src/main/java/io/xpipe/app/core/AppTray.java @@ -6,6 +6,7 @@ import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.ErrorHandler; import io.xpipe.core.process.OsType; import javafx.application.Platform; +import lombok.Getter; import lombok.SneakyThrows; import javax.swing.*; @@ -19,8 +20,9 @@ public class AppTray { private static AppTray INSTANCE; private final FXTrayIcon icon; + @Getter private final ErrorHandler errorHandler; - private TrayIcon privateTrayIcon = null; + private TrayIcon privateTrayIcon; @SneakyThrows private AppTray() { @@ -91,7 +93,7 @@ public class AppTray { if (OsType.getLocal().equals(OsType.LINUX)) { SwingUtilities.invokeLater(() -> { try { - Field peerField = null; + Field peerField; peerField = TrayIcon.class.getDeclaredField("peer"); peerField.setAccessible(true); var peer = peerField.get(this.privateTrayIcon); @@ -129,10 +131,6 @@ public class AppTray { } } - public ErrorHandler getErrorHandler() { - return errorHandler; - } - private class TrayErrorHandler implements ErrorHandler { private Instant lastErrorShown = Instant.MIN; diff --git a/app/src/main/java/io/xpipe/app/core/mode/GuiMode.java b/app/src/main/java/io/xpipe/app/core/mode/GuiMode.java index 72fe8dc7..86a761b7 100644 --- a/app/src/main/java/io/xpipe/app/core/mode/GuiMode.java +++ b/app/src/main/java/io/xpipe/app/core/mode/GuiMode.java @@ -60,8 +60,4 @@ public class GuiMode extends PlatformMode { }); } - @Override - public ErrorHandler getErrorHandler() { - return new SyncErrorHandler(new GuiErrorHandler()); - } } diff --git a/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java b/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java index 44600c49..f0aef40f 100644 --- a/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java +++ b/app/src/main/java/io/xpipe/app/core/mode/OperationMode.java @@ -12,6 +12,7 @@ import io.xpipe.core.util.XPipeDaemonMode; import io.xpipe.core.util.XPipeInstallation; import io.xpipe.core.util.XPipeSystemId; import javafx.application.Platform; +import lombok.Getter; import java.util.ArrayList; import java.util.List; @@ -25,8 +26,11 @@ public abstract class OperationMode { public static final OperationMode GUI = new GuiMode(); private static final Pattern PROPERTY_PATTERN = Pattern.compile("^-[DP](.+)=(.+)$"); private static final List ALL = List.of(BACKGROUND, TRAY, GUI); + @Getter private static boolean inStartup; + @Getter private static boolean inShutdown; + @Getter private static boolean inShutdownHook; private static OperationMode CURRENT = null; @@ -116,14 +120,6 @@ public abstract class OperationMode { DataStoreProviders.postInit(AppExtensionManager.getInstance().getExtendedLayer()); } - public static boolean isInStartup() { - return inStartup; - } - - public static boolean isInShutdown() { - return inShutdown; - } - public static void switchToAsync(OperationMode newMode) { ThreadHelper.createPlatformThread("mode switcher", false, () -> switchTo(newMode)).start(); } @@ -285,10 +281,6 @@ public abstract class OperationMode { return CURRENT; } - public static boolean isInShutdownHook() { - return inShutdownHook; - } - public abstract boolean isSupported(); public abstract String getId(); diff --git a/app/src/main/java/io/xpipe/app/ext/ModuleInstall.java b/app/src/main/java/io/xpipe/app/ext/ModuleInstall.java index 32c1c263..a83de8d4 100644 --- a/app/src/main/java/io/xpipe/app/ext/ModuleInstall.java +++ b/app/src/main/java/io/xpipe/app/ext/ModuleInstall.java @@ -4,12 +4,11 @@ import lombok.Getter; import java.nio.file.Path; +@Getter public abstract class ModuleInstall { - @Getter private final String id; - @Getter private final String module; protected ModuleInstall(String id, String module) { diff --git a/app/src/main/java/io/xpipe/app/fxcomps/augment/DraggableAugment.java b/app/src/main/java/io/xpipe/app/fxcomps/augment/DraggableAugment.java index e17d1b28..19d587ee 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/augment/DraggableAugment.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/augment/DraggableAugment.java @@ -1,9 +1,7 @@ package io.xpipe.app.fxcomps.augment; import io.xpipe.app.fxcomps.CompStructure; -import javafx.event.EventHandler; import javafx.scene.Cursor; -import javafx.scene.input.MouseEvent; public class DraggableAugment> implements Augment { @@ -17,44 +15,32 @@ public class DraggableAugment> implements Augment public void augment(S struc) { var circle = struc.get(); var oldDepth = struc.get().getViewOrder(); - circle.setOnMousePressed(new EventHandler() { - @Override public void handle(MouseEvent mouseEvent) { - lastMouseX = mouseEvent.getSceneX(); - lastMouseY = mouseEvent.getSceneY(); - circle.getScene().setCursor(Cursor.MOVE); - circle.setViewOrder(1000); - } + circle.setOnMousePressed(mouseEvent -> { + lastMouseX = mouseEvent.getSceneX(); + lastMouseY = mouseEvent.getSceneY(); + circle.getScene().setCursor(Cursor.MOVE); + circle.setViewOrder(1000); }); - circle.setOnMouseReleased(new EventHandler() { - @Override public void handle(MouseEvent mouseEvent) { + circle.setOnMouseReleased(mouseEvent -> circle.getScene().setCursor(Cursor.HAND)); + circle.setOnMouseDragged(mouseEvent -> { + final double deltaX = mouseEvent.getSceneX() - lastMouseX; + final double deltaY = mouseEvent.getSceneY() - lastMouseY; + final double initialTranslateX = circle.getTranslateX(); + final double initialTranslateY = circle.getTranslateY(); + circle.setTranslateX(initialTranslateX + deltaX); + circle.setTranslateY(initialTranslateY + deltaY); + lastMouseX = mouseEvent.getSceneX(); + lastMouseY = mouseEvent.getSceneY(); + + }); + circle.setOnMouseEntered(mouseEvent -> { + if (!mouseEvent.isPrimaryButtonDown()) { circle.getScene().setCursor(Cursor.HAND); } }); - circle.setOnMouseDragged(new EventHandler() { - @Override public void handle(MouseEvent mouseEvent) { - final double deltaX = mouseEvent.getSceneX() - lastMouseX; - final double deltaY = mouseEvent.getSceneY() - lastMouseY; - final double initialTranslateX = circle.getTranslateX(); - final double initialTranslateY = circle.getTranslateY(); - circle.setTranslateX(initialTranslateX + deltaX); - circle.setTranslateY(initialTranslateY + deltaY); - lastMouseX = mouseEvent.getSceneX(); - lastMouseY = mouseEvent.getSceneY(); - - } - }); - circle.setOnMouseEntered(new EventHandler() { - @Override public void handle(MouseEvent mouseEvent) { - if (!mouseEvent.isPrimaryButtonDown()) { - circle.getScene().setCursor(Cursor.HAND); - } - } - }); - circle.setOnMouseExited(new EventHandler() { - @Override public void handle(MouseEvent mouseEvent) { - if (!mouseEvent.isPrimaryButtonDown()) { - circle.getScene().setCursor(Cursor.DEFAULT); - } + circle.setOnMouseExited(mouseEvent -> { + if (!mouseEvent.isPrimaryButtonDown()) { + circle.getScene().setCursor(Cursor.DEFAULT); } }); } diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java index 54c9f495..c5d72c50 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/DataStoreListChoiceComp.java @@ -43,11 +43,10 @@ public class DataStoreListChoiceComp extends SimpleComp { var delete = new IconButtonComp("mdal-delete_outline", () -> { selectedList.remove(t); }); - var hbox = new HorizontalComp(List.of(label, Comp.hspacer(), delete)).styleClass("entry"); - return hbox; + return new HorizontalComp(List.of(label, Comp.hspacer(), delete)).styleClass("entry"); }).padding(new Insets(0)).apply(struc -> struc.get().setMinHeight(0)).apply(struc -> ((VBox) struc.get().getContent()).setSpacing(5)); var selected = new SimpleObjectProperty>(); - var add = new DataStoreChoiceComp(DataStoreChoiceComp.Mode.OTHER, null, selected, storeClass, applicableCheck, initialCategory); + var add = new DataStoreChoiceComp<>(DataStoreChoiceComp.Mode.OTHER, null, selected, storeClass, applicableCheck, initialCategory); selected.addListener((observable, oldValue, newValue) -> { if (newValue != null) { if (!selectedList.contains(newValue) diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/OptionsComp.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/OptionsComp.java index 200cb93d..f2c5034f 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/OptionsComp.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/OptionsComp.java @@ -18,10 +18,12 @@ import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.*; +import lombok.Getter; import java.util.ArrayList; import java.util.List; +@Getter public class OptionsComp extends Comp> { private final List entries; @@ -46,7 +48,6 @@ public class OptionsComp extends Comp> { pane.getStyleClass().add("options-comp"); var nameRegions = new ArrayList(); - var compRegions = new ArrayList(); for (var entry : getEntries()) { Region compRegion = null; @@ -135,7 +136,6 @@ public class OptionsComp extends Comp> { if (compRegion != null) { compRegion.accessibleTextProperty().bind(name.textProperty()); - compRegions.add(compRegion); line.getChildren().add(compRegion); HBox.setHgrow(compRegion, Priority.ALWAYS); } @@ -143,7 +143,6 @@ public class OptionsComp extends Comp> { pane.getChildren().add(line); } else { if (compRegion != null) { - compRegions.add(compRegion); pane.getChildren().add(compRegion); } } @@ -165,10 +164,6 @@ public class OptionsComp extends Comp> { return new SimpleCompStructure<>(pane); } - public List getEntries() { - return entries; - } - public record Entry( String key, ObservableValue description, diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/SvgHelper.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/SvgHelper.java index 3ea4597f..68ab97a5 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/SvgHelper.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/SvgHelper.java @@ -21,7 +21,7 @@ public class SvgHelper { } public static Point2D getDimensions(String val) { - var regularExpression = Pattern.compile("]+?width=\"([^\s]+)\"", Pattern.DOTALL); + var regularExpression = Pattern.compile("]+?width=\"([^ ]+)\"", Pattern.DOTALL); var matcher = regularExpression.matcher(val); if (!matcher.find()) { @@ -36,7 +36,7 @@ public class SvgHelper { } var width = matcher.group(1); - regularExpression = Pattern.compile(" ObservableList orderedContentBinding(ObservableList l2, Comparator comp, Observable... observables) { return orderedContentBinding(l2, Bindings.createObjectBinding(() -> { - return new Comparator() { + return new Comparator<>() { @Override public int compare(V o1, V o2) { return comp.compare(o1, o2); @@ -240,7 +240,7 @@ public class BindingsHelper { public static ObservableList filteredContentBinding(ObservableList l2, Predicate predicate, Observable... observables) { return filteredContentBinding(l2, Bindings.createObjectBinding(() -> { - return new Predicate() { + return new Predicate<>() { @Override public boolean test(V v) { return predicate.test(v); diff --git a/app/src/main/java/io/xpipe/app/launcher/LauncherInput.java b/app/src/main/java/io/xpipe/app/launcher/LauncherInput.java index ff19c756..c1b6597c 100644 --- a/app/src/main/java/io/xpipe/app/launcher/LauncherInput.java +++ b/app/src/main/java/io/xpipe/app/launcher/LauncherInput.java @@ -125,9 +125,9 @@ public abstract class LauncherInput { } } + @Getter public abstract static class ActionInput extends LauncherInput { - @Getter private final List args; protected ActionInput(List args) { diff --git a/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java b/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java index fc37ceb9..9daaed86 100644 --- a/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java +++ b/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java @@ -31,6 +31,7 @@ import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.geometry.Insets; import javafx.geometry.Pos; +import lombok.Getter; import lombok.SneakyThrows; import org.kordamp.ikonli.javafx.FontIcon; @@ -127,7 +128,9 @@ public class AppPrefs { // Lock // ==== + @Getter private final Property lockPassword = new SimpleObjectProperty<>(); + @Getter private final StringProperty lockCrypt = typed(new SimpleStringProperty(""), String.class); // Window opacity @@ -297,14 +300,6 @@ public class AppPrefs { } } - public StringProperty getLockCrypt() { - return lockCrypt; - } - - public Property getLockPassword() { - return lockPassword; - } - public final ReadOnlyIntegerProperty editorReloadTimeout() { return editorReloadTimeout; } @@ -664,6 +659,7 @@ public class AppPrefs { name, Arrays.stream(settings).filter(setting -> setting != null).toArray(Setting[]::new)); } + @Getter private class PrefsHandlerImpl implements PrefsHandler { private final List categories; @@ -710,8 +706,5 @@ public class AppPrefs { categories.add(index, newCategory); } - public List getCategories() { - return categories; - } } } diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalTerminalType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalTerminalType.java index 5bf6f6b9..4d976271 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalTerminalType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalTerminalType.java @@ -507,7 +507,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue { } @Value - static class LaunchConfiguration { + class LaunchConfiguration { DataStoreColor color; String title; diff --git a/app/src/main/java/io/xpipe/app/prefs/QuietResourceBundleService.java b/app/src/main/java/io/xpipe/app/prefs/QuietResourceBundleService.java index 3ed0faf4..4b09840f 100644 --- a/app/src/main/java/io/xpipe/app/prefs/QuietResourceBundleService.java +++ b/app/src/main/java/io/xpipe/app/prefs/QuietResourceBundleService.java @@ -4,8 +4,7 @@ import com.dlsc.formsfx.model.util.ResourceBundleService; import io.xpipe.app.core.AppI18n; import lombok.NonNull; -import java.util.Enumeration; -import java.util.ResourceBundle; +import java.util.*; public class QuietResourceBundleService extends ResourceBundleService { @@ -17,8 +16,8 @@ public class QuietResourceBundleService extends ResourceBundleService { } @Override - public Enumeration getKeys() { - return null; + public @NonNull Enumeration getKeys() { + return Collections.emptyEnumeration(); } }); } diff --git a/app/src/main/java/io/xpipe/app/prefs/UpdateCheckComp.java b/app/src/main/java/io/xpipe/app/prefs/UpdateCheckComp.java index ce146859..1355d4d5 100644 --- a/app/src/main/java/io/xpipe/app/prefs/UpdateCheckComp.java +++ b/app/src/main/java/io/xpipe/app/prefs/UpdateCheckComp.java @@ -75,7 +75,7 @@ public class UpdateCheckComp extends SimpleComp { return "mdi2r-refresh"; }, updateReady); - var button = new TileButtonComp(name, description, graphic, actionEvent -> { + return new TileButtonComp(name, description, graphic, actionEvent -> { actionEvent.consume(); if (updateReady.getValue()) { restart(); @@ -91,6 +91,5 @@ public class UpdateCheckComp extends SimpleComp { .disable(PlatformThread.sync( XPipeDistributionType.get().getUpdateHandler().getBusy())) .createRegion(); - return button; } } diff --git a/app/src/main/java/io/xpipe/app/prefs/VaultCategory.java b/app/src/main/java/io/xpipe/app/prefs/VaultCategory.java index 2a14a3b6..dc9eae5b 100644 --- a/app/src/main/java/io/xpipe/app/prefs/VaultCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/VaultCategory.java @@ -62,8 +62,7 @@ public class VaultCategory extends AppPrefsCategory { BooleanField enable = BooleanField.ofBooleanType(prefs.enableGitStorage) .editable(pro) .render(() -> { - var c = new CustomToggleControl(); - return c; + return new CustomToggleControl(); }); StringField remote = StringField.ofStringType(prefs.storageGitRemote) .editable(pro) diff --git a/app/src/main/java/io/xpipe/app/storage/DataStateProviderImpl.java b/app/src/main/java/io/xpipe/app/storage/DataStateProviderImpl.java index c7f1a81c..52a67424 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStateProviderImpl.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStateProviderImpl.java @@ -45,7 +45,7 @@ public class DataStateProviderImpl extends DataStateProvider { if (found == null) { entry.get().setStorePersistentState(def.get()); } - return (T) entry.get().getStorePersistentState(); + return entry.get().getStorePersistentState(); } @Override diff --git a/app/src/main/java/io/xpipe/app/storage/DataStorageWriter.java b/app/src/main/java/io/xpipe/app/storage/DataStorageWriter.java index 704b3ce6..3d75f76a 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorageWriter.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorageWriter.java @@ -8,7 +8,6 @@ public class DataStorageWriter { public static JsonNode storeToNode(DataStore store) { var mapper = JacksonMapper.getDefault(); - var tree = mapper.valueToTree(store); - return tree; + return mapper.valueToTree(store); } } 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 8e8be60e..2470025c 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStoreEntry.java @@ -227,7 +227,7 @@ public class DataStoreEntry extends StorageElement { } public DataStoreEntryRef ref() { - return new DataStoreEntryRef(this); + return new DataStoreEntryRef<>(this); } public void setStoreCache(String key, Object value) { 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 c73db7ea..42a08004 100644 --- a/app/src/main/java/io/xpipe/app/storage/StorageElement.java +++ b/app/src/main/java/io/xpipe/app/storage/StorageElement.java @@ -15,15 +15,20 @@ import java.util.UUID; public abstract class StorageElement { + @Getter protected final UUID uuid; protected final List listeners = new ArrayList<>(); @Getter protected boolean dirty; + @Getter protected Path directory; + @Getter protected String name; + @Getter protected Instant lastUsed; + @Getter protected Instant lastModified; public StorageElement( @@ -67,22 +72,10 @@ public abstract class StorageElement { return getLastUsed().isAfter(getLastModified()) ? getLastUsed() : getLastModified(); } - public Path getDirectory() { - return directory; - } - public void setDirectory(Path directory) { this.directory = directory; } - public UUID getUuid() { - return uuid; - } - - public String getName() { - return name; - } - public void setName(String name) { if (name.equals(this.name)) { return; @@ -94,14 +87,6 @@ public abstract class StorageElement { notifyUpdate(); } - public Instant getLastUsed() { - return lastUsed; - } - - public Instant getLastModified() { - return lastModified; - } - public interface Listener { void onUpdate(); } diff --git a/app/src/main/java/io/xpipe/app/util/ScanAlert.java b/app/src/main/java/io/xpipe/app/util/ScanAlert.java index eb9ebf95..8482b52f 100644 --- a/app/src/main/java/io/xpipe/app/util/ScanAlert.java +++ b/app/src/main/java/io/xpipe/app/util/ScanAlert.java @@ -77,7 +77,7 @@ public class ScanAlert { @Override protected List setup() { - return List.of(new Entry(AppI18n.observable("a"), new Step>() { + return List.of(new Entry(AppI18n.observable("a"), new Step<>() { @Override public CompStructure createBase() { var b = new OptionsBuilder() @@ -88,9 +88,10 @@ public class ScanAlert { null, entry, ShellStore.class, - store1 -> true, - StoreViewState.get().getAllConnectionsCategory()) - .disable(new SimpleBooleanProperty(initialStore != null))) + store1 -> true, + StoreViewState.get().getAllConnectionsCategory() + ) + .disable(new SimpleBooleanProperty(initialStore != null))) .name("scanAlertHeader") .description("scanAlertHeaderDescription") .addComp(Comp.of(() -> stackPane).vgrow()) @@ -99,7 +100,7 @@ public class ScanAlert { .prefHeight(600) .styleClass("window-content") .apply(struc -> { - VBox.setVgrow(((VBox) struc.get().getChildren().get(1)), ALWAYS); + VBox.setVgrow(struc.get().getChildren().get(1), ALWAYS); }) .createStructure() .get(); @@ -123,16 +124,17 @@ public class ScanAlert { } selected.setAll(a.stream() - .filter( - scanOperation -> - scanOperation.isDefaultSelected()) - .toList()); + .filter( + scanOperation -> + scanOperation.isDefaultSelected()) + .toList()); var r = new ListSelectorComp<>( - a, - scanOperation -> - AppI18n.get(scanOperation.getNameKey()), - selected, - a.size() > 3) + a, + scanOperation -> + AppI18n.get(scanOperation.getNameKey()), + selected, + a.size() > 3 + ) .createRegion(); stackPane.getChildren().add(r); }); diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java b/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java index 558de245..c8c95d90 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java @@ -6,6 +6,7 @@ import io.xpipe.beacon.util.QuietDialogHandler; import io.xpipe.core.store.InternalStreamStore; import io.xpipe.core.util.FailableBiConsumer; import io.xpipe.core.util.FailableConsumer; +import lombok.Getter; import java.io.IOException; import java.io.InputStream; @@ -13,6 +14,7 @@ import java.io.OutputStream; public abstract class BeaconConnection implements AutoCloseable { + @Getter protected BeaconClient beaconClient; private InputStream bodyInput; @@ -20,10 +22,6 @@ public abstract class BeaconConnection implements AutoCloseable { protected abstract void constructSocket(); - public BeaconClient getBeaconClient() { - return beaconClient; - } - @Override public void close() { try { diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/MessageExchanges.java b/beacon/src/main/java/io/xpipe/beacon/exchange/MessageExchanges.java index 157809ea..54c0db98 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/MessageExchanges.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/MessageExchanges.java @@ -16,7 +16,7 @@ public class MessageExchanges { if (ALL == null) { ALL = ServiceLoader.load(MessageExchange.class).stream() .map(s -> { - return (MessageExchange) s.get(); + return s.get(); }) .collect(Collectors.toList()); } diff --git a/core/src/main/java/io/xpipe/core/charsetter/NewLine.java b/core/src/main/java/io/xpipe/core/charsetter/NewLine.java index da1b4b44..550e044f 100644 --- a/core/src/main/java/io/xpipe/core/charsetter/NewLine.java +++ b/core/src/main/java/io/xpipe/core/charsetter/NewLine.java @@ -1,6 +1,7 @@ package io.xpipe.core.charsetter; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; import java.util.Arrays; @@ -11,6 +12,7 @@ public enum NewLine { CRLF("\r\n", "crlf"); private final String newLine; + @Getter private final String id; NewLine(String newLine, String id) { @@ -36,7 +38,4 @@ public enum NewLine { return newLine; } - public String getId() { - return id; - } } diff --git a/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java b/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java index a3aba841..b2c41c92 100644 --- a/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java +++ b/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java @@ -13,6 +13,7 @@ import lombok.ToString; public class BaseQueryElement extends DialogElement { private final String description; + @Getter private final boolean newLine; private final boolean required; private final boolean secret; @@ -35,10 +36,6 @@ public class BaseQueryElement extends DialogElement { return required && value == null; } - public boolean isNewLine() { - return newLine; - } - @Override public String toDisplayString() { return description; diff --git a/core/src/main/java/io/xpipe/core/dialog/ChoiceElement.java b/core/src/main/java/io/xpipe/core/dialog/ChoiceElement.java index cf93db3c..9f87a658 100644 --- a/core/src/main/java/io/xpipe/core/dialog/ChoiceElement.java +++ b/core/src/main/java/io/xpipe/core/dialog/ChoiceElement.java @@ -14,11 +14,15 @@ import java.util.List; @Getter public class ChoiceElement extends DialogElement { + @Getter private final String description; + @Getter private final List elements; + @Getter private final boolean required; private final boolean quiet; + @Getter private int selected; @JsonCreator @@ -76,19 +80,4 @@ public class ChoiceElement extends DialogElement { return false; } - public List getElements() { - return elements; - } - - public int getSelected() { - return selected; - } - - public String getDescription() { - return description; - } - - public boolean isRequired() { - return required; - } } diff --git a/core/src/main/java/io/xpipe/core/dialog/DialogElement.java b/core/src/main/java/io/xpipe/core/dialog/DialogElement.java index 5421e2d2..aca75582 100644 --- a/core/src/main/java/io/xpipe/core/dialog/DialogElement.java +++ b/core/src/main/java/io/xpipe/core/dialog/DialogElement.java @@ -2,10 +2,12 @@ package io.xpipe.core.dialog; import com.fasterxml.jackson.annotation.JsonTypeInfo; import lombok.EqualsAndHashCode; +import lombok.Getter; import lombok.ToString; import java.util.UUID; +@Getter @EqualsAndHashCode @ToString @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @@ -27,7 +29,4 @@ public abstract class DialogElement { throw new UnsupportedOperationException(); } - public String getId() { - return id; - } } diff --git a/core/src/main/java/io/xpipe/core/dialog/HeaderElement.java b/core/src/main/java/io/xpipe/core/dialog/HeaderElement.java index 5a4f16d0..80870ead 100644 --- a/core/src/main/java/io/xpipe/core/dialog/HeaderElement.java +++ b/core/src/main/java/io/xpipe/core/dialog/HeaderElement.java @@ -3,8 +3,10 @@ package io.xpipe.core.dialog; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import lombok.EqualsAndHashCode; +import lombok.Getter; import lombok.ToString; +@Getter @JsonTypeName("header") @EqualsAndHashCode(callSuper = true) @ToString @@ -27,7 +29,4 @@ public class HeaderElement extends DialogElement { return true; } - public String getHeader() { - return header; - } } diff --git a/core/src/main/java/io/xpipe/core/process/ShellControl.java b/core/src/main/java/io/xpipe/core/process/ShellControl.java index 65d172d4..a8050993 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellControl.java +++ b/core/src/main/java/io/xpipe/core/process/ShellControl.java @@ -44,7 +44,7 @@ public interface ShellControl extends ProcessControl { s.setOsName(shellControl.getOsName()); store.setState(s); }); - }; + } default ShellControl withSupportCheckInit(Predicate predicate, String name) { return onInit(shellControl -> { @@ -52,7 +52,7 @@ public interface ShellControl extends ProcessControl { } }); - }; + } default ShellControl withShellStateFail(StatefulDataStore store) { return onFail(shellControl -> { @@ -60,7 +60,7 @@ public interface ShellControl extends ProcessControl { s.setRunning(false); store.setState(s); }); - }; + } ShellControl onExit(Consumer pc); diff --git a/core/src/main/java/io/xpipe/core/store/DataFlow.java b/core/src/main/java/io/xpipe/core/store/DataFlow.java index 3e542df5..f55dd79d 100644 --- a/core/src/main/java/io/xpipe/core/store/DataFlow.java +++ b/core/src/main/java/io/xpipe/core/store/DataFlow.java @@ -1,7 +1,9 @@ package io.xpipe.core.store; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; +@Getter public enum DataFlow { @JsonProperty("input") INPUT("Input"), @@ -28,7 +30,4 @@ public enum DataFlow { return this == OUTPUT || this == INPUT_OUTPUT; } - public String getDisplayName() { - return displayName; - } } diff --git a/core/src/main/java/io/xpipe/core/util/EncryptedSecretValue.java b/core/src/main/java/io/xpipe/core/util/EncryptedSecretValue.java index 7c76abfe..f78667b6 100644 --- a/core/src/main/java/io/xpipe/core/util/EncryptedSecretValue.java +++ b/core/src/main/java/io/xpipe/core/util/EncryptedSecretValue.java @@ -8,11 +8,11 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.StandardCharsets; +@Getter @SuperBuilder @EqualsAndHashCode public abstract class EncryptedSecretValue implements SecretValue { - @Getter String encryptedValue; public EncryptedSecretValue(char[] c) { diff --git a/core/src/main/java/io/xpipe/core/util/JacksonMapper.java b/core/src/main/java/io/xpipe/core/util/JacksonMapper.java index deb06579..a6a72dc2 100644 --- a/core/src/main/java/io/xpipe/core/util/JacksonMapper.java +++ b/core/src/main/java/io/xpipe/core/util/JacksonMapper.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import lombok.Getter; import java.util.ArrayList; import java.util.List; @@ -16,6 +17,7 @@ public class JacksonMapper { private static final ObjectMapper BASE = new ObjectMapper(); private static final ObjectMapper INSTANCE; + @Getter private static boolean init = false; public static T parse(String s, Class c) throws JsonProcessingException { @@ -85,7 +87,4 @@ public class JacksonMapper { return INSTANCE; } - public static boolean isInit() { - return init; - } } diff --git a/core/src/main/java/io/xpipe/core/util/XPipeDaemonMode.java b/core/src/main/java/io/xpipe/core/util/XPipeDaemonMode.java index d76d5e38..5b7a3216 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeDaemonMode.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeDaemonMode.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Locale; import java.util.stream.Collectors; +@Getter public enum XPipeDaemonMode { @JsonProperty("background") BACKGROUND("background", List.of("base", "background")), @@ -29,10 +30,8 @@ public enum XPipeDaemonMode { .collect(Collectors.joining(", ")))); } - @Getter private final String displayName; - @Getter private final List nameAlternatives; XPipeDaemonMode(String displayName, List nameAlternatives) { diff --git a/ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java b/ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java index 14658832..2e7a7e6c 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/action/XPipeUrlAction.java @@ -90,28 +90,33 @@ public class XPipeUrlAction implements ActionProvider { @Override public Action createAction(List args) throws Exception { - if (args.get(0).equals("addStore")) { - var storeString = DefaultSecretValue.builder() - .encryptedValue(args.get(1)) - .build(); - var store = JacksonMapper.parse(storeString.getSecretValue(), DataStore.class); - return new AddStoreAction(store); - } else if (args.get(0).equals("launch")) { - var entry = DataStorage.get() - .getStoreEntryIfPresent(UUID.fromString(args.get(1))) - .orElseThrow(); - return new LaunchAction(entry); - } else if (args.get(0).equals("action")) { - var id = args.get(1); - ActionProvider provider = ActionProvider.ALL.stream().filter(actionProvider -> { - return actionProvider.getDataStoreCallSite() != null && id.equals(actionProvider.getId()); - }).findFirst().orElseThrow(); - var entry = DataStorage.get() - .getStoreEntryIfPresent(UUID.fromString(args.get(2))) - .orElseThrow(); - return new CallAction(provider, entry); - } else { - return null; + switch (args.get(0)) { + case "addStore" -> { + var storeString = DefaultSecretValue.builder() + .encryptedValue(args.get(1)) + .build(); + var store = JacksonMapper.parse(storeString.getSecretValue(), DataStore.class); + return new AddStoreAction(store); + } + case "launch" -> { + var entry = DataStorage.get() + .getStoreEntryIfPresent(UUID.fromString(args.get(1))) + .orElseThrow(); + return new LaunchAction(entry); + } + case "action" -> { + var id = args.get(1); + ActionProvider provider = ActionProvider.ALL.stream().filter(actionProvider -> { + return actionProvider.getDataStoreCallSite() != null && id.equals(actionProvider.getId()); + }).findFirst().orElseThrow(); + var entry = DataStorage.get() + .getStoreEntryIfPresent(UUID.fromString(args.get(2))) + .orElseThrow(); + return new CallAction(provider, entry); + } + default -> { + return null; + } } } }; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/RefreshDirectoryAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/RefreshDirectoryAction.java index 2575a1e3..070ccaad 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/RefreshDirectoryAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/RefreshDirectoryAction.java @@ -2,7 +2,6 @@ package io.xpipe.ext.base.browser; import io.xpipe.app.browser.BrowserEntry; import io.xpipe.app.browser.OpenFileSystemModel; -import io.xpipe.app.browser.action.BrowserAction; import io.xpipe.app.browser.action.LeafAction; import javafx.scene.Node; import javafx.scene.input.KeyCode; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java b/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java index 27f550f7..60b571a7 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/script/SimpleScriptStore.java @@ -54,7 +54,7 @@ public class SimpleScriptStore extends ScriptStore { } @Getter - public static enum ExecutionType { + public enum ExecutionType { @JsonProperty("dumbOnly") DUMB_ONLY("dumbOnly"), @JsonProperty("terminalOnly")