From c84db86457b0aad396854d980eb1cc9175a7d747 Mon Sep 17 00:00:00 2001 From: crschnick Date: Tue, 8 Aug 2023 10:04:32 +0000 Subject: [PATCH] Refactor and cleanup --- README.md | 2 +- .../io/xpipe/api/impl/DataSourceImpl.java | 6 ++--- .../java/io/xpipe/api/impl/DataTableImpl.java | 2 +- app/build.gradle | 2 +- .../xpipe/app/browser/BrowserClipboard.java | 3 +-- .../xpipe/app/browser/BrowserContextMenu.java | 3 +-- .../app/browser/BrowserFileListComp.java | 3 +-- .../io/xpipe/app/browser/BrowserNavBar.java | 3 +-- .../app/browser/BrowserOverviewComp.java | 3 +-- .../xpipe/app/browser/BrowserSavedState.java | 3 +-- .../app/browser/BrowserSelectionListComp.java | 3 +-- .../io/xpipe/app/comp/DeveloperTabComp.java | 3 +-- .../io/xpipe/app/comp/base/CountComp.java | 2 +- .../app/comp/base/IntegratedTextAreaComp.java | 3 +-- .../io/xpipe/app/comp/base/MarkdownComp.java | 4 +-- .../io/xpipe/app/comp/base/OsLogoComp.java | 3 +-- .../xpipe/app/comp/base/SystemStateComp.java | 11 ++++---- .../storage/store/DenseStoreEntryComp.java | 2 -- .../comp/storage/store/StoreEntryComp.java | 3 +-- .../store/StoreEntryFlatMiniSectionComp.java | 3 +-- .../comp/storage/store/StoreNotFoundComp.java | 3 +-- .../xpipe/app/core/AppActionLinkDetector.java | 3 +-- .../main/java/io/xpipe/app/core/AppFont.java | 2 +- .../java/io/xpipe/app/core/AppGreetings.java | 1 + .../app/exchange/MessageExchangeImpls.java | 3 +-- .../exchange/cli/ReadDrainExchangeImpl.java | 2 +- .../io/xpipe/app/ext/DataStoreProvider.java | 8 +++--- .../app/fxcomps/impl/DataStoreChoiceComp.java | 2 +- .../app/fxcomps/impl/DynamicOptionsComp.java | 6 ++--- .../impl/FileSystemStoreChoiceComp.java | 3 +-- .../xpipe/app/fxcomps/impl/OptionsComp.java | 3 +-- .../app/fxcomps/util/BindingsHelper.java | 1 + .../app/fxcomps/util/PlatformThread.java | 23 ++++++++-------- .../io/xpipe/app/issue/ErrorDetailsComp.java | 3 +-- .../java/io/xpipe/app/issue/ErrorEvent.java | 2 +- .../io/xpipe/app/issue/UserReportComp.java | 3 +-- .../java/io/xpipe/app/prefs/AboutComp.java | 3 +-- .../io/xpipe/app/prefs/CloseBehaviour.java | 4 --- .../xpipe/app/prefs/ExternalEditorType.java | 6 +---- .../app/prefs/QuietResourceBundleService.java | 6 ++--- .../io/xpipe/app/prefs/StartupBehaviour.java | 3 --- .../io/xpipe/app/storage/DataStorage.java | 6 ++--- .../xpipe/app/storage/DataStorageWriter.java | 3 +-- .../io/xpipe/app/storage/DataStoreEntry.java | 13 +++------- .../app/storage/ImpersistentStorage.java | 3 +-- .../io/xpipe/app/storage/StandardStorage.java | 3 +-- .../java/io/xpipe/app/test/ExtensionTest.java | 3 +-- .../io/xpipe/app/update/AppDownloads.java | 6 ++--- .../io/xpipe/app/update/UpdateHandler.java | 1 + .../xpipe/app/update/XPipeInstanceHelper.java | 5 ++-- .../io/xpipe/app/util/ApplicationHelper.java | 3 +-- .../io/xpipe/app/util/DefaultSecretValue.java | 3 +-- .../java/io/xpipe/app/util/HttpHelper.java | 3 ++- .../io/xpipe/app/util/LockedSecretValue.java | 3 +-- .../app/util/ProxyManagerProviderImpl.java | 3 +-- .../java/io/xpipe/app/util/ScanAlert.java | 3 +-- .../java/io/xpipe/app/util/ScriptHelper.java | 12 +++------ .../app/util/SecretRetrievalStrategy.java | 12 ++++----- .../util/SecretRetrievalStrategyHelper.java | 3 +-- .../java/io/xpipe/beacon/BeaconServer.java | 4 +-- .../io/xpipe/beacon/SecretProviderImpl.java | 3 +-- .../beacon/exchange/MessageExchange.java | 2 -- .../beacon/exchange/MessageExchanges.java | 3 +-- .../io/xpipe/core/charsetter/Charsetter.java | 3 +-- .../io/xpipe/core/data/node/ArrayNode.java | 1 + .../core/data/node/DataStructureNodeIO.java | 3 +-- .../io/xpipe/core/data/node/TupleNode.java | 1 + .../io/xpipe/core/data/node/ValueNode.java | 1 + .../java/io/xpipe/core/dialog/Dialog.java | 3 +-- .../io/xpipe/core/dialog/DialogReference.java | 2 +- .../xpipe/core/impl/InternalStreamStore.java | 5 ---- .../impl/PeekTableStreamReadConnection.java | 9 ------- .../io/xpipe/core/process/CommandBuilder.java | 2 +- .../io/xpipe/core/process/ShellControl.java | 26 +++---------------- .../java/io/xpipe/core/util/SecretValue.java | 3 +-- .../io/xpipe/core/util/XPipeInstallation.java | 3 +-- .../java/io/xpipe/ext/base/HttpStore.java | 6 ++--- .../ext/base/InternalStreamProvider.java | 10 ------- .../base/SimpleFileDataSourceProvider.java | 3 +-- .../action/DeleteStoreChildrenAction.java | 5 ---- .../ext/base/action/LaunchShortcutAction.java | 4 --- .../io/xpipe/ext/base/browser/BackAction.java | 5 ---- .../ext/base/browser/CopyPathAction.java | 5 ---- .../xpipe/ext/base/browser/ForwardAction.java | 5 ---- .../base/browser/RefreshDirectoryAction.java | 5 ---- .../io/xpipe/ext/csv/CsvReadConnection.java | 3 +-- .../io/xpipe/ext/csv/CsvWriteConnection.java | 5 ++-- .../io/xpipe/ext/pdx/PdxFileProvider.java | 3 +-- .../io/xpipe/ext/pdx/PdxTextFileProvider.java | 3 +-- .../ext/pdx/parser/TextFormatParser.java | 3 +-- 90 files changed, 119 insertions(+), 265 deletions(-) diff --git a/README.md b/README.md index f8af32955..5528c7333 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ The feature set is the same for all supported connection types. It of course als

- + Terminal launcher


diff --git a/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java b/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java index e43af2464..82e4251a5 100644 --- a/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java +++ b/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java @@ -83,8 +83,7 @@ public static DataSource create(DataStoreId id, String type, DataStore store) { .configureAll(false) .build(); var startRes = XPipeApiConnection.execute(con -> { - ReadExchange.Response r = con.performSimpleExchange(startReq); - return r; + return con.performSimpleExchange(startReq); }); var configInstance = startRes.getConfig(); @@ -113,8 +112,7 @@ public static DataSource create(DataStoreId id, String type, InputStream in) { .configureAll(false) .build(); var startRes = XPipeApiConnection.execute(con -> { - ReadExchange.Response r = con.performSimpleExchange(startReq); - return r; + return con.performSimpleExchange(startReq); }); var configInstance = startRes.getConfig(); diff --git a/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java b/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java index 4862964c6..7b06e22f6 100644 --- a/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java +++ b/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java @@ -46,7 +46,7 @@ public ArrayNode read(int maxRows) { @Override public Iterator iterator() { - return new Iterator() { + return new Iterator<>() { @Override public boolean hasNext() { return false; diff --git a/app/build.gradle b/app/build.gradle index 57e2ec8f2..e2613f529 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -83,7 +83,7 @@ dependencies { testImplementation project(':core') } -project.allExtensions.forEach(p -> { +project.allExtensions.forEach((Project p) -> { dependencies { testCompileOnly p } 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 b757351ea..e99f50f13 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserClipboard.java @@ -40,8 +40,7 @@ public static void startCopy(FileSystem.FileEntry base, List resolveIfNeeded(BrowserAction action, List selected) { - var used = action.automaticallyResolveLinks() + return action.automaticallyResolveLinks() ? selected.stream() .map(browserEntry -> new BrowserEntry( browserEntry.getRawFileEntry().resolved(), @@ -93,6 +93,5 @@ private static List resolveIfNeeded(BrowserAction action, List table = createTable(); - return table; + return createTable(); } @SuppressWarnings("unchecked") diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserNavBar.java b/app/src/main/java/io/xpipe/app/browser/BrowserNavBar.java index a5df651d2..9a16b8c1e 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserNavBar.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserNavBar.java @@ -89,10 +89,9 @@ protected Region createSimple() { var graphic = Bindings.createStringBinding( () -> { - var icon = model.getCurrentDirectory() != null + return model.getCurrentDirectory() != null ? FileIconManager.getFileIcon(model.getCurrentDirectory(), false) : "home_icon.svg"; - return icon; }, model.getCurrentPath()); var breadcrumbsGraphic = new PrettyImageComp(graphic, 22, 22) 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 fb388b0c9..38546dd3c 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserOverviewComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserOverviewComp.java @@ -33,10 +33,9 @@ protected Region createSimple() { .map(s -> FileSystem.FileEntry.ofDirectory(model.getFileSystem(), s)) .filter(entry -> { try { - var b = sc.getShellDialect() + return sc.getShellDialect() .directoryExists(sc, entry.getPath()) .executeAndCheck(); - return b; } catch (Exception e) { ErrorEvent.fromThrowable(e).handle(); return false; diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserSavedState.java b/app/src/main/java/io/xpipe/app/browser/BrowserSavedState.java index b2b426119..7547f35f2 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserSavedState.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserSavedState.java @@ -17,10 +17,9 @@ public class BrowserSavedState { static BrowserSavedState load() { - BrowserSavedState state = AppCache.get("browser-state", BrowserSavedState.class, () -> { + return AppCache.get("browser-state", BrowserSavedState.class, () -> { return null; }); - return state; } @Value diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserSelectionListComp.java b/app/src/main/java/io/xpipe/app/browser/BrowserSelectionListComp.java index 892a6bbcd..9df516a6c 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserSelectionListComp.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserSelectionListComp.java @@ -40,8 +40,7 @@ public static Image snapshot(ObservableList list) { AppStyle.addStylesheets(scene); SnapshotParameters parameters = new SnapshotParameters(); parameters.setFill(Color.TRANSPARENT); - WritableImage image = r.snapshot(parameters, null); - return image; + return r.snapshot(parameters, null); } ObservableList list; diff --git a/app/src/main/java/io/xpipe/app/comp/DeveloperTabComp.java b/app/src/main/java/io/xpipe/app/comp/DeveloperTabComp.java index 4b0786d01..0cd955ac9 100644 --- a/app/src/main/java/io/xpipe/app/comp/DeveloperTabComp.java +++ b/app/src/main/java/io/xpipe/app/comp/DeveloperTabComp.java @@ -43,12 +43,11 @@ protected Region createSimple() { var button5 = new ButtonComp(AppI18n.observable("Operation mode null"), null, OperationMode::close); - var box = new HBox( + return new HBox( button.createRegion(), button2.createRegion(), button3.createRegion(), button4.createRegion(), button5.createRegion()); - return box; } } diff --git a/app/src/main/java/io/xpipe/app/comp/base/CountComp.java b/app/src/main/java/io/xpipe/app/comp/base/CountComp.java index 542332476..a420bd804 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/CountComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/CountComp.java @@ -31,7 +31,7 @@ public CompStructure