From 12235152c91bfa091e518e30a46c82d996bf4fd8 Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 9 Feb 2023 21:30:07 +0000 Subject: [PATCH] Reformat --- README.md | 1 + .../api/connector/XPipeApiConnection.java | 19 +++-- .../java/io/xpipe/api/impl/DataRawImpl.java | 5 +- .../io/xpipe/api/impl/DataSourceImpl.java | 3 +- .../io/xpipe/api/impl/DataStructureImpl.java | 5 +- .../api/impl/DataTableAccumulatorImpl.java | 9 ++- .../java/io/xpipe/api/impl/DataTableImpl.java | 7 +- .../java/io/xpipe/api/impl/DataTextImpl.java | 5 +- .../java/io/xpipe/app/comp/AppLayoutComp.java | 6 +- .../app/comp/about/BrowseDirectoryComp.java | 10 ++- .../app/comp/about/ThirdPartyDependency.java | 3 +- .../xpipe/app/comp/about/UpdateCheckComp.java | 2 +- .../app/comp/base/IntegratedTextAreaComp.java | 31 ++++---- .../xpipe/app/comp/base/ListBoxViewComp.java | 3 +- .../source/DataSourceTargetChoiceComp.java | 15 ++-- .../app/comp/source/DsDataTransferComp.java | 30 +++---- .../app/comp/source/DsStorageTargetComp.java | 4 +- .../comp/source/GuiDsCreatorMultiStep.java | 20 +++-- .../comp/source/GuiDsCreatorTransferStep.java | 3 +- .../app/comp/source/GuiDsStoreSelectStep.java | 3 +- .../source/store/DsStreamStoreChoiceComp.java | 23 ++++-- .../collection/SourceCollectionViewState.java | 3 +- .../storage/store/StoreEntryListComp.java | 14 ++-- .../comp/storage/store/StoreEntryWrapper.java | 9 ++- .../comp/storage/store/StoreViewState.java | 3 +- app/src/main/java/io/xpipe/app/core/App.java | 15 ++-- .../xpipe/app/core/AppActionLinkDetector.java | 17 ++-- .../java/io/xpipe/app/core/AppChecks.java | 10 ++- .../main/java/io/xpipe/app/core/AppFont.java | 3 +- .../main/java/io/xpipe/app/core/AppI18n.java | 11 ++- .../main/java/io/xpipe/app/core/AppLogs.java | 2 + .../java/io/xpipe/app/core/AppProperties.java | 6 +- .../io/xpipe/app/core/AppWindowHelper.java | 4 +- .../java/io/xpipe/app/core/mode/BaseMode.java | 4 +- .../java/io/xpipe/app/core/mode/GuiMode.java | 2 +- .../io/xpipe/app/core/mode/OperationMode.java | 6 +- .../io/xpipe/app/core/mode/PlatformMode.java | 3 +- .../app/exchange/cli/ModeExchangeImpl.java | 7 +- .../io/xpipe/app/issue/AttachmentHelper.java | 6 +- .../xpipe/app/issue/SentryErrorHandler.java | 2 +- .../io/xpipe/app/issue/UserReportComp.java | 14 ++-- .../xpipe/app/launcher/LauncherCommand.java | 8 +- .../io/xpipe/app/launcher/LauncherInput.java | 6 +- .../java/io/xpipe/app/prefs/AppPrefs.java | 39 +++------ .../io/xpipe/app/prefs/CloseBehaviour.java | 24 +++--- .../app/prefs/ExternalApplicationType.java | 6 +- .../java/io/xpipe/app/prefs/PrefFields.java | 5 +- .../io/xpipe/app/prefs/SupportedLocale.java | 2 +- .../io/xpipe/app/storage/DataSourceEntry.java | 28 ++++--- .../io/xpipe/app/storage/DataStorage.java | 4 +- .../xpipe/app/storage/DataStorageWriter.java | 6 +- .../io/xpipe/app/update/AppInstaller.java | 13 ++- .../java/io/xpipe/app/update/AppUpdater.java | 2 +- .../app/update/UpdateAvailableAlert.java | 7 +- .../io/xpipe/app/util/ExternalEditor.java | 29 +++---- .../app/util/ProxyManagerProviderImpl.java | 3 +- .../io/xpipe/app/util/TerminalProvider.java | 6 +- .../xpipe/app/util/XPipeDaemonProvider.java | 5 +- app/src/main/java/module-info.java | 3 +- .../java/io/xpipe/beacon/BeaconClient.java | 6 +- .../io/xpipe/beacon/BeaconConnection.java | 17 ++-- .../xpipe/beacon/BeaconDaemonController.java | 17 ++-- .../java/io/xpipe/beacon/BeaconException.java | 3 +- .../io/xpipe/beacon/BeaconJacksonModule.java | 3 +- .../java/io/xpipe/beacon/BeaconProxyImpl.java | 17 ++-- .../java/io/xpipe/beacon/BeaconServer.java | 18 ++--- .../java/io/xpipe/beacon/ClientException.java | 3 +- .../io/xpipe/beacon/ConnectorException.java | 3 +- .../java/io/xpipe/beacon/RequestMessage.java | 3 +- .../java/io/xpipe/beacon/ResponseMessage.java | 3 +- .../io/xpipe/beacon/SecretProviderImpl.java | 1 - .../java/io/xpipe/beacon/ServerException.java | 3 +- .../xpipe/beacon/exchange/FocusExchange.java | 3 +- .../beacon/exchange/ForwardExchange.java | 3 +- .../xpipe/beacon/exchange/OpenExchange.java | 6 +- .../exchange/ProxyFunctionExchange.java | 20 +---- .../exchange/ProxyReadConnectionExchange.java | 6 +- .../ProxyWriteConnectionExchange.java | 10 ++- .../exchange/QueryDataSourceExchange.java | 3 +- .../beacon/exchange/ReadStreamExchange.java | 6 +- .../xpipe/beacon/exchange/StopExchange.java | 3 +- .../beacon/exchange/WriteStreamExchange.java | 6 +- .../exchange/api/QueryRawDataExchange.java | 3 +- .../exchange/api/QueryTableDataExchange.java | 3 +- .../exchange/api/QueryTextDataExchange.java | 3 +- .../beacon/exchange/cli/InstanceExchange.java | 3 +- .../exchange/cli/ListCollectionsExchange.java | 3 +- .../exchange/cli/ListStoresExchange.java | 3 +- .../exchange/cli/ReadDrainExchange.java | 3 +- .../cli/RemoveCollectionExchange.java | 3 +- .../exchange/cli/RemoveStoreExchange.java | 3 +- .../cli/RenameCollectionExchange.java | 3 +- .../exchange/cli/RenameEntryExchange.java | 3 +- .../exchange/cli/RenameStoreExchange.java | 3 +- .../beacon/exchange/cli/SelectExchange.java | 3 +- .../cli/SourceProviderListExchange.java | 3 +- .../beacon/exchange/cli/StatusExchange.java | 3 +- .../cli/StoreProviderListExchange.java | 3 +- .../beacon/exchange/cli/VersionExchange.java | 3 +- .../xpipe/beacon/util/QuietDialogHandler.java | 7 +- beacon/src/main/java/module-info.java | 11 ++- .../io/xpipe/core/charsetter/Charsetter.java | 10 +-- .../xpipe/core/charsetter/StreamCharset.java | 79 ++++++------------- .../core/data/generic/GenericArrayReader.java | 3 +- .../generic/GenericDataStreamCallback.java | 18 ++--- .../core/data/generic/GenericTupleReader.java | 3 +- .../io/xpipe/core/data/node/ArrayNode.java | 4 +- .../core/data/node/DataStructureNode.java | 17 ++-- .../data/node/DataStructureNodePointer.java | 3 +- .../xpipe/core/data/node/LinkedTupleNode.java | 3 +- .../io/xpipe/core/data/node/TupleNode.java | 5 +- .../io/xpipe/core/data/node/ValueNode.java | 6 +- .../io/xpipe/core/data/type/DataType.java | 5 +- .../xpipe/core/data/type/DataTypeVisitor.java | 12 +-- .../core/data/type/DataTypeVisitors.java | 3 +- .../io/xpipe/core/data/type/TupleType.java | 4 +- .../io/xpipe/core/data/type/WildcardType.java | 3 +- .../data/typed/TypedDataStreamCallback.java | 24 ++---- .../xpipe/core/dialog/BaseQueryElement.java | 3 +- .../java/io/xpipe/core/dialog/Dialog.java | 29 ++++--- .../core/dialog/DialogCancelException.java | 6 +- .../io/xpipe/core/dialog/DialogElement.java | 5 +- .../io/xpipe/core/dialog/DialogMapper.java | 3 +- .../io/xpipe/core/dialog/QueryElement.java | 3 +- .../java/io/xpipe/core/impl/LocalStore.java | 1 - .../core/impl/PreservingWriteConnection.java | 5 +- .../core/impl/SimpleTableWriteConnection.java | 1 - .../io/xpipe/core/impl/SinkDrainStore.java | 7 +- .../io/xpipe/core/impl/StdinDataStore.java | 3 +- .../io/xpipe/core/impl/StdoutDataStore.java | 3 +- .../xpipe/core/impl/XpbtReadConnection.java | 3 +- .../xpipe/core/impl/XpbtWriteConnection.java | 2 +- .../core/process/CommandProcessControl.java | 1 + .../java/io/xpipe/core/process/OsType.java | 11 ++- .../core/process/ProcessControlProvider.java | 35 +++++--- .../core/process/ProcessOutputException.java | 3 +- .../core/process/ShellProcessControl.java | 4 +- .../java/io/xpipe/core/process/ShellType.java | 13 +-- .../io/xpipe/core/process/ShellTypes.java | 16 ++-- .../java/io/xpipe/core/source/DataSource.java | 7 +- .../core/source/DataSourceConnection.java | 6 +- .../core/source/TableReadConnection.java | 3 +- .../java/io/xpipe/core/source/WriteMode.java | 13 ++- .../java/io/xpipe/core/store/DataStore.java | 11 +-- .../io/xpipe/core/store/MachineStore.java | 6 +- .../java/io/xpipe/core/store/ShellStore.java | 7 +- .../io/xpipe/core/util/CoreJacksonModule.java | 11 +-- .../java/io/xpipe/core/util/Deobfuscator.java | 4 +- .../java/io/xpipe/core/util/Identifiers.java | 6 +- .../io/xpipe/core/util/JacksonMapper.java | 14 ++-- .../io/xpipe/core/util/JacksonizedValue.java | 8 +- .../io/xpipe/core/util/ProxyProvider.java | 6 +- .../io/xpipe/core/util/SecretProvider.java | 4 +- .../xpipe/core/util/SimpleProxyFunction.java | 1 - .../java/io/xpipe/core/util/UuidHelper.java | 2 +- .../xpipe/core/util/ValidationException.java | 3 +- .../io/xpipe/core/util/XPipeInstallation.java | 4 +- .../xpipe/core/util/XPipeTempDirectory.java | 4 +- core/src/main/java/module-info.java | 5 +- .../io/xpipe/core/test/DataSourceIdTest.java | 13 +-- .../core/test/DataSourceReferenceTest.java | 8 +- .../java/io/xpipe/ext/base/HttpStore.java | 16 ++-- .../ext/base/actions/AddStoreAction.java | 1 + .../ext/base/actions/FileEditAction.java | 7 +- .../ext/base/actions/ShareStoreAction.java | 1 - .../ext/base/actions/StreamExportAction.java | 2 - .../ext/base/apps/CommandLineTarget.java | 2 +- .../ext/base/apps/DataSourceOutputTarget.java | 2 +- .../io/xpipe/ext/base/apps/JavaTarget.java | 2 +- .../ext/base/apps/RawFileOutputTarget.java | 2 +- ext/base/src/main/java/module-info.java | 5 +- .../java/io/xpipe/ext/csv/CsvDelimiter.java | 3 +- .../java/io/xpipe/ext/csv/CsvDetector.java | 4 +- .../xpipe/ext/csv/test/CsvDetectorTest.java | 10 +-- .../jackson/json_table/JsonTableProvider.java | 2 +- .../jackson/xml_table/XmlTableProvider.java | 2 +- .../io/xpipe/ext/pdx/PdxTextFileProvider.java | 2 +- .../ext/pdx/parser/TextFormatParser.java | 14 +--- .../io/xpipe/ext/proc/CommandControlImpl.java | 10 ++- .../ext/proc/LocalCommandControlImpl.java | 4 +- .../xpipe/ext/proc/LocalShellControlImpl.java | 5 +- .../java/io/xpipe/ext/proc/ProcProvider.java | 12 +-- .../io/xpipe/ext/proc/ShellControlImpl.java | 3 +- .../proc/action/InstallConnectorAction.java | 4 +- .../xpipe/ext/proc/action/LaunchAction.java | 6 +- .../ext/proc/action/LaunchShortcutAction.java | 1 - .../ext/proc/augment/CommandAugmentation.java | 3 +- .../proc/augment/SshCommandAugmentation.java | 4 +- .../ext/proc/store/DockerStoreProvider.java | 5 +- .../ext/proc/store/ShellCommandStore.java | 1 + .../proc/store/ShellCommandStoreProvider.java | 5 +- .../ext/proc/store/ShellEnvironmentStore.java | 5 +- .../io/xpipe/ext/proc/store/SshStore.java | 1 + .../ext/proc/store/SshStoreProvider.java | 9 +-- .../ext/proc/store/WslStoreProvider.java | 5 +- ext/proc/src/main/java/module-info.java | 7 +- ext/proc/src/test/java/test/CommandTests.java | 6 +- .../java/test/item/ShellCheckTestItem.java | 25 ++++-- .../test/java/test/item/ShellTestItem.java | 3 +- .../xpipe/extension/DataSourceProvider.java | 3 +- .../xpipe/extension/DataSourceProviders.java | 7 +- .../io/xpipe/extension/DataSourceTarget.java | 6 +- .../io/xpipe/extension/DataStoreProvider.java | 3 +- .../xpipe/extension/DataStoreProviders.java | 5 +- .../extension/DownloadModuleInstall.java | 5 +- .../xpipe/extension/ExtensionException.java | 3 +- .../io/xpipe/extension/ModuleInstall.java | 1 + .../io/xpipe/extension/event/ErrorEvent.java | 4 + .../xpipe/extension/event/EventHandler.java | 14 +--- .../io/xpipe/extension/event/TrackEvent.java | 21 +++-- .../java/io/xpipe/extension/fxcomps/Comp.java | 3 +- .../fxcomps/augment/GrowAugment.java | 6 +- .../fxcomps/impl/CharChoiceComp.java | 3 +- .../fxcomps/impl/CharsetChoiceComp.java | 5 +- .../extension/fxcomps/impl/ChoiceComp.java | 5 +- .../fxcomps/impl/ChoicePaneComp.java | 8 +- .../extension/fxcomps/impl/CodeSnippet.java | 6 +- .../fxcomps/impl/CodeSnippetComp.java | 6 +- .../fxcomps/impl/DynamicOptionsComp.java | 9 +-- .../fxcomps/impl/FancyTooltipAugment.java | 18 +++-- .../fxcomps/impl/FileStoreChoiceComp.java | 16 ++-- .../extension/fxcomps/impl/FilterComp.java | 3 +- .../extension/fxcomps/impl/IntFieldComp.java | 5 +- .../fxcomps/impl/PrettyImageComp.java | 16 ++-- .../fxcomps/impl/ShellStoreChoiceComp.java | 4 +- .../xpipe/extension/fxcomps/impl/SvgComp.java | 6 +- .../extension/fxcomps/impl/TabPaneComp.java | 3 +- .../extension/fxcomps/impl/TextFieldComp.java | 3 +- .../fxcomps/impl/ToggleGroupComp.java | 5 +- .../fxcomps/impl/WriteModeChoiceComp.java | 3 +- .../fxcomps/util/BindingsHelper.java | 23 +++--- .../extension/prefs/PrefsChoiceValue.java | 4 +- .../xpipe/extension/prefs/PrefsProvider.java | 5 +- .../xpipe/extension/test/ExtensionTest.java | 3 +- .../xpipe/extension/util/ActionProvider.java | 1 - .../extension/util/ApplicationHelper.java | 14 +++- .../extension/util/ChainedValidator.java | 3 +- .../extension/util/CustomComboBoxBuilder.java | 11 ++- .../extension/util/DataStoreFormatter.java | 6 +- .../xpipe/extension/util/DataTypeParser.java | 8 +- .../extension/util/DynamicOptionsBuilder.java | 43 +++++----- .../extension/util/ExclusiveValidator.java | 3 +- .../io/xpipe/extension/util/HttpHelper.java | 3 +- .../xpipe/extension/util/PrettyListView.java | 39 +++------ .../io/xpipe/extension/util/ScriptHelper.java | 3 +- .../xpipe/extension/util/SimpleValidator.java | 3 +- .../io/xpipe/extension/util/Validators.java | 3 +- .../xpipe/extension/util/WindowsRegistry.java | 3 +- .../io/xpipe/extension/util/XPipeDaemon.java | 12 +-- extension/src/main/java/module-info.java | 5 +- 250 files changed, 872 insertions(+), 1010 deletions(-) diff --git a/README.md b/README.md index b5abc3f0..275e2f7c 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ The license model is chosen in such a way that you are able to use and integrate X-Pipe within your application through the MIT-licensed API. In any other case where you plan to contribute to the X-Pipe platform itself, which is GPL licensed, I would still have to figure out how to exactly handle these kinds of contributions. +It is also planned to move many components to a more permissive license in the future. ## Development diff --git a/api/src/main/java/io/xpipe/api/connector/XPipeApiConnection.java b/api/src/main/java/io/xpipe/api/connector/XPipeApiConnection.java index 1e07a5e7..d43c5ab4 100644 --- a/api/src/main/java/io/xpipe/api/connector/XPipeApiConnection.java +++ b/api/src/main/java/io/xpipe/api/connector/XPipeApiConnection.java @@ -13,8 +13,7 @@ import java.util.Optional; public final class XPipeApiConnection extends BeaconConnection { - private XPipeApiConnection() { - } + private XPipeApiConnection() {} public static XPipeApiConnection open() { var con = new XPipeApiConnection(); @@ -32,8 +31,8 @@ public final class XPipeApiConnection extends BeaconConnection { } DialogExchange.Response response = con.performSimpleExchange(DialogExchange.Request.builder() - .dialogKey(reference.getDialogId()) - .build()); + .dialogKey(reference.getDialogId()) + .build()); element = response.getElement(); if (response.getElement() == null) { break; @@ -80,9 +79,9 @@ public final class XPipeApiConnection extends BeaconConnection { } var s = BeaconClient.tryConnect(BeaconClient.ApiClientInformation.builder() - .version("?") - .language("Java") - .build()); + .version("?") + .language("Java") + .build()); if (s.isPresent()) { return s; } @@ -124,9 +123,9 @@ public final class XPipeApiConnection extends BeaconConnection { try { beaconClient = BeaconClient.connect(BeaconClient.ApiClientInformation.builder() - .version("?") - .language("Java") - .build()); + .version("?") + .language("Java") + .build()); } catch (Exception ex) { throw new BeaconException("Unable to connect to running xpipe daemon", ex); } diff --git a/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java b/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java index 6d731829..d9059ee0 100644 --- a/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java +++ b/api/src/main/java/io/xpipe/api/impl/DataRawImpl.java @@ -10,10 +10,7 @@ import java.io.InputStream; public class DataRawImpl extends DataSourceImpl implements DataRaw { public DataRawImpl( - DataSourceId sourceId, - DataSourceConfig sourceConfig, - io.xpipe.core.source.DataSource internalSource - ) { + DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource internalSource) { super(sourceId, sourceConfig, internalSource); } 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 aac6eb32..4d3b904b 100644 --- a/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java +++ b/api/src/main/java/io/xpipe/api/impl/DataSourceImpl.java @@ -18,8 +18,7 @@ public abstract class DataSourceImpl implements DataSource { private final io.xpipe.core.source.DataSource internalSource; public DataSourceImpl( - DataSourceId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource internalSource - ) { + DataSourceId sourceId, DataSourceConfig config, io.xpipe.core.source.DataSource internalSource) { this.sourceId = sourceId; this.config = config; this.internalSource = internalSource; diff --git a/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java b/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java index 2f692179..d21a37e1 100644 --- a/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java +++ b/api/src/main/java/io/xpipe/api/impl/DataStructureImpl.java @@ -9,10 +9,7 @@ import io.xpipe.core.source.DataSourceType; public class DataStructureImpl extends DataSourceImpl implements DataStructure { DataStructureImpl( - DataSourceId sourceId, - DataSourceConfig sourceConfig, - io.xpipe.core.source.DataSource internalSource - ) { + DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource internalSource) { super(sourceId, sourceConfig, internalSource); } diff --git a/api/src/main/java/io/xpipe/api/impl/DataTableAccumulatorImpl.java b/api/src/main/java/io/xpipe/api/impl/DataTableAccumulatorImpl.java index 0dee378a..3591fba6 100644 --- a/api/src/main/java/io/xpipe/api/impl/DataTableAccumulatorImpl.java +++ b/api/src/main/java/io/xpipe/api/impl/DataTableAccumulatorImpl.java @@ -37,11 +37,16 @@ public class DataTableAccumulatorImpl implements DataTableAccumulator { connection = XPipeApiConnection.open(); store = new InternalStreamStore(); - var addReq = StoreAddExchange.Request.builder().storeInput(store).name(store.getUuid().toString()).build(); + var addReq = StoreAddExchange.Request.builder() + .storeInput(store) + .name(store.getUuid().toString()) + .build(); StoreAddExchange.Response addRes = connection.performSimpleExchange(addReq); QuietDialogHandler.handle(addRes.getConfig(), connection); - connection.sendRequest(WriteStreamExchange.Request.builder().name(store.getUuid().toString()).build()); + connection.sendRequest(WriteStreamExchange.Request.builder() + .name(store.getUuid().toString()) + .build()); bodyOutput = connection.sendBody(); } 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 536b7b35..465c8fd8 100644 --- a/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java +++ b/api/src/main/java/io/xpipe/api/impl/DataTableImpl.java @@ -24,11 +24,7 @@ import java.util.stream.StreamSupport; public class DataTableImpl extends DataSourceImpl implements DataTable { - DataTableImpl( - DataSourceId id, - DataSourceConfig sourceConfig, - io.xpipe.core.source.DataSource internalSource - ) { + DataTableImpl(DataSourceId id, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource internalSource) { super(id, sourceConfig, internalSource); } @@ -74,7 +70,6 @@ public class DataTableImpl extends DataSourceImpl implements DataTable { public Iterator iterator() { return new TableIterator(); } - ; private class TableIterator implements Iterator { diff --git a/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java b/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java index 17a8b22c..f272c7dd 100644 --- a/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java +++ b/api/src/main/java/io/xpipe/api/impl/DataTextImpl.java @@ -25,10 +25,7 @@ import java.util.stream.StreamSupport; public class DataTextImpl extends DataSourceImpl implements DataText { DataTextImpl( - DataSourceId sourceId, - DataSourceConfig sourceConfig, - io.xpipe.core.source.DataSource internalSource - ) { + DataSourceId sourceId, DataSourceConfig sourceConfig, io.xpipe.core.source.DataSource internalSource) { super(sourceId, sourceConfig, internalSource); } diff --git a/app/src/main/java/io/xpipe/app/comp/AppLayoutComp.java b/app/src/main/java/io/xpipe/app/comp/AppLayoutComp.java index 1c65ee96..b7b17767 100644 --- a/app/src/main/java/io/xpipe/app/comp/AppLayoutComp.java +++ b/app/src/main/java/io/xpipe/app/comp/AppLayoutComp.java @@ -42,8 +42,7 @@ public class AppLayoutComp extends Comp> { private List createEntryList() { var l = new ArrayList<>(List.of( - new SideMenuBarComp.Entry( - I18n.observable("connections"), "mdi2c-connection", new StoreLayoutComp()), + new SideMenuBarComp.Entry(I18n.observable("connections"), "mdi2c-connection", new StoreLayoutComp()), new SideMenuBarComp.Entry(I18n.observable("data"), "mdsal-dvr", new SourceCollectionLayoutComp()), new SideMenuBarComp.Entry( I18n.observable("settings"), "mdsmz-miscellaneous_services", new PrefsComp(this)), @@ -52,7 +51,8 @@ public class AppLayoutComp extends Comp> { // new SideMenuBarComp.Entry(I18n.observable("account"), "mdi2a-account", new StorageLayoutComp()), new SideMenuBarComp.Entry(I18n.observable("about"), "mdi2p-package-variant", new AboutTabComp()))); if (AppProperties.get().isDeveloperMode()) { - // l.add(new SideMenuBarComp.Entry(I18n.observable("developer"), "mdi2b-book-open-variant", new DeveloperTabComp())); + // l.add(new SideMenuBarComp.Entry(I18n.observable("developer"), "mdi2b-book-open-variant", new + // DeveloperTabComp())); } // l.add(new SideMenuBarComp.Entry(I18n.observable("abc"), "mdi2b-book-open-variant", Comp.of(() -> { // var fi = new FontIcon("mdsal-dvr"); diff --git a/app/src/main/java/io/xpipe/app/comp/about/BrowseDirectoryComp.java b/app/src/main/java/io/xpipe/app/comp/about/BrowseDirectoryComp.java index 232de11e..a340c9e7 100644 --- a/app/src/main/java/io/xpipe/app/comp/about/BrowseDirectoryComp.java +++ b/app/src/main/java/io/xpipe/app/comp/about/BrowseDirectoryComp.java @@ -2,14 +2,14 @@ package io.xpipe.app.comp.about; import io.xpipe.app.comp.base.ButtonComp; import io.xpipe.app.core.AppLogs; -import io.xpipe.app.util.ExternalEditor; import io.xpipe.app.issue.UserReportComp; +import io.xpipe.app.util.ExternalEditor; import io.xpipe.core.util.XPipeInstallation; import io.xpipe.extension.I18n; import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.fxcomps.SimpleComp; -import io.xpipe.extension.util.DynamicOptionsBuilder; import io.xpipe.extension.util.DesktopHelper; +import io.xpipe.extension.util.DynamicOptionsBuilder; import javafx.scene.layout.Region; public class BrowseDirectoryComp extends SimpleComp { @@ -30,7 +30,11 @@ public class BrowseDirectoryComp extends SimpleComp { .addComp( "logFile", new ButtonComp(I18n.observable("openCurrentLogFile"), () -> { - ExternalEditor.get().openInEditor(AppLogs.get().getSessionLogsDirectory().resolve("xpipe.log").toString()); + ExternalEditor.get() + .openInEditor(AppLogs.get() + .getSessionLogsDirectory() + .resolve("xpipe.log") + .toString()); }), null) .addComp( diff --git a/app/src/main/java/io/xpipe/app/comp/about/ThirdPartyDependency.java b/app/src/main/java/io/xpipe/app/comp/about/ThirdPartyDependency.java index 8b824e17..18e0e82f 100644 --- a/app/src/main/java/io/xpipe/app/comp/about/ThirdPartyDependency.java +++ b/app/src/main/java/io/xpipe/app/comp/about/ThirdPartyDependency.java @@ -22,8 +22,7 @@ public record ThirdPartyDependency(String name, String version, String licenseNa } try (var list = Files.list(path)) { - for (var p : list - .filter(p -> p.getFileName().toString().endsWith(".properties")) + for (var p : list.filter(p -> p.getFileName().toString().endsWith(".properties")) .sorted(Comparator.comparing(path1 -> path1.toString())) .toList()) { var props = new Properties(); diff --git a/app/src/main/java/io/xpipe/app/comp/about/UpdateCheckComp.java b/app/src/main/java/io/xpipe/app/comp/about/UpdateCheckComp.java index a9989b6a..0840f3b2 100644 --- a/app/src/main/java/io/xpipe/app/comp/about/UpdateCheckComp.java +++ b/app/src/main/java/io/xpipe/app/comp/about/UpdateCheckComp.java @@ -1,12 +1,12 @@ package io.xpipe.app.comp.about; -import io.xpipe.extension.util.XPipeDistributionType; import io.xpipe.app.core.AppI18n; import io.xpipe.app.update.AppUpdater; import io.xpipe.app.util.Hyperlinks; import io.xpipe.extension.I18n; import io.xpipe.extension.fxcomps.SimpleComp; import io.xpipe.extension.fxcomps.util.PlatformThread; +import io.xpipe.extension.util.XPipeDistributionType; import javafx.beans.binding.Bindings; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableBooleanValue; diff --git a/app/src/main/java/io/xpipe/app/comp/base/IntegratedTextAreaComp.java b/app/src/main/java/io/xpipe/app/comp/base/IntegratedTextAreaComp.java index 7c248410..fcf9f130 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/IntegratedTextAreaComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/IntegratedTextAreaComp.java @@ -29,26 +29,29 @@ public class IntegratedTextAreaComp extends SimpleComp { @Override protected Region createSimple() { - var fileDrop = new FileDropOverlayComp<>(Comp.of(() -> { - var textArea = new TextAreaComp(value, lazy).createRegion(); - var copyButton = createOpenButton(textArea); - var pane = new AnchorPane(copyButton); - pane.setPickOnBounds(false); - AnchorPane.setTopAnchor(copyButton, 10.0); - AnchorPane.setRightAnchor(copyButton, 10.0); + var fileDrop = new FileDropOverlayComp<>( + Comp.of(() -> { + var textArea = new TextAreaComp(value, lazy).createRegion(); + var copyButton = createOpenButton(textArea); + var pane = new AnchorPane(copyButton); + pane.setPickOnBounds(false); + AnchorPane.setTopAnchor(copyButton, 10.0); + AnchorPane.setRightAnchor(copyButton, 10.0); - var c = new StackPane(); - c.getChildren().addAll(textArea, pane); - return c; - }), paths -> value.setValue(Files.readString(paths.get(0)))); + var c = new StackPane(); + c.getChildren().addAll(textArea, pane); + return c; + }), + paths -> value.setValue(Files.readString(paths.get(0)))); return fileDrop.createRegion(); } private Region createOpenButton(Region container) { var button = new IconButtonComp("mdal-edit", () -> ExternalEditor.get() - .startEditing(identifier, fileType, this, value.getValue(), (s) -> { - Platform.runLater(() -> value.setValue(s)); - })).createRegion(); + .startEditing(identifier, fileType, this, value.getValue(), (s) -> { + Platform.runLater(() -> value.setValue(s)); + })) + .createRegion(); return button; } } diff --git a/app/src/main/java/io/xpipe/app/comp/base/ListBoxViewComp.java b/app/src/main/java/io/xpipe/app/comp/base/ListBoxViewComp.java index 71fa50c9..fa778542 100644 --- a/app/src/main/java/io/xpipe/app/comp/base/ListBoxViewComp.java +++ b/app/src/main/java/io/xpipe/app/comp/base/ListBoxViewComp.java @@ -22,8 +22,7 @@ public class ListBoxViewComp extends Comp> { private final ObservableList all; private final Function> compFunction; - public ListBoxViewComp( - ObservableList shown, ObservableList all, Function> compFunction) { + public ListBoxViewComp(ObservableList shown, ObservableList all, Function> compFunction) { this.shown = PlatformThread.sync(shown); this.all = PlatformThread.sync(all); this.compFunction = compFunction; diff --git a/app/src/main/java/io/xpipe/app/comp/source/DataSourceTargetChoiceComp.java b/app/src/main/java/io/xpipe/app/comp/source/DataSourceTargetChoiceComp.java index 1897c9ff..47c490d7 100644 --- a/app/src/main/java/io/xpipe/app/comp/source/DataSourceTargetChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/comp/source/DataSourceTargetChoiceComp.java @@ -23,28 +23,23 @@ public class DataSourceTargetChoiceComp extends Comp selectedApplication; private final List all; - private DataSourceTargetChoiceComp( - Property selectedApplication, List all) { + private DataSourceTargetChoiceComp(Property selectedApplication, List all) { this.selectedApplication = selectedApplication; this.all = all; } public static DataSourceTargetChoiceComp create( - Property selectedApplication, - Predicate filter) { + Property selectedApplication, Predicate filter) { selectedApplication.addListener((observable, oldValue, val) -> { AppCache.update("application-last-used", val != null ? val.getId() : null); }); - var all = DataSourceTarget.getAll().stream() - .filter((p) -> filter.test(p)) - .toList(); + var all = + DataSourceTarget.getAll().stream().filter((p) -> filter.test(p)).toList(); if (selectedApplication.getValue() == null) { String selectedId = AppCache.get("application-last-used", String.class, () -> null); var selectedProvider = selectedId != null - ? DataSourceTarget.byId(selectedId) - .filter(filter) - .orElse(null) + ? DataSourceTarget.byId(selectedId).filter(filter).orElse(null) : null; selectedApplication.setValue(selectedProvider); } diff --git a/app/src/main/java/io/xpipe/app/comp/source/DsDataTransferComp.java b/app/src/main/java/io/xpipe/app/comp/source/DsDataTransferComp.java index 48ec7b12..44998b06 100644 --- a/app/src/main/java/io/xpipe/app/comp/source/DsDataTransferComp.java +++ b/app/src/main/java/io/xpipe/app/comp/source/DsDataTransferComp.java @@ -8,8 +8,8 @@ import io.xpipe.app.storage.DataSourceEntry; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.util.Hyperlinks; import io.xpipe.core.source.DataSourceId; -import io.xpipe.extension.I18n; import io.xpipe.extension.DataSourceTarget; +import io.xpipe.extension.I18n; import io.xpipe.extension.fxcomps.Comp; import io.xpipe.extension.fxcomps.CompStructure; import io.xpipe.extension.fxcomps.SimpleComp; @@ -65,7 +65,9 @@ public class DsDataTransferComp extends SimpleComp { AppWindowHelper.sideWindow( I18n.get("pipeDataSource"), window -> { - var ms = new DsDataTransferComp(new SimpleObjectProperty<>(e)).exclude(DataSourceTarget.byId("base.saveSource").orElseThrow()); + var ms = new DsDataTransferComp(new SimpleObjectProperty<>(e)) + .exclude(DataSourceTarget.byId("base.saveSource") + .orElseThrow()); var multi = new MultiStepComp() { @Override protected List setup() { @@ -111,9 +113,7 @@ public class DsDataTransferComp extends SimpleComp { }; return multi.apply(s -> { SimpleChangeListener.apply(ms.getSelectedTarget(), (c) -> { - if (c != null - && c.getAccessType() - == DataSourceTarget.AccessType.PASSIVE) { + if (c != null && c.getAccessType() == DataSourceTarget.AccessType.PASSIVE) { ((Region) s.get().getChildren().get(2)).setMaxHeight(0); ((Region) s.get().getChildren().get(2)).setMinHeight(0); ((Region) s.get().getChildren().get(2)).setVisible(false); @@ -149,8 +149,9 @@ public class DsDataTransferComp extends SimpleComp { var chooser = DataSourceTargetChoiceComp.create( selectedTarget, - a -> !excludedTargets.contains(a) && a.isApplicable(dataSourceEntry.getValue().getSource()) && - a.createRetrievalInstructions( + a -> !excludedTargets.contains(a) + && a.isApplicable(dataSourceEntry.getValue().getSource()) + && a.createRetrievalInstructions( dataSourceEntry.getValue().getSource(), id) != null); @@ -165,11 +166,9 @@ public class DsDataTransferComp extends SimpleComp { return selectedTarget.getValue() != null && selectedTarget.getValue().getSetupGuideURL() != null; }, - selectedTarget - ))); + selectedTarget))); var top = new HorizontalComp(List.>of( - chooser.apply(struc -> HBox.setHgrow(struc.get(), Priority.ALWAYS)), - setupGuideButton)) + chooser.apply(struc -> HBox.setHgrow(struc.get(), Priority.ALWAYS)), setupGuideButton)) .apply(struc -> { struc.get().setAlignment(Pos.CENTER); struc.get().setSpacing(12); @@ -179,9 +178,7 @@ public class DsDataTransferComp extends SimpleComp { // setupGuideButton.prefHeightProperty().bind(chooserR.heightProperty()); var content = new VBox( - new DynamicOptionsComp( - List.of(new DynamicOptionsComp.Entry(null, null, top)), false) - .createRegion(), + new DynamicOptionsComp(List.of(new DynamicOptionsComp.Entry(null, null, top)), false).createRegion(), new Region()); SimpleChangeListener.apply(selectedTarget, c -> { if (selectedTarget.getValue() == null) { @@ -191,9 +188,8 @@ public class DsDataTransferComp extends SimpleComp { } var instructions = selectedTarget - .getValue() - .createRetrievalInstructions( - dataSourceEntry.getValue().getSource(), id); + .getValue() + .createRetrievalInstructions(dataSourceEntry.getValue().getSource(), id); content.getChildren().set(1, instructions.getRegion()); VBox.setVgrow(instructions.getRegion(), Priority.ALWAYS); selectedDisplay.setValue(instructions); diff --git a/app/src/main/java/io/xpipe/app/comp/source/DsStorageTargetComp.java b/app/src/main/java/io/xpipe/app/comp/source/DsStorageTargetComp.java index c57b8ee6..5279e233 100644 --- a/app/src/main/java/io/xpipe/app/comp/source/DsStorageTargetComp.java +++ b/app/src/main/java/io/xpipe/app/comp/source/DsStorageTargetComp.java @@ -35,8 +35,8 @@ public class DsStorageTargetComp extends SimpleComp { @Override protected Region createSimple() { var type = new DataSourceTypeComp( - dataSourceEntry.getValue().getDataSourceType(), - dataSourceEntry.getValue().getSource().getFlow()); + dataSourceEntry.getValue().getDataSourceType(), + dataSourceEntry.getValue().getSource().getFlow()); type.apply(struc -> struc.get().prefWidthProperty().bind(struc.get().prefHeightProperty())); type.apply(struc -> struc.get().setPrefHeight(60)); diff --git a/app/src/main/java/io/xpipe/app/comp/source/GuiDsCreatorMultiStep.java b/app/src/main/java/io/xpipe/app/comp/source/GuiDsCreatorMultiStep.java index 20673f86..5f47c357 100644 --- a/app/src/main/java/io/xpipe/app/comp/source/GuiDsCreatorMultiStep.java +++ b/app/src/main/java/io/xpipe/app/comp/source/GuiDsCreatorMultiStep.java @@ -40,7 +40,8 @@ public class GuiDsCreatorMultiStep provider, DI store, @@ -72,13 +73,7 @@ public class GuiDsCreatorMultiStep { var ms = new GuiDsCreatorMultiStep<>( - window, - null, sourceCollection, - category, - null, - null, - null, - State.CREATE); + window, null, sourceCollection, category, null, null, null, State.CREATE); loading.bind(ms.loading); window.setOnCloseRequest(e -> { if (ms.state == State.CREATE && ms.source.getValue() != null) { @@ -102,7 +97,8 @@ public class GuiDsCreatorMultiStep { var ms = new GuiDsCreatorMultiStep<>( window, - entry, DataStorage.get() + entry, + DataStorage.get() .getCollectionForSourceEntry(entry) .orElse(null), entry.getProvider().getCategory(), @@ -130,7 +126,8 @@ public class GuiDsCreatorMultiStep { var gui = new GuiDsCreatorMultiStep<>( window, - null, sourceCollection, + null, + sourceCollection, category, provider.orElse(null), store, @@ -266,7 +263,8 @@ public class GuiDsCreatorMultiStep {} case CREATE -> { - list.add(new Entry(I18n.observable("target"), new GuiDsCreatorTransferStep(targetGroup, store, source))); + list.add( + new Entry(I18n.observable("target"), new GuiDsCreatorTransferStep(targetGroup, store, source))); } } return list; diff --git a/app/src/main/java/io/xpipe/app/comp/source/GuiDsCreatorTransferStep.java b/app/src/main/java/io/xpipe/app/comp/source/GuiDsCreatorTransferStep.java index 47b92d53..cd1d9425 100644 --- a/app/src/main/java/io/xpipe/app/comp/source/GuiDsCreatorTransferStep.java +++ b/app/src/main/java/io/xpipe/app/comp/source/GuiDsCreatorTransferStep.java @@ -45,7 +45,8 @@ public class GuiDsCreatorTransferStep extends MultiStepComp.Step selected, Property> provider, boolean showAnonymous, - boolean showSaved, Mode mode - ) { + boolean showSaved, + Mode mode) { this.selected = selected; this.provider = provider; this.showAnonymous = showAnonymous; @@ -69,9 +69,12 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable { @Override protected Region createSimple() { - var isNamedStore = XPipeDaemon.getInstance().getStoreName(selected.getValue()).isPresent(); + var isNamedStore = + XPipeDaemon.getInstance().getStoreName(selected.getValue()).isPresent(); var localStore = new SimpleObjectProperty( - !isNamedStore && selected.getValue() instanceof FileStore fileStore && fileStore.getFileSystem() instanceof LocalStore + !isNamedStore + && selected.getValue() instanceof FileStore fileStore + && fileStore.getFileSystem() instanceof LocalStore ? selected.getValue() : null); var browseComp = new DsLocalFileBrowseComp(provider, localStore, mode).apply(GrowAugment.create(true, false)); @@ -99,7 +102,9 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable { provider != null ? provider : new SimpleObjectProperty<>()); var remoteStore = new SimpleObjectProperty( - isNamedStore && selected.getValue() instanceof FileStore fileStore && !(fileStore.getFileSystem() instanceof LocalStore) + isNamedStore + && selected.getValue() instanceof FileStore fileStore + && !(fileStore.getFileSystem() instanceof LocalStore) ? selected.getValue() : null); var remote = new TabPaneComp.Entry( @@ -111,14 +116,15 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable { "mdrmz-storage", NamedStoreChoiceComp.create(filter, namedStore, DataStoreProvider.Category.STREAM)); - var otherStore = new SimpleObjectProperty(localStore.get() == null && remoteStore.get() == null && !isNamedStore ? selected.getValue() : null); + var otherStore = new SimpleObjectProperty( + localStore.get() == null && remoteStore.get() == null && !isNamedStore ? selected.getValue() : null); var other = new TabPaneComp.Entry( I18n.observable("other"), "mdrmz-web_asset", new DataStoreSelectorComp(DataStoreProvider.Category.STREAM, otherStore)); var selectedTab = new SimpleObjectProperty(); - if (localStore.get() != null) { + if (localStore.get() != null) { selectedTab.set(local); } else if (remoteStore.get() != null) { selectedTab.set(remote); @@ -132,7 +138,8 @@ public class DsStreamStoreChoiceComp extends SimpleComp implements Validatable { selected.addListener((observable, oldValue, newValue) -> { if (provider != null && provider.getValue() == null) { - provider.setValue(DataSourceProviders.byPreferredStore(newValue, null).orElse(null)); + provider.setValue( + DataSourceProviders.byPreferredStore(newValue, null).orElse(null)); } }); diff --git a/app/src/main/java/io/xpipe/app/comp/storage/collection/SourceCollectionViewState.java b/app/src/main/java/io/xpipe/app/comp/storage/collection/SourceCollectionViewState.java index c2e3b2e5..8de12210 100644 --- a/app/src/main/java/io/xpipe/app/comp/storage/collection/SourceCollectionViewState.java +++ b/app/src/main/java/io/xpipe/app/comp/storage/collection/SourceCollectionViewState.java @@ -158,7 +158,8 @@ public class SourceCollectionViewState { private ObservableList filter(ObservableList list) { return list.filtered(storeEntryWrapper -> { - if (AppPrefs.get().developerMode().getValue() && AppPrefs.get().developerShowHiddenEntries().get()) { + if (AppPrefs.get().developerMode().getValue() + && AppPrefs.get().developerShowHiddenEntries().get()) { return true; } else { return !storeEntryWrapper.isInternal(); diff --git a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreEntryListComp.java b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreEntryListComp.java index a7405142..765b7dac 100644 --- a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreEntryListComp.java +++ b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreEntryListComp.java @@ -17,14 +17,12 @@ public class StoreEntryListComp extends SimpleComp { var topLevel = StoreEntrySection.createTopLevels(); var filtered = BindingsHelper.filteredContentBinding( topLevel, - StoreViewState.get().getFilterString().map(s -> (storeEntrySection -> storeEntrySection.shouldShow(s)))); - var content = new ListViewComp<>( - filtered, - topLevel, - null, - (StoreEntrySection e) -> { - return e.comp(true); - }); + StoreViewState.get() + .getFilterString() + .map(s -> (storeEntrySection -> storeEntrySection.shouldShow(s)))); + var content = new ListViewComp<>(filtered, topLevel, null, (StoreEntrySection e) -> { + return e.comp(true); + }); return content.styleClass("store-list-comp"); } diff --git a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreEntryWrapper.java b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreEntryWrapper.java index 2593d83b..147dc973 100644 --- a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreEntryWrapper.java +++ b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreEntryWrapper.java @@ -43,7 +43,9 @@ public class StoreEntryWrapper implements StorageFilter.Filterable { ActionProvider.ALL.stream() .filter(dataStoreActionProvider -> { return !entry.isDisabled() - && dataStoreActionProvider.getDataStoreCallSite() != null && dataStoreActionProvider.getDataStoreCallSite() + && dataStoreActionProvider.getDataStoreCallSite() != null + && dataStoreActionProvider + .getDataStoreCallSite() .getApplicableClass() .isAssignableFrom(entry.getStore().getClass()); }) @@ -54,8 +56,9 @@ public class StoreEntryWrapper implements StorageFilter.Filterable { return false; } - return dataStoreActionProvider.getDataStoreCallSite().isApplicable( - entry.getStore().asNeeded()); + return dataStoreActionProvider + .getDataStoreCallSite() + .isApplicable(entry.getStore().asNeeded()); }, disabledProperty(), state, diff --git a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreViewState.java b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreViewState.java index 9084035f..341db0c4 100644 --- a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreViewState.java +++ b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreViewState.java @@ -30,8 +30,7 @@ public class StoreViewState { private final ObservableList shownEntries = FXCollections.observableList(new CopyOnWriteArrayList<>()); - private final ObservableBooleanValue empty = - BindingsHelper.persist(Bindings.equal(Bindings.size(allEntries), 1)); + private final ObservableBooleanValue empty = BindingsHelper.persist(Bindings.equal(Bindings.size(allEntries), 1)); private StoreViewState() { try { 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 18266b46..04247f9f 100644 --- a/app/src/main/java/io/xpipe/app/core/App.java +++ b/app/src/main/java/io/xpipe/app/core/App.java @@ -69,7 +69,8 @@ public class App extends Application { AppActionLinkDetector.detectOnFocus(); }); }); - var title = String.format("X-Pipe Desktop (Alpha %s)", AppProperties.get().getVersion()); + var title = + String.format("X-Pipe Desktop (Alpha %s)", AppProperties.get().getVersion()); var appWindow = new AppMainWindow(stage); appWindow.initialize(); appWindow.setContent(title, content); @@ -80,12 +81,12 @@ public class App extends Application { appWindow.show(); // For demo purposes -// if (true) { -// stage.setX(310); -// stage.setY(178); -// stage.setWidth(1300); -// stage.setHeight(730); -// } + // if (true) { + // stage.setX(310); + // stage.setY(178); + // stage.setWidth(1300); + // stage.setHeight(730); + // } } public void focus() { diff --git a/app/src/main/java/io/xpipe/app/core/AppActionLinkDetector.java b/app/src/main/java/io/xpipe/app/core/AppActionLinkDetector.java index 2e0bf3ea..82af54a4 100644 --- a/app/src/main/java/io/xpipe/app/core/AppActionLinkDetector.java +++ b/app/src/main/java/io/xpipe/app/core/AppActionLinkDetector.java @@ -18,10 +18,10 @@ public class AppActionLinkDetector { content = Clipboard.getSystemClipboard().getContent(DataFormat.PLAIN_TEXT); } - return content != null?content.toString():null; + return content != null ? content.toString() : null; } - private static void handle(String content, boolean showAlert) { + private static void handle(String content, boolean showAlert) { var detected = LauncherInput.of(content); if (detected.size() == 0) { return; @@ -62,11 +62,14 @@ public class AppActionLinkDetector { private static boolean showAlert() { var paste = AppWindowHelper.showBlockingAlert(alert -> { - alert.setAlertType(Alert.AlertType.CONFIRMATION); - alert.setTitle(I18n.get("clipboardActionDetectedTitle")); - alert.setHeaderText(I18n.get("clipboardActionDetectedHeader")); - alert.getDialogPane().setContent(AppWindowHelper.alertContentText(I18n.get("clipboardActionDetectedContent"))); - }).map(buttonType -> buttonType.getButtonData().isDefaultButton()).orElse(false); + alert.setAlertType(Alert.AlertType.CONFIRMATION); + alert.setTitle(I18n.get("clipboardActionDetectedTitle")); + alert.setHeaderText(I18n.get("clipboardActionDetectedHeader")); + alert.getDialogPane() + .setContent(AppWindowHelper.alertContentText(I18n.get("clipboardActionDetectedContent"))); + }) + .map(buttonType -> buttonType.getButtonData().isDefaultButton()) + .orElse(false); return paste; } } diff --git a/app/src/main/java/io/xpipe/app/core/AppChecks.java b/app/src/main/java/io/xpipe/app/core/AppChecks.java index 6bf20513..2368b4f8 100644 --- a/app/src/main/java/io/xpipe/app/core/AppChecks.java +++ b/app/src/main/java/io/xpipe/app/core/AppChecks.java @@ -18,10 +18,12 @@ public class AppChecks { // if (true) throw new IOException(); } catch (IOException e) { ErrorEvent.fromThrowable( - new IOException( - "Unable to access directory " + dataDirectory - + ". Please make sure that you have the appropriate permissions and no Antivirus program is blocking the access. " - + "In case you use cloud storage, verify that your cloud storage is working and you are logged in.")).term().handle(); + new IOException( + "Unable to access directory " + dataDirectory + + ". Please make sure that you have the appropriate permissions and no Antivirus program is blocking the access. " + + "In case you use cloud storage, verify that your cloud storage is working and you are logged in.")) + .term() + .handle(); } } } 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 c292accb..46645dec 100644 --- a/app/src/main/java/io/xpipe/app/core/AppFont.java +++ b/app/src/main/java/io/xpipe/app/core/AppFont.java @@ -51,8 +51,7 @@ public class AppFont { public static void setSize(Node node, int off) { var baseSize = AppPrefs.get() != null ? AppPrefs.get().fontSize.getValue() : 12; - node.setStyle( - node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;"); + node.setStyle(node.getStyle() + "-fx-font-size: " + (baseSize + off) + "pt;"); } public static void loadFonts() { diff --git a/app/src/main/java/io/xpipe/app/core/AppI18n.java b/app/src/main/java/io/xpipe/app/core/AppI18n.java index 92e75322..2d282b67 100644 --- a/app/src/main/java/io/xpipe/app/core/AppI18n.java +++ b/app/src/main/java/io/xpipe/app/core/AppI18n.java @@ -107,7 +107,7 @@ public class AppI18n implements I18n { } @SneakyThrows - private static String getCallerModuleName() { + private static String getCallerModuleName() { var callers = CallingClass.INSTANCE.getCallingClasses(); for (Class caller : callers) { if (caller.equals(CallingClass.class) @@ -158,7 +158,9 @@ public class AppI18n implements I18n { } private boolean matchesLocale(Path f) { - var l = AppPrefs.get() != null ? AppPrefs.get().language.getValue().getLocale() : SupportedLocale.ENGLISH.getLocale(); + var l = AppPrefs.get() != null + ? AppPrefs.get().language.getValue().getLocale() + : SupportedLocale.ENGLISH.getLocale(); var name = FilenameUtils.getBaseName(f.getFileName().toString()); var ending = "_" + l.toLanguageTag(); return name.endsWith(ending); @@ -208,6 +210,9 @@ public class AppI18n implements I18n { .handle(); }); } - this.prettyTime = new PrettyTime(AppPrefs.get() != null ? AppPrefs.get().language.getValue().getLocale() : SupportedLocale.ENGLISH.getLocale()); + this.prettyTime = new PrettyTime( + AppPrefs.get() != null + ? AppPrefs.get().language.getValue().getLocale() + : SupportedLocale.ENGLISH.getLocale()); } } 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 8c52ded2..5ddb1559 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLogs.java +++ b/app/src/main/java/io/xpipe/app/core/AppLogs.java @@ -42,8 +42,10 @@ public class AppLogs { private final PrintStream originalSysErr; private final Path logDir; private final boolean writeToSysout; + @Getter private final boolean writeToFile; + private final PrintStream outStream; private final Map categoryWriters; diff --git a/app/src/main/java/io/xpipe/app/core/AppProperties.java b/app/src/main/java/io/xpipe/app/core/AppProperties.java index 78a2dedb..b2e3bc7f 100644 --- a/app/src/main/java/io/xpipe/app/core/AppProperties.java +++ b/app/src/main/java/io/xpipe/app/core/AppProperties.java @@ -34,7 +34,7 @@ public class AppProperties { Properties props = new Properties(); AppResources.with(AppResources.XPIPE_MODULE, "app.properties", p -> { if (Files.exists(p)) { - try (var in = Files.newInputStream(p)){ + try (var in = Files.newInputStream(p)) { props.load(in); } catch (IOException e) { ErrorEvent.fromThrowable(e).omitted(true).build().handle(); @@ -44,7 +44,9 @@ public class AppProperties { version = Optional.ofNullable(props.getProperty("version")).orElse("dev"); build = Optional.ofNullable(props.getProperty("build")).orElse("unknown"); - buildUuid = Optional.ofNullable(System.getProperty("io.xpipe.app.buildId")).map(UUID::fromString).orElse(UUID.randomUUID()); + buildUuid = Optional.ofNullable(System.getProperty("io.xpipe.app.buildId")) + .map(UUID::fromString) + .orElse(UUID.randomUUID()); sentryUrl = System.getProperty("io.xpipe.app.sentryUrl"); extensionPaths = parseExtensionPaths(); diff --git a/app/src/main/java/io/xpipe/app/core/AppWindowHelper.java b/app/src/main/java/io/xpipe/app/core/AppWindowHelper.java index e4b30cea..43be60e8 100644 --- a/app/src/main/java/io/xpipe/app/core/AppWindowHelper.java +++ b/app/src/main/java/io/xpipe/app/core/AppWindowHelper.java @@ -219,7 +219,9 @@ public class AppWindowHelper { } else { var url = AppResources.getResourceURL(AppResources.XPIPE_MODULE, "img/logo.png"); if (url.isPresent()) { - ((Stage) a.getDialogPane().getScene().getWindow()).getIcons().add(new Image(url.get().toString())); + ((Stage) a.getDialogPane().getScene().getWindow()) + .getIcons() + .add(new Image(url.get().toString())); } } } diff --git a/app/src/main/java/io/xpipe/app/core/mode/BaseMode.java b/app/src/main/java/io/xpipe/app/core/mode/BaseMode.java index 82de23a7..0af0e4fa 100644 --- a/app/src/main/java/io/xpipe/app/core/mode/BaseMode.java +++ b/app/src/main/java/io/xpipe/app/core/mode/BaseMode.java @@ -3,12 +3,12 @@ package io.xpipe.app.core.mode; import io.xpipe.app.comp.storage.collection.SourceCollectionViewState; import io.xpipe.app.comp.storage.store.StoreViewState; import io.xpipe.app.core.*; -import io.xpipe.app.util.ExternalEditor; -import io.xpipe.app.update.AppUpdater; import io.xpipe.app.issue.BasicErrorHandler; import io.xpipe.app.issue.ErrorHandler; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.storage.DataStorage; +import io.xpipe.app.update.AppUpdater; +import io.xpipe.app.util.ExternalEditor; import io.xpipe.core.util.JacksonMapper; import io.xpipe.extension.event.TrackEvent; 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 1b7cd602..ae12327e 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 @@ -1,10 +1,10 @@ package io.xpipe.app.core.mode; -import io.xpipe.app.update.UpdateChangelogAlert; import io.xpipe.app.core.App; import io.xpipe.app.core.AppGreetings; import io.xpipe.app.issue.ErrorHandler; import io.xpipe.app.issue.ErrorHandlerComp; +import io.xpipe.app.update.UpdateChangelogAlert; import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.event.TrackEvent; import javafx.application.Platform; 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 e7d5d128..f5fae587 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 @@ -77,9 +77,9 @@ public abstract class OperationMode { OperationMode.shutdown(true, false); })); -// if (true) { -// throw new OutOfMemoryError(); -// } + // if (true) { + // throw new OutOfMemoryError(); + // } TrackEvent.info("mode", "Initial setup"); AppProperties.init(); diff --git a/app/src/main/java/io/xpipe/app/core/mode/PlatformMode.java b/app/src/main/java/io/xpipe/app/core/mode/PlatformMode.java index af2f7f34..0abaa5e5 100644 --- a/app/src/main/java/io/xpipe/app/core/mode/PlatformMode.java +++ b/app/src/main/java/io/xpipe/app/core/mode/PlatformMode.java @@ -25,7 +25,8 @@ public abstract class PlatformMode extends OperationMode { } try { - GraphicsDevice[] screenDevices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + GraphicsDevice[] screenDevices = + GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); HAS_GRAPHICS = screenDevices != null && screenDevices.length > 0; } catch (HeadlessException e) { TrackEvent.warn(e.getMessage()); diff --git a/app/src/main/java/io/xpipe/app/exchange/cli/ModeExchangeImpl.java b/app/src/main/java/io/xpipe/app/exchange/cli/ModeExchangeImpl.java index 39affb8e..58ae1e32 100644 --- a/app/src/main/java/io/xpipe/app/exchange/cli/ModeExchangeImpl.java +++ b/app/src/main/java/io/xpipe/app/exchange/cli/ModeExchangeImpl.java @@ -20,12 +20,15 @@ public class ModeExchangeImpl extends ModeExchange throw new ClientException("Unsupported mode: " + msg.getMode().getDisplayName() + ". Supported: " + String.join( ", ", - OperationMode.getAll().stream().filter(OperationMode::isSupported) + OperationMode.getAll().stream() + .filter(OperationMode::isSupported) .map(OperationMode::getId) .toList())); } OperationMode.switchTo(mode); - return ModeExchange.Response.builder().usedMode(OperationMode.map(OperationMode.get())).build(); + return ModeExchange.Response.builder() + .usedMode(OperationMode.map(OperationMode.get())) + .build(); } } diff --git a/app/src/main/java/io/xpipe/app/issue/AttachmentHelper.java b/app/src/main/java/io/xpipe/app/issue/AttachmentHelper.java index eb54f7a4..aeeda26f 100644 --- a/app/src/main/java/io/xpipe/app/issue/AttachmentHelper.java +++ b/app/src/main/java/io/xpipe/app/issue/AttachmentHelper.java @@ -22,10 +22,12 @@ public class AttachmentHelper { if (file.isDirectory()) { compressDirectoryToZipfile(rootDir, sourceDir.resolve(file.getName()), out); } else { - ZipEntry entry = new ZipEntry(rootDir.relativize(sourceDir).resolve(file.getName()).toString()); + ZipEntry entry = new ZipEntry( + rootDir.relativize(sourceDir).resolve(file.getName()).toString()); out.putNextEntry(entry); - FileInputStream in = new FileInputStream(sourceDir.resolve(file.getName()).toString()); + FileInputStream in = + new FileInputStream(sourceDir.resolve(file.getName()).toString()); IOUtils.copy(in, out); IOUtils.closeQuietly(in); } 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 ab1bc3f7..8430ff60 100644 --- a/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java +++ b/app/src/main/java/io/xpipe/app/issue/SentryErrorHandler.java @@ -4,10 +4,10 @@ import io.sentry.*; import io.sentry.protocol.SentryId; import io.sentry.protocol.User; import io.xpipe.app.core.AppCache; -import io.xpipe.extension.util.XPipeDistributionType; import io.xpipe.app.core.AppProperties; import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.event.TrackEvent; +import io.xpipe.extension.util.XPipeDistributionType; import org.apache.commons.io.FileUtils; import java.nio.file.Files; diff --git a/app/src/main/java/io/xpipe/app/issue/UserReportComp.java b/app/src/main/java/io/xpipe/app/issue/UserReportComp.java index 9dd995d6..b50ebd2b 100644 --- a/app/src/main/java/io/xpipe/app/issue/UserReportComp.java +++ b/app/src/main/java/io/xpipe/app/issue/UserReportComp.java @@ -45,14 +45,16 @@ public class UserReportComp extends SimpleComp { private Comp createAttachments() { var list = new ListSelectorComp<>(event.getAttachments(), file -> { - if (file.equals(AppLogs.get().getSessionLogsDirectory())) { - return I18n.get("logFilesAttachment"); - } + if (file.equals(AppLogs.get().getSessionLogsDirectory())) { + return I18n.get("logFilesAttachment"); + } - return file.getFileName().toString(); - }).styleClass("attachment-list"); + return file.getFileName().toString(); + }) + .styleClass("attachment-list"); var tp = new TitledPaneComp(I18n.observable("additionalErrorAttachments"), list, 100) - .apply(s -> AppFont.medium(s.get())).styleClass("attachments"); + .apply(s -> AppFont.medium(s.get())) + .styleClass("attachments"); return tp; // // var list = FXCollections.observableList(event.getSensitiveDiagnostics()); diff --git a/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java b/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java index 184d0138..63efbf9f 100644 --- a/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java +++ b/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java @@ -71,7 +71,8 @@ public class LauncherCommand implements Callable { if (BeaconServer.isRunning()) { try (var con = new LauncherConnection()) { con.constructSocket(); - con.performSimpleExchange(FocusExchange.Request.builder().mode(getEffectiveMode()).build()); + con.performSimpleExchange( + FocusExchange.Request.builder().mode(getEffectiveMode()).build()); if (inputs.size() > 0) { con.performSimpleExchange( OpenExchange.Request.builder().arguments(inputs).build()); @@ -79,8 +80,9 @@ public class LauncherCommand implements Callable { if (OsType.getLocal().equals(OsType.MACOS)) { Desktop.getDesktop().setOpenURIHandler(e -> { - con.performSimpleExchange( - OpenExchange.Request.builder().arguments(List.of(e.getURI().toString())).build()); + con.performSimpleExchange(OpenExchange.Request.builder() + .arguments(List.of(e.getURI().toString())) + .build()); }); ThreadHelper.sleep(1000); } 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 a344ffbf..02e53a75 100644 --- a/app/src/main/java/io/xpipe/app/launcher/LauncherInput.java +++ b/app/src/main/java/io/xpipe/app/launcher/LauncherInput.java @@ -21,7 +21,9 @@ import java.util.List; public abstract class LauncherInput { public static void handle(List arguments) { - TrackEvent.withDebug("launcher", "Handling arguments").elements(arguments).handle(); + TrackEvent.withDebug("launcher", "Handling arguments") + .elements(arguments) + .handle(); var all = new ArrayList(); arguments.forEach(s -> { @@ -76,7 +78,7 @@ public abstract class LauncherInput { .equalsIgnoreCase(action)) .findFirst(); if (found.isPresent()) { - ActionProvider.Action a = null; + ActionProvider.Action a = null; try { a = found.get().getLauncherCallSite().createAction(args); } catch (Exception e) { 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 23e9d67a..ae578ac8 100644 --- a/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java +++ b/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java @@ -27,7 +27,7 @@ import java.util.*; public class AppPrefs { - private static ObservableBooleanValue bindDeveloperTrue(ObservableBooleanValue o) { + private static ObservableBooleanValue bindDeveloperTrue(ObservableBooleanValue o) { return Bindings.createBooleanBinding( () -> { return AppPrefs.get().developerMode().getValue() || o.get(); @@ -36,7 +36,7 @@ public class AppPrefs { AppPrefs.get().developerMode()); } - private static ObservableBooleanValue bindDeveloperFalse(ObservableBooleanValue o) { + private static ObservableBooleanValue bindDeveloperFalse(ObservableBooleanValue o) { return Bindings.createBooleanBinding( () -> { return !AppPrefs.get().developerMode().getValue() || o.get(); @@ -405,8 +405,7 @@ public class AppPrefs { Setting.of( "externalStartupBehaviour", externalStartupBehaviourControl, - externalStartupBehaviour - ), + externalStartupBehaviour), Setting.of("closeBehaviour", closeBehaviourControl, closeBehaviour), Setting.of("automaticallyUpdate", automaticallyUpdateField, automaticallyUpdate) .applyVisibility(VisibilityProperty.of(new SimpleBooleanProperty( @@ -416,9 +415,7 @@ public class AppPrefs { XPipeDistributionType.get().supportsUpdate()))), Setting.of("storageDirectory", storageDirectoryControl, internalStorageDirectory), Setting.of("logLevel", logLevelField, internalLogLevel), - Setting.of("developerMode", developerModeField, internalDeveloperMode) - ) - ), + Setting.of("developerMode", developerModeField, internalDeveloperMode))), Category.of( "appearance", Group.of( @@ -427,10 +424,8 @@ public class AppPrefs { Setting.of("theme", themeControl, themeInternal), Setting.of("useSystemFont", useSystemFontInternal), Setting.of("tooltipDelay", tooltipDelayInternal, tooltipDelayMin, tooltipDelayMax), - Setting.of("fontSize", fontSizeInternal, fontSizeMin, fontSizeMax) - ), - Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal)) - ), + Setting.of("fontSize", fontSizeInternal, fontSizeMin, fontSizeMax)), + Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal))), Category.of( "integrations", Group.of( @@ -443,39 +438,29 @@ public class AppPrefs { "editorReloadTimeout", editorReloadTimeout, editorReloadTimeoutMin, - editorReloadTimeoutMax - ) - ) - ), + editorReloadTimeoutMax))), Category.of( "developer", Setting.of( "developerDisableUpdateVersionCheck", developerDisableUpdateVersionCheckField, - developerDisableUpdateVersionCheck - ), + developerDisableUpdateVersionCheck), Setting.of( "developerDisableGuiRestrictions", developerDisableGuiRestrictionsField, - developerDisableGuiRestrictions - ), + developerDisableGuiRestrictions), Setting.of( "developerDisableConnectorInstallationVersionCheck", developerDisableConnectorInstallationVersionCheckField, - developerDisableConnectorInstallationVersionCheck - ), + developerDisableConnectorInstallationVersionCheck), Setting.of( "developerShowHiddenEntries", developerShowHiddenEntriesField, - developerShowHiddenEntries - ), + developerShowHiddenEntries), Setting.of( "developerShowHiddenProviders", developerShowHiddenProvidersField, - developerShowHiddenProviders - ) - ) - )); + developerShowHiddenProviders)))); categories.get(categories.size() - 1).setVisibilityProperty(VisibilityProperty.of(developerMode())); diff --git a/app/src/main/java/io/xpipe/app/prefs/CloseBehaviour.java b/app/src/main/java/io/xpipe/app/prefs/CloseBehaviour.java index 1b0d6de2..32790b8b 100644 --- a/app/src/main/java/io/xpipe/app/prefs/CloseBehaviour.java +++ b/app/src/main/java/io/xpipe/app/prefs/CloseBehaviour.java @@ -6,23 +6,17 @@ import lombok.Getter; @Getter public enum CloseBehaviour implements PrefsChoiceValue { - QUIT( - "app.quit", - () -> { - OperationMode.shutdown(false, false); - }), + QUIT("app.quit", () -> { + OperationMode.shutdown(false, false); + }), - CONTINUE_IN_BACKGROUND( - "app.continueInBackground", - () -> { - OperationMode.switchToAsync(OperationMode.BACKGROUND); - }), + CONTINUE_IN_BACKGROUND("app.continueInBackground", () -> { + OperationMode.switchToAsync(OperationMode.BACKGROUND); + }), - MINIMIZE_TO_TRAY( - "app.minimizeToTray", - () -> { - OperationMode.switchToAsync(OperationMode.TRAY); - }); + MINIMIZE_TO_TRAY("app.minimizeToTray", () -> { + OperationMode.switchToAsync(OperationMode.TRAY); + }); private String id; private Runnable exit; diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalApplicationType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalApplicationType.java index bcb6713e..8be8685c 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalApplicationType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalApplicationType.java @@ -39,8 +39,8 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue { protected Optional getApplicationPath() { try (ShellProcessControl pc = ShellStore.local().create().start()) { try (var c = pc.command(String.format( - "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister " + - "-dump | grep -o \"/.*%s.app\" | grep -v -E \"Caches|TimeMachine|Temporary|/Volumes/%s\" | uniq", + "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister " + + "-dump | grep -o \"/.*%s.app\" | grep -v -E \"Caches|TimeMachine|Temporary|/Volumes/%s\" | uniq", applicationName, applicationName)) .start()) { var path = c.readOnlyStdout(); @@ -66,7 +66,7 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue { } } - public static abstract class PathApplication extends ExternalApplicationType { + public abstract static class PathApplication extends ExternalApplicationType { protected final String executable; diff --git a/app/src/main/java/io/xpipe/app/prefs/PrefFields.java b/app/src/main/java/io/xpipe/app/prefs/PrefFields.java index 7b786fd6..38551ba0 100644 --- a/app/src/main/java/io/xpipe/app/prefs/PrefFields.java +++ b/app/src/main/java/io/xpipe/app/prefs/PrefFields.java @@ -29,9 +29,8 @@ public class PrefFields { return Path.of(value); } }); - return StringField.ofStringType( - stringProperty).render( - () -> new SimpleChooserControl( + return StringField.ofStringType(stringProperty) + .render(() -> new SimpleChooserControl( I18n.get("browse"), fileProperty.getValue().toFile(), true)); } } diff --git a/app/src/main/java/io/xpipe/app/prefs/SupportedLocale.java b/app/src/main/java/io/xpipe/app/prefs/SupportedLocale.java index 8a824203..7b2fe2d0 100644 --- a/app/src/main/java/io/xpipe/app/prefs/SupportedLocale.java +++ b/app/src/main/java/io/xpipe/app/prefs/SupportedLocale.java @@ -10,7 +10,7 @@ import java.util.Locale; @Getter public enum SupportedLocale implements PrefsChoiceValue { ENGLISH(Locale.ENGLISH, "english"); - //GERMAN(Locale.GERMAN, "german"); + // GERMAN(Locale.GERMAN, "german"); private final Locale locale; private final String id; diff --git a/app/src/main/java/io/xpipe/app/storage/DataSourceEntry.java b/app/src/main/java/io/xpipe/app/storage/DataSourceEntry.java index 5958bc90..3f9b6ca0 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataSourceEntry.java +++ b/app/src/main/java/io/xpipe/app/storage/DataSourceEntry.java @@ -30,10 +30,13 @@ public class DataSourceEntry extends StorageElement { @NonFinal State state; + @NonFinal String information; + @NonFinal JsonNode sourceNode; + @NonFinal DataSource dataSource; @@ -70,10 +73,17 @@ public class DataSourceEntry extends StorageElement { } public static DataSourceEntry createNew( - @NonNull UUID uuid, @NonNull String name, @NonNull DataSource dataSource - ) { + @NonNull UUID uuid, @NonNull String name, @NonNull DataSource dataSource) { var entry = new DataSourceEntry( - null, uuid, name, Instant.now(), Instant.now(), true, DataStorageWriter.sourceToNode(dataSource), null, State.INCOMPLETE); + null, + uuid, + name, + Instant.now(), + Instant.now(), + true, + DataStorageWriter.sourceToNode(dataSource), + null, + State.INCOMPLETE); entry.simpleRefresh(); return entry; } @@ -137,12 +147,12 @@ public class DataSourceEntry extends StorageElement { var oldSource = dataSource; DataSource newSource = DataStorageParser.sourceFromNode(sourceNode); -// TrackEvent.storage() -// .trace() -// .message("Refreshing data source entry") -// .tag("old", oldSource) -// .tag("new", newSource) -// .handle(); + // TrackEvent.storage() + // .trace() + // .message("Refreshing data source entry") + // .tag("old", oldSource) + // .tag("new", newSource) + // .handle(); if (newSource == null) { dataSource = null; 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 26c73c2c..c89660b9 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorage.java @@ -78,7 +78,9 @@ public abstract class DataStorage { } public DataSourceCollection getInternalCollection() { - var found = sourceCollections.stream().filter(o -> o.getName() != null && o.getName().equals("Internal")).findAny(); + var found = sourceCollections.stream() + .filter(o -> o.getName() != null && o.getName().equals("Internal")) + .findAny(); if (found.isPresent()) { return found.get(); } 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 5051b59d..f881496b 100644 --- a/app/src/main/java/io/xpipe/app/storage/DataStorageWriter.java +++ b/app/src/main/java/io/xpipe/app/storage/DataStorageWriter.java @@ -46,7 +46,8 @@ public class DataStorageWriter { } return Optional.empty(); }, - "storeId", isRoot); + "storeId", + isRoot); node = replaceReferencesWithIds( node, @@ -61,7 +62,8 @@ public class DataStorageWriter { } return Optional.empty(); }, - "sourceId", isRoot); + "sourceId", + isRoot); return node; } diff --git a/app/src/main/java/io/xpipe/app/update/AppInstaller.java b/app/src/main/java/io/xpipe/app/update/AppInstaller.java index 04c381c1..96fe722c 100644 --- a/app/src/main/java/io/xpipe/app/update/AppInstaller.java +++ b/app/src/main/java/io/xpipe/app/update/AppInstaller.java @@ -37,7 +37,8 @@ public class AppInstaller { if (s.isLocal()) { targetFile = localFile.toString(); } else { - targetFile = FileNames.join(s.getTemporaryDirectory(), localFile.getFileName().toString()); + targetFile = FileNames.join( + s.getTemporaryDirectory(), localFile.getFileName().toString()); try (CommandProcessControl c = s.command(s.getShellType().getStreamFileWriteCommand(targetFile)) .start()) { c.discardOut(); @@ -60,7 +61,9 @@ public class AppInstaller { } if (OsType.getLocal().equals(OsType.LINUX)) { - return Files.exists(Path.of("/etc/debian_version")) ? new InstallerAssetType.Debian() : new InstallerAssetType.Rpm(); + return Files.exists(Path.of("/etc/debian_version")) + ? new InstallerAssetType.Debian() + : new InstallerAssetType.Rpm(); } if (OsType.getLocal().equals(OsType.MACOS)) { @@ -236,7 +239,8 @@ public class AppInstaller { @Override public void installRemote(ShellProcessControl shellProcessControl, String file) throws Exception { try (var pc = shellProcessControl.subShell(ShellTypes.BASH).start()) { - try (CommandProcessControl c = pc.command("installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /") + try (CommandProcessControl c = pc.command( + "installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /") .elevated() .start()) { c.discardOrThrow(); @@ -247,7 +251,8 @@ public class AppInstaller { @Override public void installLocal(String file) throws Exception { - var command = "set -x\n" + "sudo installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /\n" + "xpipe daemon start"; + var command = "set -x\n" + "sudo installer -verboseR -allowUntrusted -pkg \"" + file + "\" -target /\n" + + "xpipe daemon start"; TerminalProvider.open("X-Pipe Updater", command); } } diff --git a/app/src/main/java/io/xpipe/app/update/AppUpdater.java b/app/src/main/java/io/xpipe/app/update/AppUpdater.java index f2ac8cff..37470a39 100644 --- a/app/src/main/java/io/xpipe/app/update/AppUpdater.java +++ b/app/src/main/java/io/xpipe/app/update/AppUpdater.java @@ -1,7 +1,6 @@ package io.xpipe.app.update; import io.xpipe.app.core.AppCache; -import io.xpipe.extension.util.XPipeDistributionType; import io.xpipe.app.core.AppExtensionManager; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.mode.OperationMode; @@ -12,6 +11,7 @@ import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.event.TrackEvent; import io.xpipe.extension.util.BusyProperty; import io.xpipe.extension.util.ThreadHelper; +import io.xpipe.extension.util.XPipeDistributionType; import javafx.beans.property.BooleanProperty; import javafx.beans.property.Property; import javafx.beans.property.SimpleBooleanProperty; diff --git a/app/src/main/java/io/xpipe/app/update/UpdateAvailableAlert.java b/app/src/main/java/io/xpipe/app/update/UpdateAvailableAlert.java index 3a6b80ab..9454f7c5 100644 --- a/app/src/main/java/io/xpipe/app/update/UpdateAvailableAlert.java +++ b/app/src/main/java/io/xpipe/app/update/UpdateAvailableAlert.java @@ -12,13 +12,14 @@ public class UpdateAvailableAlert { return; } - var update = AppWindowHelper.showBlockingAlert( - alert -> { + var update = AppWindowHelper.showBlockingAlert(alert -> { alert.setTitle(I18n.get("updateReadyTitle")); alert.setHeaderText(I18n.get("updateReadyHeader")); alert.setContentText(I18n.get("updateReadyContent")); alert.setAlertType(Alert.AlertType.INFORMATION); - }).map(buttonType -> buttonType.getButtonData().isDefaultButton()).orElse(false); + }) + .map(buttonType -> buttonType.getButtonData().isDefaultButton()) + .orElse(false); if (update) { AppUpdater.get().executeUpdateAndClose(); } diff --git a/app/src/main/java/io/xpipe/app/util/ExternalEditor.java b/app/src/main/java/io/xpipe/app/util/ExternalEditor.java index 598c83b3..113b2971 100644 --- a/app/src/main/java/io/xpipe/app/util/ExternalEditor.java +++ b/app/src/main/java/io/xpipe/app/util/ExternalEditor.java @@ -122,24 +122,24 @@ public class ExternalEditor { return Optional.empty(); } - public void startEditing( - String keyName, - String fileType, - Object key, - String input, - Consumer output) { + public void startEditing(String keyName, String fileType, Object key, String input, Consumer output) { if (input == null) { input = ""; } String s = input; - startEditing(keyName, fileType, key, () -> new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)), () -> new ByteArrayOutputStream(s.length()) { - @Override - public void close() throws IOException { - super.close(); - output.accept(new String(toByteArray(), StandardCharsets.UTF_8)); - } - }); + startEditing( + keyName, + fileType, + key, + () -> new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)), + () -> new ByteArrayOutputStream(s.length()) { + @Override + public void close() throws IOException { + super.close(); + output.accept(new String(toByteArray(), StandardCharsets.UTF_8)); + } + }); } public void startEditing( @@ -154,7 +154,8 @@ public class ExternalEditor { return; } - var name = keyName + " - " + UUID.randomUUID().toString().substring(0, 6) + "." + (fileType != null ? fileType : "txt"); + var name = keyName + " - " + UUID.randomUUID().toString().substring(0, 6) + "." + + (fileType != null ? fileType : "txt"); Path file = TEMP.resolve(name); try { FileUtils.forceMkdirParent(file.toFile()); diff --git a/app/src/main/java/io/xpipe/app/util/ProxyManagerProviderImpl.java b/app/src/main/java/io/xpipe/app/util/ProxyManagerProviderImpl.java index f63fe645..b91238aa 100644 --- a/app/src/main/java/io/xpipe/app/util/ProxyManagerProviderImpl.java +++ b/app/src/main/java/io/xpipe/app/util/ProxyManagerProviderImpl.java @@ -22,7 +22,8 @@ public class ProxyManagerProviderImpl extends ProxyManagerProvider { alert.setAlertType(Alert.AlertType.CONFIRMATION); alert.setTitle(I18n.get("connectorInstallationTitle")); alert.setHeaderText(I18n.get("connectorInstallationHeader")); - alert.getDialogPane().setContent(AppWindowHelper.alertContentText(I18n.get("connectorInstallationContent"))); + alert.getDialogPane() + .setContent(AppWindowHelper.alertContentText(I18n.get("connectorInstallationContent"))); }) .filter(buttonType -> buttonType.getButtonData().isDefaultButton()) .isPresent(); diff --git a/app/src/main/java/io/xpipe/app/util/TerminalProvider.java b/app/src/main/java/io/xpipe/app/util/TerminalProvider.java index 46b551cb..1db3c123 100644 --- a/app/src/main/java/io/xpipe/app/util/TerminalProvider.java +++ b/app/src/main/java/io/xpipe/app/util/TerminalProvider.java @@ -13,7 +13,9 @@ public abstract class TerminalProvider { @Override public void init(ModuleLayer layer) { - INSTANCE = ServiceLoader.load(layer, TerminalProvider.class).findFirst().orElseThrow(); + INSTANCE = ServiceLoader.load(layer, TerminalProvider.class) + .findFirst() + .orElseThrow(); } @Override @@ -35,5 +37,5 @@ public abstract class TerminalProvider { INSTANCE.openInTerminal(title, command); } - protected abstract void openInTerminal(String title, String command) throws Exception; + protected abstract void openInTerminal(String title, String command) throws Exception; } diff --git a/app/src/main/java/io/xpipe/app/util/XPipeDaemonProvider.java b/app/src/main/java/io/xpipe/app/util/XPipeDaemonProvider.java index 1fc2a372..c29669f1 100644 --- a/app/src/main/java/io/xpipe/app/util/XPipeDaemonProvider.java +++ b/app/src/main/java/io/xpipe/app/util/XPipeDaemonProvider.java @@ -7,9 +7,9 @@ import io.xpipe.app.comp.source.store.NamedStoreChoiceComp; import io.xpipe.app.core.AppImages; import io.xpipe.app.core.AppProperties; import io.xpipe.app.core.AppResources; -import io.xpipe.app.update.AppDownloads; import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStoreEntry; +import io.xpipe.app.update.AppDownloads; import io.xpipe.core.charsetter.Charsetter; import io.xpipe.core.source.DataSource; import io.xpipe.core.source.DataSourceId; @@ -71,7 +71,8 @@ public class XPipeDaemonProvider implements XPipeDaemon { Property> provider, boolean showAnonymous, boolean showSaved) { - return (T) new DsStreamStoreChoiceComp(storeProperty, provider, showAnonymous, showSaved, DsStreamStoreChoiceComp.Mode.WRITE); + return (T) new DsStreamStoreChoiceComp( + storeProperty, provider, showAnonymous, showSaved, DsStreamStoreChoiceComp.Mode.WRITE); } @Override diff --git a/app/src/main/java/module-info.java b/app/src/main/java/module-info.java index 493c2ffe..3abd3715 100644 --- a/app/src/main/java/module-info.java +++ b/app/src/main/java/module-info.java @@ -101,7 +101,8 @@ open module io.xpipe.app { uses MessageExchangeImpl; uses io.xpipe.app.util.TerminalProvider; - provides ModuleLayerLoader with TerminalProvider.Loader; + provides ModuleLayerLoader with + TerminalProvider.Loader; provides DataStateProvider with DataStateProviderImpl; provides ProxyManagerProvider with diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java b/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java index 433a76b7..b1c31383 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java @@ -35,6 +35,7 @@ public class BeaconClient implements AutoCloseable { @Getter private final Closeable base; + private final InputStream in; private final OutputStream out; @@ -296,10 +297,7 @@ public class BeaconClient implements AutoCloseable { void run() throws E; } - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type" - ) + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public abstract static class ClientInformation { public final CliClientInformation cli() { diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java b/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java index aa13b546..504451da 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconConnection.java @@ -78,8 +78,7 @@ public abstract class BeaconConnection implements AutoCloseable { } public void performInputExchange( - REQ req, BeaconClient.FailableBiConsumer responseConsumer - ) { + REQ req, BeaconClient.FailableBiConsumer responseConsumer) { checkClosed(); performInputOutputExchange(req, null, responseConsumer); @@ -88,8 +87,7 @@ public abstract class BeaconConnection implements AutoCloseable { public void performInputOutputExchange( REQ req, BeaconClient.FailableConsumer reqWriter, - BeaconClient.FailableBiConsumer responseConsumer - ) { + BeaconClient.FailableBiConsumer responseConsumer) { checkClosed(); try { @@ -151,8 +149,7 @@ public abstract class BeaconConnection implements AutoCloseable { } public RES performOutputExchange( - REQ req, BeaconClient.FailableConsumer reqWriter - ) { + REQ req, BeaconClient.FailableConsumer reqWriter) { checkClosed(); try { @@ -183,7 +180,10 @@ public abstract class BeaconConnection implements AutoCloseable { public InternalStreamStore createInternalStreamStore(String name) { var store = new InternalStreamStore(); - var addReq = StoreAddExchange.Request.builder().storeInput(store).name(name != null ? name : store.getUuid().toString()).build(); + var addReq = StoreAddExchange.Request.builder() + .storeInput(store) + .name(name != null ? name : store.getUuid().toString()) + .build(); StoreAddExchange.Response addRes = performSimpleExchange(addReq); QuietDialogHandler.handle(addRes.getConfig(), this); return store; @@ -194,8 +194,7 @@ public abstract class BeaconConnection implements AutoCloseable { } public void writeStream(String name, InputStream in) { - performOutputExchange( - WriteStreamExchange.Request.builder().name(name).build(), in::transferTo); + performOutputExchange(WriteStreamExchange.Request.builder().name(name).build(), in::transferTo); } private BeaconException unwrapException(Exception exception) { diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconDaemonController.java b/beacon/src/main/java/io/xpipe/beacon/BeaconDaemonController.java index d802410e..38a9993e 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconDaemonController.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconDaemonController.java @@ -39,7 +39,10 @@ public class BeaconDaemonController { return; } - var client = BeaconClient.connect(BeaconClient.ApiClientInformation.builder().version("?").language("Java API Test").build()); + var client = BeaconClient.connect(BeaconClient.ApiClientInformation.builder() + .version("?") + .language("Java API Test") + .build()); if (!BeaconServer.tryStop(client)) { throw new AssertionError(); } @@ -49,9 +52,9 @@ public class BeaconDaemonController { private static void waitForStartup(Process process, boolean custom) throws IOException { for (int i = 0; i < 160; i++) { // Breaks when using nohup & disown -// if (process != null && !custom && !process.isAlive()) { -// throw new IOException("Daemon start failed"); -// } + // if (process != null && !custom && !process.isAlive()) { + // throw new IOException("Daemon start failed"); + // } if (process != null && custom && !process.isAlive() && process.exitValue() != 0) { throw new IOException("Custom launch command failed"); @@ -63,9 +66,9 @@ public class BeaconDaemonController { } var s = BeaconClient.tryConnect(BeaconClient.ApiClientInformation.builder() - .version("?") - .language("Java") - .build()); + .version("?") + .language("Java") + .build()); if (s.isPresent()) { return; } diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconException.java b/beacon/src/main/java/io/xpipe/beacon/BeaconException.java index 66d0980b..5c4bd3b6 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconException.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconException.java @@ -5,8 +5,7 @@ package io.xpipe.beacon; */ public class BeaconException extends RuntimeException { - public BeaconException() { - } + public BeaconException() {} public BeaconException(String message) { super(message); diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconJacksonModule.java b/beacon/src/main/java/io/xpipe/beacon/BeaconJacksonModule.java index ea02cf22..08b05fa4 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconJacksonModule.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconJacksonModule.java @@ -11,7 +11,6 @@ public class BeaconJacksonModule extends SimpleModule { new NamedType(BeaconClient.ApiClientInformation.class), new NamedType(BeaconClient.CliClientInformation.class), new NamedType(BeaconClient.DaemonInformation.class), - new NamedType(BeaconClient.ReachableCheckInformation.class) - ); + new NamedType(BeaconClient.ReachableCheckInformation.class)); } } diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java b/beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java index c7c5a75a..1a3a6804 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconProxyImpl.java @@ -74,15 +74,16 @@ public class BeaconProxyImpl extends ProxyProvider { @Override @SuppressWarnings("unchecked") - public T createRemoteReadConnection(DataSource source, ShellStore proxy) throws Exception { + public T createRemoteReadConnection(DataSource source, ShellStore proxy) + throws Exception { var downstream = downstreamTransform(source, proxy); BeaconClient client = null; try { client = BeaconClient.connectProxy(proxy); client.sendRequest(ProxyReadConnectionExchange.Request.builder() - .source(downstream) - .build()); + .source(downstream) + .build()); client.receiveResponse(); BeaconClient finalClient = client; var inputStream = new FilterInputStream(finalClient.receiveBody()) { @@ -105,15 +106,16 @@ public class BeaconProxyImpl extends ProxyProvider { @Override @SuppressWarnings("unchecked") - public T createRemoteWriteConnection(DataSource source, WriteMode mode, ShellStore proxy) throws Exception { + public T createRemoteWriteConnection( + DataSource source, WriteMode mode, ShellStore proxy) throws Exception { var downstream = downstreamTransform(source, proxy); BeaconClient client = null; try { client = BeaconClient.connectProxy(proxy); client.sendRequest(ProxyWriteConnectionExchange.Request.builder() - .source(downstream) - .build()); + .source(downstream) + .build()); BeaconClient finalClient = client; var outputStream = new FilterOutputStream(client.sendBody()) { @Override @@ -124,7 +126,8 @@ public class BeaconProxyImpl extends ProxyProvider { finalClient.close(); } }; - var outputSource = DataSource.createInternalDataSource(source.getType(), new OutputStreamStore(outputStream)); + var outputSource = + DataSource.createInternalDataSource(source.getType(), new OutputStreamStore(outputStream)); return (T) outputSource.openWriteConnection(mode); } catch (Exception ex) { if (client != null) { diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java b/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java index 79b8dce1..e462297f 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconServer.java @@ -30,9 +30,9 @@ public class BeaconServer { if (custom != null) { var command = ShellTypes.getPlatformDefault() .executeCommandListWithShell(custom - + (BeaconConfig.getDaemonArguments() != null - ? " " + BeaconConfig.getDaemonArguments() - : "")); + + (BeaconConfig.getDaemonArguments() != null + ? " " + BeaconConfig.getDaemonArguments() + : "")); Process process = Runtime.getRuntime().exec(command.toArray(String[]::new)); printDaemonOutput(process, command); return process; @@ -43,7 +43,8 @@ public class BeaconServer { public static Process start(String installationBase, XPipeDaemonMode mode) throws Exception { String command; if (!BeaconConfig.launchDaemonInDebugMode()) { - command = XPipeInstallation.createExternalAsyncLaunchCommand(installationBase, mode, BeaconConfig.getDaemonArguments()); + command = XPipeInstallation.createExternalAsyncLaunchCommand( + installationBase, mode, BeaconConfig.getDaemonArguments()); } else { command = XPipeInstallation.createExternalLaunchCommand( getDaemonDebugExecutable(installationBase), BeaconConfig.getDaemonArguments(), mode); @@ -77,8 +78,7 @@ public class BeaconServer { ioe.printStackTrace(); } }, - "daemon sysout" - ); + "daemon sysout"); out.setDaemon(true); out.start(); @@ -98,8 +98,7 @@ public class BeaconServer { ioe.printStackTrace(); } }, - "daemon syserr" - ); + "daemon syserr"); err.setDaemon(true); err.start(); } @@ -117,8 +116,7 @@ public class BeaconServer { throw new IllegalStateException(); } else { if (BeaconConfig.attachDebuggerToDaemon()) { - return FileNames.join( - installationBase, XPipeInstallation.getDaemonDebugAttachScriptPath(osType)); + return FileNames.join(installationBase, XPipeInstallation.getDaemonDebugAttachScriptPath(osType)); } else { return FileNames.join(installationBase, XPipeInstallation.getDaemonDebugScriptPath(osType)); } diff --git a/beacon/src/main/java/io/xpipe/beacon/ClientException.java b/beacon/src/main/java/io/xpipe/beacon/ClientException.java index 74f4364a..784d9b64 100644 --- a/beacon/src/main/java/io/xpipe/beacon/ClientException.java +++ b/beacon/src/main/java/io/xpipe/beacon/ClientException.java @@ -5,8 +5,7 @@ package io.xpipe.beacon; */ public class ClientException extends Exception { - public ClientException() { - } + public ClientException() {} public ClientException(String message) { super(message); diff --git a/beacon/src/main/java/io/xpipe/beacon/ConnectorException.java b/beacon/src/main/java/io/xpipe/beacon/ConnectorException.java index 8f5841f5..83a14dbc 100644 --- a/beacon/src/main/java/io/xpipe/beacon/ConnectorException.java +++ b/beacon/src/main/java/io/xpipe/beacon/ConnectorException.java @@ -5,8 +5,7 @@ package io.xpipe.beacon; */ public class ConnectorException extends Exception { - public ConnectorException() { - } + public ConnectorException() {} public ConnectorException(String message) { super(message); diff --git a/beacon/src/main/java/io/xpipe/beacon/RequestMessage.java b/beacon/src/main/java/io/xpipe/beacon/RequestMessage.java index d8b65c3b..9f9a5c2d 100644 --- a/beacon/src/main/java/io/xpipe/beacon/RequestMessage.java +++ b/beacon/src/main/java/io/xpipe/beacon/RequestMessage.java @@ -1,4 +1,3 @@ package io.xpipe.beacon; -public interface RequestMessage { -} +public interface RequestMessage {} diff --git a/beacon/src/main/java/io/xpipe/beacon/ResponseMessage.java b/beacon/src/main/java/io/xpipe/beacon/ResponseMessage.java index 859fe14d..ec167994 100644 --- a/beacon/src/main/java/io/xpipe/beacon/ResponseMessage.java +++ b/beacon/src/main/java/io/xpipe/beacon/ResponseMessage.java @@ -1,4 +1,3 @@ package io.xpipe.beacon; -public interface ResponseMessage { -} +public interface ResponseMessage {} diff --git a/beacon/src/main/java/io/xpipe/beacon/SecretProviderImpl.java b/beacon/src/main/java/io/xpipe/beacon/SecretProviderImpl.java index 9554f7f8..ed442f9a 100644 --- a/beacon/src/main/java/io/xpipe/beacon/SecretProviderImpl.java +++ b/beacon/src/main/java/io/xpipe/beacon/SecretProviderImpl.java @@ -31,7 +31,6 @@ public class SecretProviderImpl extends SecretProvider { return nonce; } - private static SecretKey getAESKey(int keysize) throws NoSuchAlgorithmException, InvalidKeySpecException { SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); var salt = new byte[16]; diff --git a/beacon/src/main/java/io/xpipe/beacon/ServerException.java b/beacon/src/main/java/io/xpipe/beacon/ServerException.java index 470f4120..d25c2272 100644 --- a/beacon/src/main/java/io/xpipe/beacon/ServerException.java +++ b/beacon/src/main/java/io/xpipe/beacon/ServerException.java @@ -5,8 +5,7 @@ package io.xpipe.beacon; */ public class ServerException extends Exception { - public ServerException() { - } + public ServerException() {} public ServerException(String message) { super(message); diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/FocusExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/FocusExchange.java index 4f41d1e2..e8c77c1c 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/FocusExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/FocusExchange.java @@ -26,6 +26,5 @@ public class FocusExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java index 971d92ac..a8c7eba7 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/ForwardExchange.java @@ -31,6 +31,5 @@ public class ForwardExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/OpenExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/OpenExchange.java index 6eecc77b..84a58e08 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/OpenExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/OpenExchange.java @@ -20,12 +20,12 @@ public class OpenExchange implements MessageExchange { @Builder @Value public static class Request implements RequestMessage { - @NonNull List arguments; + @NonNull + List arguments; } @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java index 32d6e65a..9b931596 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyFunctionExchange.java @@ -21,14 +21,8 @@ public class ProxyFunctionExchange implements MessageExchange { @Value public static class Request implements RequestMessage { - @JsonSerialize( - using = ProxyFunction.Serializer.class, - as = ProxyFunction.class - ) - @JsonDeserialize( - using = ProxyFunction.Deserializer.class, - as = ProxyFunction.class - ) + @JsonSerialize(using = ProxyFunction.Serializer.class, as = ProxyFunction.class) + @JsonDeserialize(using = ProxyFunction.Deserializer.class, as = ProxyFunction.class) ProxyFunction function; } @@ -37,14 +31,8 @@ public class ProxyFunctionExchange implements MessageExchange { @Value public static class Response implements ResponseMessage { - @JsonSerialize( - using = ProxyFunction.Serializer.class, - as = ProxyFunction.class - ) - @JsonDeserialize( - using = ProxyFunction.Deserializer.class, - as = ProxyFunction.class - ) + @JsonSerialize(using = ProxyFunction.Serializer.class, as = ProxyFunction.class) + @JsonDeserialize(using = ProxyFunction.Deserializer.class, as = ProxyFunction.class) ProxyFunction function; } } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyReadConnectionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyReadConnectionExchange.java index 75e4a37e..3e3e7c80 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyReadConnectionExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyReadConnectionExchange.java @@ -19,12 +19,12 @@ public class ProxyReadConnectionExchange implements MessageExchange { @Builder @Value public static class Request implements RequestMessage { - @NonNull DataSource source; + @NonNull + DataSource source; } @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyWriteConnectionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyWriteConnectionExchange.java index ab0aed91..83fe894a 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyWriteConnectionExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/ProxyWriteConnectionExchange.java @@ -20,13 +20,15 @@ public class ProxyWriteConnectionExchange implements MessageExchange { @Builder @Value public static class Request implements RequestMessage { - @NonNull DataSource source; - @NonNull WriteMode mode; + @NonNull + DataSource source; + + @NonNull + WriteMode mode; } @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/QueryDataSourceExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/QueryDataSourceExchange.java index 1ad41b22..3b534996 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/QueryDataSourceExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/QueryDataSourceExchange.java @@ -43,7 +43,8 @@ public class QueryDataSourceExchange implements MessageExchange { @NonNull String provider; - @NonNull DataSourceType type; + @NonNull + DataSourceType type; @NonNull LinkedHashMap config; diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/ReadStreamExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/ReadStreamExchange.java index 58d8ec1e..6241cae9 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/ReadStreamExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/ReadStreamExchange.java @@ -21,12 +21,12 @@ public class ReadStreamExchange implements MessageExchange { @Builder @Value public static class Request implements RequestMessage { - @NonNull String name; + @NonNull + String name; } @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/StopExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/StopExchange.java index 116b27be..bb749814 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/StopExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/StopExchange.java @@ -19,8 +19,7 @@ public class StopExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Request implements RequestMessage { - } + public static class Request implements RequestMessage {} @Jacksonized @Builder diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/WriteStreamExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/WriteStreamExchange.java index 1f3b0acc..aaed9496 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/WriteStreamExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/WriteStreamExchange.java @@ -21,12 +21,12 @@ public class WriteStreamExchange implements MessageExchange { @Builder @Value public static class Request implements RequestMessage { - @NonNull String name; + @NonNull + String name; } @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryRawDataExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryRawDataExchange.java index 92bd9dd8..73cfa543 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryRawDataExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryRawDataExchange.java @@ -29,6 +29,5 @@ public class QueryRawDataExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTableDataExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTableDataExchange.java index 7cd1a630..cd648fca 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTableDataExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTableDataExchange.java @@ -34,6 +34,7 @@ public class QueryTableDataExchange implements MessageExchange { @Builder @Value public static class Response implements ResponseMessage { - @NonNull TupleType dataType; + @NonNull + TupleType dataType; } } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTextDataExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTextDataExchange.java index fe5616c0..0eb5acee 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTextDataExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/api/QueryTextDataExchange.java @@ -30,6 +30,5 @@ public class QueryTextDataExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/InstanceExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/InstanceExchange.java index f00299aa..9f080bb8 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/InstanceExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/InstanceExchange.java @@ -19,8 +19,7 @@ public class InstanceExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Request implements RequestMessage { - } + public static class Request implements RequestMessage {} @Jacksonized @Builder diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListCollectionsExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListCollectionsExchange.java index e0a85698..b010c53b 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListCollectionsExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListCollectionsExchange.java @@ -20,8 +20,7 @@ public class ListCollectionsExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Request implements RequestMessage { - } + public static class Request implements RequestMessage {} @Jacksonized @Builder diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListStoresExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListStoresExchange.java index 62846f1b..da6a507e 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListStoresExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ListStoresExchange.java @@ -20,8 +20,7 @@ public class ListStoresExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Request implements RequestMessage { - } + public static class Request implements RequestMessage {} @Jacksonized @Builder diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ReadDrainExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ReadDrainExchange.java index 89f7179c..939baf2a 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ReadDrainExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/ReadDrainExchange.java @@ -30,6 +30,5 @@ public class ReadDrainExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveCollectionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveCollectionExchange.java index ba0dc7fc..357c2457 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveCollectionExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveCollectionExchange.java @@ -26,6 +26,5 @@ public class RemoveCollectionExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveStoreExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveStoreExchange.java index caccde8b..95dd9732 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveStoreExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RemoveStoreExchange.java @@ -26,6 +26,5 @@ public class RemoveStoreExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameCollectionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameCollectionExchange.java index 82ae32bb..192fcc34 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameCollectionExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameCollectionExchange.java @@ -29,6 +29,5 @@ public class RenameCollectionExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameEntryExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameEntryExchange.java index 094a0321..67387232 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameEntryExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameEntryExchange.java @@ -31,6 +31,5 @@ public class RenameEntryExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameStoreExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameStoreExchange.java index cf8eddb2..0a271212 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameStoreExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/RenameStoreExchange.java @@ -29,6 +29,5 @@ public class RenameStoreExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java index eaf1f3ab..7c0017df 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SelectExchange.java @@ -27,6 +27,5 @@ public class SelectExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Response implements ResponseMessage { - } + public static class Response implements ResponseMessage {} } diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java index 3a3e5f04..f0b272f6 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/SourceProviderListExchange.java @@ -23,8 +23,7 @@ public class SourceProviderListExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Request implements RequestMessage { - } + public static class Request implements RequestMessage {} @Jacksonized @Builder diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StatusExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StatusExchange.java index 2de24b6e..255a2570 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StatusExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StatusExchange.java @@ -17,8 +17,7 @@ public class StatusExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Request implements RequestMessage { - } + public static class Request implements RequestMessage {} @Jacksonized @Builder diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StoreProviderListExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StoreProviderListExchange.java index 88850ac4..ee5511dd 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StoreProviderListExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/StoreProviderListExchange.java @@ -22,8 +22,7 @@ public class StoreProviderListExchange implements MessageExchange { @Jacksonized @Builder @Value - public static class Request implements RequestMessage { - } + public static class Request implements RequestMessage {} @Jacksonized @Builder diff --git a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/VersionExchange.java b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/VersionExchange.java index 58ce8189..41a9c050 100644 --- a/beacon/src/main/java/io/xpipe/beacon/exchange/cli/VersionExchange.java +++ b/beacon/src/main/java/io/xpipe/beacon/exchange/cli/VersionExchange.java @@ -17,8 +17,7 @@ public class VersionExchange implements MessageExchange { @lombok.extern.jackson.Jacksonized @lombok.Builder @lombok.Value - public static class Request implements RequestMessage { - } + public static class Request implements RequestMessage {} @Jacksonized @Builder diff --git a/beacon/src/main/java/io/xpipe/beacon/util/QuietDialogHandler.java b/beacon/src/main/java/io/xpipe/beacon/util/QuietDialogHandler.java index 2fce1525..d77b0720 100644 --- a/beacon/src/main/java/io/xpipe/beacon/util/QuietDialogHandler.java +++ b/beacon/src/main/java/io/xpipe/beacon/util/QuietDialogHandler.java @@ -17,6 +17,7 @@ public class QuietDialogHandler { private final BeaconConnection connection; private final Map overrides; private DialogElement element; + public QuietDialogHandler(DialogReference ref, BeaconConnection connection, Map overrides) { this.dialogKey = ref.getDialogId(); this.element = ref.getStart(); @@ -40,9 +41,9 @@ public class QuietDialogHandler { } DialogExchange.Response res = connection.performSimpleExchange(DialogExchange.Request.builder() - .dialogKey(dialogKey) - .value(response) - .build()); + .dialogKey(dialogKey) + .value(response) + .build()); if (res.getElement() != null && element.equals(res.getElement())) { throw new BeaconException( "Invalid value for key " + res.getElement().toDisplayString()); diff --git a/beacon/src/main/java/module-info.java b/beacon/src/main/java/module-info.java index 6a9780d2..32d780ba 100644 --- a/beacon/src/main/java/module-info.java +++ b/beacon/src/main/java/module-info.java @@ -23,7 +23,9 @@ module io.xpipe.beacon { opens io.xpipe.beacon.exchange.api; opens io.xpipe.beacon.exchange.data; opens io.xpipe.beacon.exchange.cli; + exports io.xpipe.beacon.util; + opens io.xpipe.beacon.util; requires static com.fasterxml.jackson.core; @@ -34,9 +36,12 @@ module io.xpipe.beacon { uses MessageExchange; uses ProxyFunction; - provides ProxyProvider with BeaconProxyImpl; - provides SecretProvider with SecretProviderImpl; - provides Module with BeaconJacksonModule; + provides ProxyProvider with + BeaconProxyImpl; + provides SecretProvider with + SecretProviderImpl; + provides Module with + BeaconJacksonModule; provides io.xpipe.beacon.exchange.MessageExchange with ForwardExchange, InstanceExchange, diff --git a/core/src/main/java/io/xpipe/core/charsetter/Charsetter.java b/core/src/main/java/io/xpipe/core/charsetter/Charsetter.java index b3159f52..6c747963 100644 --- a/core/src/main/java/io/xpipe/core/charsetter/Charsetter.java +++ b/core/src/main/java/io/xpipe/core/charsetter/Charsetter.java @@ -23,8 +23,7 @@ public abstract class Charsetter { public static Charsetter INSTANCE; private static CharsetterUniverse universe; - protected Charsetter() { - } + protected Charsetter() {} protected static void checkInit() { if (universe == null) { @@ -78,8 +77,7 @@ public abstract class Charsetter { } public abstract Result read( - FailableSupplier in, FailableConsumer con - ) + FailableSupplier in, FailableConsumer con) throws Exception; public Result detect(StreamDataStore store) throws Exception { @@ -112,7 +110,9 @@ public abstract class Charsetter { if (store instanceof FileStore fileStore && fileStore.getFileSystem() instanceof MachineStore m) { if (result.getNewLine() == null) { - result = new Result(result.getCharset(), m.getShellType() != null ? m.getShellType().getNewLine() : null); + result = new Result( + result.getCharset(), + m.getShellType() != null ? m.getShellType().getNewLine() : null); } } diff --git a/core/src/main/java/io/xpipe/core/charsetter/StreamCharset.java b/core/src/main/java/io/xpipe/core/charsetter/StreamCharset.java index 1a970687..26d43e00 100644 --- a/core/src/main/java/io/xpipe/core/charsetter/StreamCharset.java +++ b/core/src/main/java/io/xpipe/core/charsetter/StreamCharset.java @@ -19,13 +19,8 @@ public class StreamCharset { public static final StreamCharset UTF8_BOM = new StreamCharset( StandardCharsets.UTF_8, - new byte[]{ - (byte) 0xEF, - (byte) 0xBB, - (byte) 0xBF - }, - Identifiers.get("utf", "8", "bom") - ); + new byte[] {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF}, + Identifiers.get("utf", "8", "bom")); // ====== // UTF-16 @@ -36,24 +31,16 @@ public class StreamCharset { public static final StreamCharset UTF16_BE_BOM = new StreamCharset( StandardCharsets.UTF_16BE, - new byte[]{ - (byte) 0xFE, - (byte) 0xFF - }, - Identifiers.get("utf", "16", "be", "bom") - ); + new byte[] {(byte) 0xFE, (byte) 0xFF}, + Identifiers.get("utf", "16", "be", "bom")); public static final StreamCharset UTF16_LE = new StreamCharset(StandardCharsets.UTF_16LE, null, Identifiers.get("utf", "16", "le")); public static final StreamCharset UTF16_LE_BOM = new StreamCharset( StandardCharsets.UTF_16LE, - new byte[]{ - (byte) 0xFF, - (byte) 0xFE - }, - Identifiers.get("utf", "16", "le", "bom") - ); + new byte[] {(byte) 0xFF, (byte) 0xFE}, + Identifiers.get("utf", "16", "le", "bom")); public static final StreamCharset UTF16 = UTF16_LE; @@ -67,8 +54,7 @@ public class StreamCharset { new StreamCharset( StandardCharsets.US_ASCII, null, - Identifiers.join(Identifiers.get("ascii"), Identifiers.get("us", "ascii")) - ), + Identifiers.join(Identifiers.get("ascii"), Identifiers.get("us", "ascii"))), new StreamCharset( StandardCharsets.ISO_8859_1, null, @@ -76,20 +62,15 @@ public class StreamCharset { Identifiers.get("iso", "8859"), Identifiers.get("iso", "8859", "1"), Identifiers.get("8859"), - Identifiers.get("8859", "1") - ) - ), + Identifiers.get("8859", "1"))), new StreamCharset( Charset.forName("Windows-1251"), null, - Identifiers.join(Identifiers.get("windows", "1251"), Identifiers.get("1251")) - ), + Identifiers.join(Identifiers.get("windows", "1251"), Identifiers.get("1251"))), new StreamCharset( Charset.forName("Windows-1252"), null, - Identifiers.join(Identifiers.get("windows", "1252"), Identifiers.get("1252")) - ) - ); + Identifiers.join(Identifiers.get("windows", "1252"), Identifiers.get("1252")))); // ====== // UTF-32 @@ -98,26 +79,16 @@ public class StreamCharset { new StreamCharset(Charset.forName("utf-32le"), null, Identifiers.get("utf", "32", "le")); public static final StreamCharset UTF32_LE_BOM = new StreamCharset( Charset.forName("utf-32le"), - new byte[]{ - 0x00, - 0x00, - (byte) 0xFE, - (byte) 0xFF - }, - Identifiers.get("utf", "32", "le", "bom") - ); + new byte[] {0x00, 0x00, (byte) 0xFE, (byte) 0xFF}, + Identifiers.get("utf", "32", "le", "bom")); public static final StreamCharset UTF32_BE = new StreamCharset(Charset.forName("utf-32be"), null, Identifiers.get("utf", "32", "be")); public static final StreamCharset UTF32_BE_BOM = new StreamCharset( Charset.forName("utf-32be"), - new byte[]{ - (byte) 0xFF, - (byte) 0xFE, - 0x00, - 0x00, - }, - Identifiers.get("utf", "32", "be", "bom") - ); + new byte[] { + (byte) 0xFF, (byte) 0xFE, 0x00, 0x00, + }, + Identifiers.get("utf", "32", "be", "bom")); private static final List RARE_NAMED = List.of(UTF16_LE, UTF16_LE_BOM, UTF16_BE, UTF16_BE_BOM, UTF32_LE, UTF32_LE_BOM, UTF32_BE, UTF32_BE_BOM); @@ -130,19 +101,17 @@ public class StreamCharset { && !charset.displayName().startsWith("X-") && !charset.displayName().endsWith("-BOM") && COMMON.stream() - .noneMatch(c -> c.getCharset().equals(charset)) + .noneMatch(c -> c.getCharset().equals(charset)) && RARE_NAMED.stream() - .noneMatch(c -> c.getCharset().equals(charset))) + .noneMatch(c -> c.getCharset().equals(charset))) .map(charset -> new StreamCharset( charset, null, - Identifiers.get(charset.name().split("-")) - )) - ) + Identifiers.get(charset.name().split("-"))))) .toList(); - public static final List ALL = Stream.concat(COMMON.stream(), RARE.stream()).toList(); - + public static final List ALL = + Stream.concat(COMMON.stream(), RARE.stream()).toList(); Charset charset; byte[] byteOrderMark; @@ -151,13 +120,15 @@ public class StreamCharset { public static StreamCharset get(Charset charset, boolean byteOrderMark) { return ALL.stream() .filter(streamCharset -> - streamCharset.getCharset().equals(charset) && streamCharset.hasByteOrderMark() == byteOrderMark) + streamCharset.getCharset().equals(charset) && streamCharset.hasByteOrderMark() == byteOrderMark) .findFirst() .orElseThrow(); } public static StreamCharset get(String s) { - var found = ALL.stream().filter(streamCharset -> streamCharset.getNames().contains(s.toLowerCase(Locale.ROOT))).findFirst(); + var found = ALL.stream() + .filter(streamCharset -> streamCharset.getNames().contains(s.toLowerCase(Locale.ROOT))) + .findFirst(); if (found.isEmpty()) { throw new IllegalArgumentException("Unknown charset name: " + s); } diff --git a/core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java b/core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java index 3059960c..739c8bb6 100644 --- a/core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java +++ b/core/src/main/java/io/xpipe/core/data/generic/GenericArrayReader.java @@ -17,8 +17,7 @@ public class GenericArrayReader implements GenericAbstractReader { private GenericAbstractReader currentReader; private DataStructureNode created; - public GenericArrayReader() { - } + public GenericArrayReader() {} public static GenericArrayReader newReader(int length) { var ar = new GenericArrayReader(); diff --git a/core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java b/core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java index 4ca04cd6..be1e0ba5 100644 --- a/core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java +++ b/core/src/main/java/io/xpipe/core/data/generic/GenericDataStreamCallback.java @@ -4,21 +4,15 @@ import java.util.Map; public interface GenericDataStreamCallback { - default void onName(String name) { - } + default void onName(String name) {} - default void onArrayStart(int length) { - } + default void onArrayStart(int length) {} - default void onArrayEnd(Map metaAttributes) { - } + default void onArrayEnd(Map metaAttributes) {} - default void onTupleStart(int length) { - } + default void onTupleStart(int length) {} - default void onTupleEnd(Map metaAttributes) { - } + default void onTupleEnd(Map metaAttributes) {} - default void onValue(byte[] value, Map metaAttributes) { - } + default void onValue(byte[] value, Map metaAttributes) {} } diff --git a/core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java b/core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java index 796d3da6..af7712d9 100644 --- a/core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java +++ b/core/src/main/java/io/xpipe/core/data/generic/GenericTupleReader.java @@ -19,8 +19,7 @@ public class GenericTupleReader implements GenericAbstractReader { private GenericAbstractReader currentReader; private DataStructureNode created; - public GenericTupleReader() { - } + public GenericTupleReader() {} public static GenericTupleReader newReader(int length) { var tr = new GenericTupleReader(); diff --git a/core/src/main/java/io/xpipe/core/data/node/ArrayNode.java b/core/src/main/java/io/xpipe/core/data/node/ArrayNode.java index 8658271f..3bcef8ae 100644 --- a/core/src/main/java/io/xpipe/core/data/node/ArrayNode.java +++ b/core/src/main/java/io/xpipe/core/data/node/ArrayNode.java @@ -8,8 +8,7 @@ import java.util.stream.Collectors; public abstract class ArrayNode extends DataStructureNode { - protected ArrayNode() { - } + protected ArrayNode() {} public static ArrayNode empty() { return of(List.of()); @@ -57,7 +56,6 @@ public abstract class ArrayNode extends DataStructureNode { return "array node"; } - @Override public final String toString(int indent) { var content = getNodes().stream().map(n -> n.toString(indent)).collect(Collectors.joining(", ")); diff --git a/core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java b/core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java index 05a053a1..b9b5ca65 100644 --- a/core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java +++ b/core/src/main/java/io/xpipe/core/data/node/DataStructureNode.java @@ -129,13 +129,13 @@ public abstract class DataStructureNode implements Iterable { public String metaToString() { return "(" + (metaAttributes != null - ? metaAttributes.entrySet().stream() - .sorted(Comparator.comparingInt(entry -> entry.getKey())) - .map(e -> e.getValue() != null - ? e.getKey() + ":" + e.getValue() - : e.getKey().toString()) - .collect(Collectors.joining("|")) - : "") + ? metaAttributes.entrySet().stream() + .sorted(Comparator.comparingInt(entry -> entry.getKey())) + .map(e -> e.getValue() != null + ? e.getKey() + ":" + e.getValue() + : e.getKey().toString()) + .collect(Collectors.joining("|")) + : "") + ")"; } @@ -242,6 +242,5 @@ public abstract class DataStructureNode implements Iterable { throw unsupported("iterator creation"); } - public record KeyValue(String key, DataStructureNode value) { - } + public record KeyValue(String key, DataStructureNode value) {} } diff --git a/core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java b/core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java index c52114c3..7425b9f2 100644 --- a/core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java +++ b/core/src/main/java/io/xpipe/core/data/node/DataStructureNodePointer.java @@ -217,8 +217,7 @@ public class DataStructureNodePointer { } public Builder pointerEvaluation( - DataStructureNodePointer pointer, Function converter - ) { + DataStructureNodePointer pointer, Function converter) { path.add(new FunctionElement((current) -> { var res = pointer.get(current); if (res != null) { diff --git a/core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java b/core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java index 7385b24c..29fee248 100644 --- a/core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java +++ b/core/src/main/java/io/xpipe/core/data/node/LinkedTupleNode.java @@ -86,8 +86,7 @@ public class LinkedTupleNode extends TupleNode { public DataType determineDataType() { return TupleType.of( getKeyNames(), - getNodes().stream().map(DataStructureNode::determineDataType).toList() - ); + getNodes().stream().map(DataStructureNode::determineDataType).toList()); } @Override diff --git a/core/src/main/java/io/xpipe/core/data/node/TupleNode.java b/core/src/main/java/io/xpipe/core/data/node/TupleNode.java index 88bed717..d958015c 100644 --- a/core/src/main/java/io/xpipe/core/data/node/TupleNode.java +++ b/core/src/main/java/io/xpipe/core/data/node/TupleNode.java @@ -116,9 +116,8 @@ public abstract class TupleNode extends DataStructureNode { boolean hasKeys = entries.stream().anyMatch(kv -> kv.key() != null); return hasKeys ? TupleNode.of( - entries.stream().map(KeyValue::key).toList(), - entries.stream().map(KeyValue::value).toList() - ) + entries.stream().map(KeyValue::key).toList(), + entries.stream().map(KeyValue::value).toList()) : TupleNode.of(entries.stream().map(KeyValue::value).toList()); } } diff --git a/core/src/main/java/io/xpipe/core/data/node/ValueNode.java b/core/src/main/java/io/xpipe/core/data/node/ValueNode.java index 975a103d..cfbaa2cd 100644 --- a/core/src/main/java/io/xpipe/core/data/node/ValueNode.java +++ b/core/src/main/java/io/xpipe/core/data/node/ValueNode.java @@ -13,8 +13,7 @@ import java.util.Objects; public abstract class ValueNode extends DataStructureNode { - protected ValueNode() { - } + protected ValueNode() {} public static ValueNode nullValue() { return new SimpleValueNode(new byte[0]).tag(IS_NULL).asValue(); @@ -67,7 +66,8 @@ public abstract class ValueNode extends DataStructureNode { public static ValueNode ofBytes(byte[] data) { var created = of(data); if (data != null) { - created.tag(IS_BINARY);} + created.tag(IS_BINARY); + } return created; } diff --git a/core/src/main/java/io/xpipe/core/data/type/DataType.java b/core/src/main/java/io/xpipe/core/data/type/DataType.java index 737c545a..e51be181 100644 --- a/core/src/main/java/io/xpipe/core/data/type/DataType.java +++ b/core/src/main/java/io/xpipe/core/data/type/DataType.java @@ -10,10 +10,7 @@ import java.util.Optional; * To check whether a {@link DataStructureNode} instance conforms to the specified type, * the method {@link #matches(DataStructureNode)} can be used. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type" -) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public abstract class DataType { /** diff --git a/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java b/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java index aa513938..5b08de48 100644 --- a/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java +++ b/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitor.java @@ -2,15 +2,11 @@ package io.xpipe.core.data.type; public interface DataTypeVisitor { - default void onValue(ValueType type) { - } + default void onValue(ValueType type) {} - default void onTuple(TupleType type) { - } + default void onTuple(TupleType type) {} - default void onArray(ArrayType type) { - } + default void onArray(ArrayType type) {} - default void onWildcard(WildcardType type) { - } + default void onWildcard(WildcardType type) {} } diff --git a/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java b/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java index e4174e9a..addda547 100644 --- a/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java +++ b/core/src/main/java/io/xpipe/core/data/type/DataTypeVisitors.java @@ -41,8 +41,7 @@ public class DataTypeVisitors { * Creates a visitor that allows for visiting possible recursive columns of table. */ public static DataTypeVisitor table( - Consumer newTuple, Runnable endTuple, BiConsumer newValue - ) { + Consumer newTuple, Runnable endTuple, BiConsumer newValue) { return new DataTypeVisitor() { private final Stack tuples = new Stack<>(); private final Stack keyIndices = new Stack<>(); diff --git a/core/src/main/java/io/xpipe/core/data/type/TupleType.java b/core/src/main/java/io/xpipe/core/data/type/TupleType.java index a73b48cf..a629a589 100644 --- a/core/src/main/java/io/xpipe/core/data/type/TupleType.java +++ b/core/src/main/java/io/xpipe/core/data/type/TupleType.java @@ -65,7 +65,9 @@ public class TupleType extends DataType { throw new UnsupportedOperationException(); } - return new TupleType(subNames, subNames.stream().map(s -> types.get(getNames().indexOf(s))).toList()); + return new TupleType( + subNames, + subNames.stream().map(s -> types.get(getNames().indexOf(s))).toList()); } @Override diff --git a/core/src/main/java/io/xpipe/core/data/type/WildcardType.java b/core/src/main/java/io/xpipe/core/data/type/WildcardType.java index 28d1d6fb..17967c08 100644 --- a/core/src/main/java/io/xpipe/core/data/type/WildcardType.java +++ b/core/src/main/java/io/xpipe/core/data/type/WildcardType.java @@ -17,8 +17,7 @@ import java.util.Optional; @Value public class WildcardType extends DataType { - private WildcardType() { - } + private WildcardType() {} /** * Creates a new instance. diff --git a/core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java b/core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java index 9edea441..c662614d 100644 --- a/core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java +++ b/core/src/main/java/io/xpipe/core/data/typed/TypedDataStreamCallback.java @@ -7,27 +7,19 @@ import java.util.Map; public interface TypedDataStreamCallback { - default void onValue(byte[] data, Map metaAttributes) { - } + default void onValue(byte[] data, Map metaAttributes) {} - default void onGenericNode(DataStructureNode node) { - } + default void onGenericNode(DataStructureNode node) {} - default void onTupleBegin(TupleType type) { - } + default void onTupleBegin(TupleType type) {} - default void onTupleEnd(Map metaAttributes) { - } + default void onTupleEnd(Map metaAttributes) {} - default void onArrayBegin(int size) { - } + default void onArrayBegin(int size) {} - default void onArrayEnd(Map metaAttributes) { - } + default void onArrayEnd(Map metaAttributes) {} - default void onNodeBegin() { - } + default void onNodeBegin() {} - default void onNodeEnd() { - } + default void onNodeEnd() {} } 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 a8cc0da1..a3aba841 100644 --- a/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java +++ b/core/src/main/java/io/xpipe/core/dialog/BaseQueryElement.java @@ -21,8 +21,7 @@ public class BaseQueryElement extends DialogElement { @JsonCreator public BaseQueryElement( - String description, boolean newLine, boolean required, boolean secret, boolean quiet, String value - ) { + String description, boolean newLine, boolean required, boolean secret, boolean quiet, String value) { this.description = description; this.newLine = newLine; this.required = required; diff --git a/core/src/main/java/io/xpipe/core/dialog/Dialog.java b/core/src/main/java/io/xpipe/core/dialog/Dialog.java index f15721a6..43c94eb0 100644 --- a/core/src/main/java/io/xpipe/core/dialog/Dialog.java +++ b/core/src/main/java/io/xpipe/core/dialog/Dialog.java @@ -58,8 +58,11 @@ public abstract class Dialog { * @param selected the selected element index */ public static Dialog.Choice choice( - String description, List elements, boolean required, boolean quiet, int selected - ) { + String description, + List elements, + boolean required, + boolean quiet, + int selected) { Dialog.Choice c = new Dialog.Choice(description, elements, required, quiet, selected); c.evaluateTo(c::getSelected); return c; @@ -77,8 +80,7 @@ public abstract class Dialog { */ @SafeVarargs public static Dialog.Choice choice( - String description, Function toString, boolean required, boolean quiet, T def, T... vals - ) { + String description, Function toString, boolean required, boolean quiet, T def, T... vals) { var elements = Arrays.stream(vals) .map(v -> new io.xpipe.core.dialog.Choice(null, toString.apply(v))) .toList(); @@ -115,8 +117,7 @@ public abstract class Dialog { boolean required, boolean quiet, T value, - QueryConverter converter - ) { + QueryConverter converter) { var q = new Dialog.Query(description, newLine, required, quiet, value, converter, false); q.evaluateTo(q::getConvertedValue); return q; @@ -162,8 +163,7 @@ public abstract class Dialog { DialogElement currentElement = ds[current].receive(answer); if (currentElement == null) { DialogElement next = null; - while (current < ds.length - 1 && (next = ds[++current].start()) == null) { - } + while (current < ds.length - 1 && (next = ds[++current].start()) == null) {} ; return next; } @@ -354,8 +354,7 @@ public abstract class Dialog { List elements, boolean required, int selected, - Function c - ) { + Function c) { var choice = new ChoiceElement(description, elements, required, false, selected); return new Dialog() { @@ -468,7 +467,12 @@ public abstract class Dialog { private final ChoiceElement element; - private Choice(String description, List elements, boolean required, boolean quiet, int selected) { + private Choice( + String description, + List elements, + boolean required, + boolean quiet, + int selected) { this.element = new ChoiceElement(description, elements, required, quiet, selected); } @@ -502,8 +506,7 @@ public abstract class Dialog { boolean quiet, T value, QueryConverter converter, - boolean hidden - ) { + boolean hidden) { this.element = new QueryElement(description, newLine, required, quiet, value, converter, hidden); } diff --git a/core/src/main/java/io/xpipe/core/dialog/DialogCancelException.java b/core/src/main/java/io/xpipe/core/dialog/DialogCancelException.java index 2b070cee..e27b672f 100644 --- a/core/src/main/java/io/xpipe/core/dialog/DialogCancelException.java +++ b/core/src/main/java/io/xpipe/core/dialog/DialogCancelException.java @@ -5,8 +5,7 @@ package io.xpipe.core.dialog; */ public class DialogCancelException extends Exception { - public DialogCancelException() { - } + public DialogCancelException() {} public DialogCancelException(String message) { super(message); @@ -21,8 +20,7 @@ public class DialogCancelException extends Exception { } public DialogCancelException( - String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace - ) { + String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } } 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 dfb13aec..736025d1 100644 --- a/core/src/main/java/io/xpipe/core/dialog/DialogElement.java +++ b/core/src/main/java/io/xpipe/core/dialog/DialogElement.java @@ -8,10 +8,7 @@ import java.util.UUID; @EqualsAndHashCode @ToString -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type" -) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public abstract class DialogElement { protected String id; diff --git a/core/src/main/java/io/xpipe/core/dialog/DialogMapper.java b/core/src/main/java/io/xpipe/core/dialog/DialogMapper.java index cbb509fc..b767aa5d 100644 --- a/core/src/main/java/io/xpipe/core/dialog/DialogMapper.java +++ b/core/src/main/java/io/xpipe/core/dialog/DialogMapper.java @@ -34,8 +34,7 @@ public class DialogMapper { var newElement = dialog.next(response); if (element.equals(newElement)) { - throw new IllegalStateException( - "Loop for key " + newElement.toDisplayString()); + throw new IllegalStateException("Loop for key " + newElement.toDisplayString()); } element = newElement; diff --git a/core/src/main/java/io/xpipe/core/dialog/QueryElement.java b/core/src/main/java/io/xpipe/core/dialog/QueryElement.java index 2550d910..e2c374cf 100644 --- a/core/src/main/java/io/xpipe/core/dialog/QueryElement.java +++ b/core/src/main/java/io/xpipe/core/dialog/QueryElement.java @@ -14,8 +14,7 @@ public class QueryElement extends BaseQueryElement { boolean quiet, T value, QueryConverter converter, - boolean hidden - ) { + boolean hidden) { super(description, newLine, required, hidden, quiet, value != null ? converter.toString(value) : null); this.converter = converter; } diff --git a/core/src/main/java/io/xpipe/core/impl/LocalStore.java b/core/src/main/java/io/xpipe/core/impl/LocalStore.java index c70afc33..06f639fb 100644 --- a/core/src/main/java/io/xpipe/core/impl/LocalStore.java +++ b/core/src/main/java/io/xpipe/core/impl/LocalStore.java @@ -51,5 +51,4 @@ public class LocalStore extends JacksonizedValue implements FileSystemStore, Mac public ShellProcessControl createControl() { return ProcessControlProvider.createLocal(); } - } diff --git a/core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java b/core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java index f98a4211..34769d2f 100644 --- a/core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java +++ b/core/src/main/java/io/xpipe/core/impl/PreservingWriteConnection.java @@ -15,8 +15,7 @@ public class PreservingWriteConnection implements DataSourceConnection { private final boolean append; public PreservingWriteConnection( - DataSourceType type, DataSource source, boolean append, DataSourceConnection connection - ) { + DataSourceType type, DataSource source, boolean append, DataSourceConnection connection) { this.type = type; this.source = source; this.append = append; @@ -29,7 +28,7 @@ public class PreservingWriteConnection implements DataSourceConnection { var nativeSource = DataSource.createInternalDataSource(type, nativeStore); if (source.getStore().canOpen()) { try (var in = source.openReadConnection(); - var out = nativeSource.openWriteConnection(WriteMode.REPLACE)) { + var out = nativeSource.openWriteConnection(WriteMode.REPLACE)) { in.init(); out.init(); in.forward(out); diff --git a/core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java b/core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java index 5733d606..0391ed44 100644 --- a/core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java +++ b/core/src/main/java/io/xpipe/core/impl/SimpleTableWriteConnection.java @@ -9,7 +9,6 @@ import java.util.Optional; public interface SimpleTableWriteConnection> extends TableWriteConnection { - public T getSource(); public default Optional getType() throws Exception { diff --git a/core/src/main/java/io/xpipe/core/impl/SinkDrainStore.java b/core/src/main/java/io/xpipe/core/impl/SinkDrainStore.java index 4c4fdbea..0fca4509 100644 --- a/core/src/main/java/io/xpipe/core/impl/SinkDrainStore.java +++ b/core/src/main/java/io/xpipe/core/impl/SinkDrainStore.java @@ -94,7 +94,7 @@ public class SinkDrainStore extends JacksonizedValue implements KnownFormatStrea if (getState() == State.NONE_CONNECTED) { setState(State.CONSUMER_CONNECTED); - //waitForOpen(); + // waitForOpen(); } try { @@ -121,11 +121,12 @@ public class SinkDrainStore extends JacksonizedValue implements KnownFormatStrea if (getState() == State.NONE_CONNECTED) { setState(State.PRODUCER_CONNECTED); - //waitForOpen(); + // waitForOpen(); } try { - return new FilterOutputStream(Channels.newOutputStream(getOrOpenPipe().sink())) { + return new FilterOutputStream( + Channels.newOutputStream(getOrOpenPipe().sink())) { @Override public void close() throws IOException { super.close(); diff --git a/core/src/main/java/io/xpipe/core/impl/StdinDataStore.java b/core/src/main/java/io/xpipe/core/impl/StdinDataStore.java index 2766c8e9..4f3d3f2f 100644 --- a/core/src/main/java/io/xpipe/core/impl/StdinDataStore.java +++ b/core/src/main/java/io/xpipe/core/impl/StdinDataStore.java @@ -26,8 +26,7 @@ public class StdinDataStore extends JacksonizedValue implements StreamDataStore // Prevent closing the standard in when the returned input stream is closed return new FilterInputStream(in) { @Override - public void close() throws IOException { - } + public void close() throws IOException {} }; } } diff --git a/core/src/main/java/io/xpipe/core/impl/StdoutDataStore.java b/core/src/main/java/io/xpipe/core/impl/StdoutDataStore.java index 25a47df5..799c98f7 100644 --- a/core/src/main/java/io/xpipe/core/impl/StdoutDataStore.java +++ b/core/src/main/java/io/xpipe/core/impl/StdoutDataStore.java @@ -30,8 +30,7 @@ public class StdoutDataStore extends JacksonizedValue implements StreamDataStore // Create an output stream that will write to standard out but will not close it return new FilterOutputStream(System.out) { @Override - public void close() throws IOException { - } + public void close() throws IOException {} }; } } diff --git a/core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java b/core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java index 6d373eb2..efdcd08a 100644 --- a/core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java +++ b/core/src/main/java/io/xpipe/core/impl/XpbtReadConnection.java @@ -47,8 +47,7 @@ public class XpbtReadConnection extends StreamReadConnection implements TableRea this.inputStream.skip(headerLength + 1); List names = JacksonMapper.newMapper() .disable(JsonParser.Feature.AUTO_CLOSE_SOURCE) - .readerFor(new TypeReference>() { - }) + .readerFor(new TypeReference>() {}) .readValue(header); TupleType dataType = TupleType.tableType(names); this.dataType = dataType; diff --git a/core/src/main/java/io/xpipe/core/impl/XpbtWriteConnection.java b/core/src/main/java/io/xpipe/core/impl/XpbtWriteConnection.java index a9d66f49..18fd7ca8 100644 --- a/core/src/main/java/io/xpipe/core/impl/XpbtWriteConnection.java +++ b/core/src/main/java/io/xpipe/core/impl/XpbtWriteConnection.java @@ -19,6 +19,7 @@ public class XpbtWriteConnection extends StreamWriteConnection implements Simple @Getter private final XpbtSource source; + private TupleType writtenDescriptor; public XpbtWriteConnection(XpbtSource source) { @@ -53,5 +54,4 @@ public class XpbtWriteConnection extends StreamWriteConnection implements Simple } writer.flush(); } - } diff --git a/core/src/main/java/io/xpipe/core/process/CommandProcessControl.java b/core/src/main/java/io/xpipe/core/process/CommandProcessControl.java index 97a748b4..20803e30 100644 --- a/core/src/main/java/io/xpipe/core/process/CommandProcessControl.java +++ b/core/src/main/java/io/xpipe/core/process/CommandProcessControl.java @@ -11,6 +11,7 @@ public interface CommandProcessControl extends ProcessControl { @Override public CommandProcessControl sensitive(); + CommandProcessControl complex(); default InputStream startExternalStdout() throws Exception { diff --git a/core/src/main/java/io/xpipe/core/process/OsType.java b/core/src/main/java/io/xpipe/core/process/OsType.java index c62ab09e..6ec2c22f 100644 --- a/core/src/main/java/io/xpipe/core/process/OsType.java +++ b/core/src/main/java/io/xpipe/core/process/OsType.java @@ -51,8 +51,7 @@ public interface OsType { @Override public Map getProperties(ShellProcessControl pc) throws Exception { - try (CommandProcessControl c = - pc.command("systeminfo").start()) { + try (CommandProcessControl c = pc.command("systeminfo").start()) { var text = c.readOrThrow(); return PropertiesFormatsParser.parse(text, ":"); } @@ -144,7 +143,7 @@ public interface OsType { @Override public Map getProperties(ShellProcessControl pc) throws Exception { try (CommandProcessControl c = - pc.subShell(ShellTypes.BASH).command("sw_vers").start()) { + pc.subShell(ShellTypes.BASH).command("sw_vers").start()) { var text = c.readOrThrow(); return PropertiesFormatsParser.parse(text, ":"); } @@ -154,9 +153,9 @@ public interface OsType { public String determineOperatingSystemName(ShellProcessControl pc) throws Exception { var properties = getProperties(pc); var name = pc.executeStringSimpleCommand( - "awk '/SOFTWARE LICENSE AGREEMENT FOR macOS/' '/System/Library/CoreServices/Setup " + - "Assistant.app/Contents/Resources/en.lproj/OSXSoftwareLicense.rtf' | " + - "awk -F 'macOS ' '{print $NF}' | awk '{print substr($0, 0, length($0)-1)}'"); + "awk '/SOFTWARE LICENSE AGREEMENT FOR macOS/' '/System/Library/CoreServices/Setup " + + "Assistant.app/Contents/Resources/en.lproj/OSXSoftwareLicense.rtf' | " + + "awk -F 'macOS ' '{print $NF}' | awk '{print substr($0, 0, length($0)-1)}'"); return properties.get("ProductName") + " " + name + " " + properties.get("ProductVersion"); } } diff --git a/core/src/main/java/io/xpipe/core/process/ProcessControlProvider.java b/core/src/main/java/io/xpipe/core/process/ProcessControlProvider.java index 25b916ff..82095f51 100644 --- a/core/src/main/java/io/xpipe/core/process/ProcessControlProvider.java +++ b/core/src/main/java/io/xpipe/core/process/ProcessControlProvider.java @@ -13,34 +13,49 @@ public abstract class ProcessControlProvider { private static List INSTANCES; public static void init(ModuleLayer layer) { - INSTANCES = ServiceLoader.load(layer, ProcessControlProvider.class) - .stream().map(localProcessControlProviderProvider -> localProcessControlProviderProvider.get()).toList(); + INSTANCES = ServiceLoader.load(layer, ProcessControlProvider.class).stream() + .map(localProcessControlProviderProvider -> localProcessControlProviderProvider.get()) + .toList(); } public static ShellProcessControl createLocal() { - return INSTANCES.stream().map(localProcessControlProvider -> localProcessControlProvider.createLocalProcessControl()).filter( - Objects::nonNull).findFirst().orElseThrow(); + return INSTANCES.stream() + .map(localProcessControlProvider -> localProcessControlProvider.createLocalProcessControl()) + .filter(Objects::nonNull) + .findFirst() + .orElseThrow(); } public static ShellProcessControl createSub( ShellProcessControl parent, @NonNull FailableFunction commandFunction, FailableBiFunction terminalCommand) { - return INSTANCES.stream().map(localProcessControlProvider -> localProcessControlProvider.sub(parent, commandFunction, terminalCommand)).filter( - Objects::nonNull).findFirst().orElseThrow(); + return INSTANCES.stream() + .map(localProcessControlProvider -> + localProcessControlProvider.sub(parent, commandFunction, terminalCommand)) + .filter(Objects::nonNull) + .findFirst() + .orElseThrow(); } public static CommandProcessControl createCommand( ShellProcessControl parent, @NonNull FailableFunction command, FailableFunction terminalCommand) { - return INSTANCES.stream().map(localProcessControlProvider -> localProcessControlProvider.command(parent, command, terminalCommand)).filter( - Objects::nonNull).findFirst().orElseThrow(); + return INSTANCES.stream() + .map(localProcessControlProvider -> + localProcessControlProvider.command(parent, command, terminalCommand)) + .filter(Objects::nonNull) + .findFirst() + .orElseThrow(); } public static ShellProcessControl createSsh(Object sshStore) { - return INSTANCES.stream().map(localProcessControlProvider -> localProcessControlProvider.createSshControl(sshStore)).filter( - Objects::nonNull).findFirst().orElseThrow(); + return INSTANCES.stream() + .map(localProcessControlProvider -> localProcessControlProvider.createSshControl(sshStore)) + .filter(Objects::nonNull) + .findFirst() + .orElseThrow(); } public abstract ShellProcessControl sub( diff --git a/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java b/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java index a70cfbea..6cee4c40 100644 --- a/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java +++ b/core/src/main/java/io/xpipe/core/process/ProcessOutputException.java @@ -18,8 +18,7 @@ public class ProcessOutputException extends Exception { } protected ProcessOutputException( - String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace - ) { + String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } } diff --git a/core/src/main/java/io/xpipe/core/process/ShellProcessControl.java b/core/src/main/java/io/xpipe/core/process/ShellProcessControl.java index 83e75d5d..27b7f403 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellProcessControl.java +++ b/core/src/main/java/io/xpipe/core/process/ShellProcessControl.java @@ -22,7 +22,6 @@ public interface ShellProcessControl extends ProcessControl { public void checkRunning() throws Exception; - default String executeStringSimpleCommand(String command) throws Exception { try (CommandProcessControl c = command(command).start()) { return c.readOrThrow(); @@ -98,7 +97,8 @@ public interface ShellProcessControl extends ProcessControl { CommandProcessControl command(FailableFunction command); CommandProcessControl command( - FailableFunction command, FailableFunction terminalCommand); + FailableFunction command, + FailableFunction terminalCommand); default CommandProcessControl command(String command) { return command(shellProcessControl -> command); diff --git a/core/src/main/java/io/xpipe/core/process/ShellType.java b/core/src/main/java/io/xpipe/core/process/ShellType.java index 8d27ab76..7eaa602a 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellType.java +++ b/core/src/main/java/io/xpipe/core/process/ShellType.java @@ -8,10 +8,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type" -) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public interface ShellType { String getScriptFileEnding(); @@ -25,8 +22,8 @@ public interface ShellType { default String flatten(List command) { return command.stream() .map(s -> s.contains(" ") - && !(s.startsWith("\"") && s.endsWith("\"")) - && !(s.startsWith("'") && s.endsWith("'")) + && !(s.startsWith("\"") && s.endsWith("\"")) + && !(s.startsWith("'") && s.endsWith("'")) ? "\"" + s + "\"" : s) .collect(Collectors.joining(" ")); @@ -54,12 +51,10 @@ public interface ShellType { return getEchoCommand(s, false); } - String getSetEnvironmentVariableCommand(String variable, String value); - + String getSetEnvironmentVariableCommand(String variable, String value); String getEchoCommand(String s, boolean toErrorStream); - String getPrintVariableCommand(String name); String getPrintExitCodeCommand(String prefix); diff --git a/core/src/main/java/io/xpipe/core/process/ShellTypes.java b/core/src/main/java/io/xpipe/core/process/ShellTypes.java index 9ab41215..a398a62f 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellTypes.java +++ b/core/src/main/java/io/xpipe/core/process/ShellTypes.java @@ -34,13 +34,7 @@ public class ShellTypes { } public static ShellType[] getAllShellTypes() { - return new ShellType[]{ - CMD, - POWERSHELL, - ZSH, - BASH, - SH - }; + return new ShellType[] {CMD, POWERSHELL, ZSH, BASH, SH}; } @JsonTypeName("cmd") @@ -113,8 +107,7 @@ public class ShellTypes { } @Override - public void disableHistory(ShellProcessControl pc) throws IOException { - } + public void disableHistory(ShellProcessControl pc) throws IOException {} @Override public String getExitCodeVariable() { @@ -267,7 +260,8 @@ public class ShellTypes { @Override public String getFileTouchCommand(String file) { - return "$error_count=$error.Count; Out-File -FilePath \"" + file + "\"; $LASTEXITCODE=$error.Count - $error_count"; + return "$error_count=$error.Count; Out-File -FilePath \"" + file + + "\"; $LASTEXITCODE=$error.Count - $error_count"; } @Override @@ -448,7 +442,7 @@ public class ShellTypes { @Override public String getTextFileWriteCommand(String content, String file) { - return "echo -e '" + content.replaceAll("\n", "\\\\n").replaceAll("'","'\\\\''") + "' > \"" + file + "\""; + return "echo -e '" + content.replaceAll("\n", "\\\\n").replaceAll("'", "'\\\\''") + "' > \"" + file + "\""; } @Override diff --git a/core/src/main/java/io/xpipe/core/source/DataSource.java b/core/src/main/java/io/xpipe/core/source/DataSource.java index 40861cd5..6f05a9fc 100644 --- a/core/src/main/java/io/xpipe/core/source/DataSource.java +++ b/core/src/main/java/io/xpipe/core/source/DataSource.java @@ -23,10 +23,7 @@ import java.util.Optional; * This instance is only valid in combination with its associated data store instance. */ @SuperBuilder -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type" -) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public abstract class DataSource extends JacksonizedValue { protected DS store; @@ -42,7 +39,7 @@ public abstract class DataSource extends JacksonizedValue .charset(StreamCharset.UTF8) .build(); case RAW -> null; - // TODO + // TODO case COLLECTION -> null; }; } catch (Exception ex) { diff --git a/core/src/main/java/io/xpipe/core/source/DataSourceConnection.java b/core/src/main/java/io/xpipe/core/source/DataSourceConnection.java index 38c8a928..c44e3dec 100644 --- a/core/src/main/java/io/xpipe/core/source/DataSourceConnection.java +++ b/core/src/main/java/io/xpipe/core/source/DataSourceConnection.java @@ -9,9 +9,7 @@ public interface DataSourceConnection extends AutoCloseable { * Initializes this connection. Required to be called * exactly once prior to attempting to use this connection. */ - default void init() throws Exception { - } + default void init() throws Exception {} - default void close() throws Exception { - } + default void close() throws Exception {} } diff --git a/core/src/main/java/io/xpipe/core/source/TableReadConnection.java b/core/src/main/java/io/xpipe/core/source/TableReadConnection.java index f2450c4a..2f163db1 100644 --- a/core/src/main/java/io/xpipe/core/source/TableReadConnection.java +++ b/core/src/main/java/io/xpipe/core/source/TableReadConnection.java @@ -37,8 +37,7 @@ public interface TableReadConnection extends DataSourceReadConnection { } @Override - public void withRows(DataStructureNodeAcceptor lineAcceptor) throws Exception { - } + public void withRows(DataStructureNodeAcceptor lineAcceptor) throws Exception {} @Override public ArrayNode readRows(int maxLines) throws Exception { diff --git a/core/src/main/java/io/xpipe/core/source/WriteMode.java b/core/src/main/java/io/xpipe/core/source/WriteMode.java index 0fa9c4c6..44397bdb 100644 --- a/core/src/main/java/io/xpipe/core/source/WriteMode.java +++ b/core/src/main/java/io/xpipe/core/source/WriteMode.java @@ -17,8 +17,8 @@ public class WriteMode extends JacksonizedValue { public static void init(ModuleLayer layer) { if (ALL.size() == 0) { ALL.addAll(ServiceLoader.load(layer, WriteMode.class).stream() - .map(p -> p.get()) - .toList()); + .map(p -> p.get()) + .toList()); } } @@ -34,14 +34,11 @@ public class WriteMode extends JacksonizedValue { } @JsonTypeName("replace") - public static final class Replace extends WriteMode { - } + public static final class Replace extends WriteMode {} @JsonTypeName("append") - public static final class Append extends WriteMode { - } + public static final class Append extends WriteMode {} @JsonTypeName("prepend") - public static final class Prepend extends WriteMode { - } + public static final class Prepend extends WriteMode {} } diff --git a/core/src/main/java/io/xpipe/core/store/DataStore.java b/core/src/main/java/io/xpipe/core/store/DataStore.java index cb6e2690..450f36cd 100644 --- a/core/src/main/java/io/xpipe/core/store/DataStore.java +++ b/core/src/main/java/io/xpipe/core/store/DataStore.java @@ -16,10 +16,7 @@ import java.util.Optional; * * @see DataSource */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type" -) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public interface DataStore { default boolean shouldPersist() { @@ -78,11 +75,9 @@ public interface DataStore { * * @throws Exception if any part of the validation went wrong */ - default void validate() throws Exception { - } + default void validate() throws Exception {} - default void checkComplete() throws Exception { - } + default void checkComplete() throws Exception {} default boolean delete() throws Exception { return false; diff --git a/core/src/main/java/io/xpipe/core/store/MachineStore.java b/core/src/main/java/io/xpipe/core/store/MachineStore.java index b59de4d0..e6027888 100644 --- a/core/src/main/java/io/xpipe/core/store/MachineStore.java +++ b/core/src/main/java/io/xpipe/core/store/MachineStore.java @@ -11,8 +11,8 @@ public interface MachineStore extends FileSystemStore, ShellStore { @Override public default InputStream openInput(String file) throws Exception { - return create().command(proc -> proc.getShellType() - .getFileReadCommand(proc.getOsType().normalizeFileName(file))) + return create().command(proc -> + proc.getShellType().getFileReadCommand(proc.getOsType().normalizeFileName(file))) .startExternalStdout(); } @@ -36,7 +36,7 @@ public interface MachineStore extends FileSystemStore, ShellStore { public default boolean mkdirs(String file) throws Exception { try (var pc = create().command(proc -> proc.getShellType() .flatten(proc.getShellType() - .getMkdirsCommand(proc.getOsType().normalizeFileName(file)))) + .getMkdirsCommand(proc.getOsType().normalizeFileName(file)))) .start()) { return pc.discardAndCheckExit(); } diff --git a/core/src/main/java/io/xpipe/core/store/ShellStore.java b/core/src/main/java/io/xpipe/core/store/ShellStore.java index 38088551..a17086f7 100644 --- a/core/src/main/java/io/xpipe/core/store/ShellStore.java +++ b/core/src/main/java/io/xpipe/core/store/ShellStore.java @@ -8,8 +8,7 @@ import io.xpipe.core.process.ShellType; import java.nio.charset.Charset; -public interface ShellStore extends DataStore, StatefulDataStore -{ +public interface ShellStore extends DataStore, StatefulDataStore { public static MachineStore local() { return new LocalStore(); @@ -42,6 +41,7 @@ public interface ShellStore extends DataStore, StatefulDataStore default OsType getOsType() { return getState("os", OsType.class, null); } + default Charset getCharset() { return getState("charset", Charset.class, null); } @@ -56,8 +56,7 @@ public interface ShellStore extends DataStore, StatefulDataStore @Override default void validate() throws Exception { - try (ShellProcessControl pc = create().start()) { - } + try (ShellProcessControl pc = create().start()) {} } public default String queryMachineName() throws Exception { diff --git a/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java b/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java index 3a8af994..1bbb83f2 100644 --- a/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java +++ b/core/src/main/java/io/xpipe/core/util/CoreJacksonModule.java @@ -50,8 +50,7 @@ public class CoreJacksonModule extends SimpleModule { new NamedType(BaseQueryElement.class), new NamedType(ChoiceElement.class), new NamedType(BusyElement.class), - new NamedType(HeaderElement.class) - ); + new NamedType(HeaderElement.class)); for (ShellType t : ShellTypes.getAllShellTypes()) { context.registerSubtypes(new NamedType(t.getClass())); @@ -200,16 +199,12 @@ public class CoreJacksonModule extends SimpleModule { @JsonSerialize(as = Throwable.class) public abstract static class ThrowableTypeMixIn { - @JsonIdentityInfo( - generator = ObjectIdGenerators.StringIdGenerator.class, - property = "$id" - ) + @JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class, property = "$id") private Throwable cause; } @JsonSerialize(as = DataSourceReference.class) - public abstract static class DataSourceReferenceTypeMixIn { - } + public abstract static class DataSourceReferenceTypeMixIn {} public class NullSerializer extends JsonSerializer { public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) diff --git a/core/src/main/java/io/xpipe/core/util/Deobfuscator.java b/core/src/main/java/io/xpipe/core/util/Deobfuscator.java index 893e8a2b..367501fb 100644 --- a/core/src/main/java/io/xpipe/core/util/Deobfuscator.java +++ b/core/src/main/java/io/xpipe/core/util/Deobfuscator.java @@ -106,6 +106,8 @@ public class Deobfuscator { } var t = ShellTypes.getPlatformDefault(); - return ShellStore.local().create().executeBooleanSimpleCommand(t.getWhichCommand("retrace." + t.getScriptFileEnding())); + return ShellStore.local() + .create() + .executeBooleanSimpleCommand(t.getWhichCommand("retrace." + t.getScriptFileEnding())); } } diff --git a/core/src/main/java/io/xpipe/core/util/Identifiers.java b/core/src/main/java/io/xpipe/core/util/Identifiers.java index b710a051..a1d1a216 100644 --- a/core/src/main/java/io/xpipe/core/util/Identifiers.java +++ b/core/src/main/java/io/xpipe/core/util/Identifiers.java @@ -17,10 +17,6 @@ public class Identifiers { private static List nameAlternatives(List split) { return List.of( - String.join("", split), - String.join(" ", split), - String.join("_", split), - String.join("-", split) - ); + String.join("", split), String.join(" ", split), String.join("_", split), String.join("-", split)); } } 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 e031f153..15c4bc83 100644 --- a/core/src/main/java/io/xpipe/core/util/JacksonMapper.java +++ b/core/src/main/java/io/xpipe/core/util/JacksonMapper.java @@ -32,13 +32,13 @@ public class JacksonMapper { objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); objectMapper.setVisibility(objectMapper - .getSerializationConfig() - .getDefaultVisibilityChecker() - .withFieldVisibility(JsonAutoDetect.Visibility.ANY) - .withGetterVisibility(JsonAutoDetect.Visibility.NONE) - .withSetterVisibility(JsonAutoDetect.Visibility.NONE) - .withCreatorVisibility(JsonAutoDetect.Visibility.NONE) - .withIsGetterVisibility(JsonAutoDetect.Visibility.NONE)); + .getSerializationConfig() + .getDefaultVisibilityChecker() + .withFieldVisibility(JsonAutoDetect.Visibility.ANY) + .withGetterVisibility(JsonAutoDetect.Visibility.NONE) + .withSetterVisibility(JsonAutoDetect.Visibility.NONE) + .withCreatorVisibility(JsonAutoDetect.Visibility.NONE) + .withIsGetterVisibility(JsonAutoDetect.Visibility.NONE)); var modules = findModules(ModuleLayer.boot()); objectMapper.registerModules(modules); diff --git a/core/src/main/java/io/xpipe/core/util/JacksonizedValue.java b/core/src/main/java/io/xpipe/core/util/JacksonizedValue.java index 20e2bfcd..d0e77db5 100644 --- a/core/src/main/java/io/xpipe/core/util/JacksonizedValue.java +++ b/core/src/main/java/io/xpipe/core/util/JacksonizedValue.java @@ -5,14 +5,10 @@ import lombok.SneakyThrows; import lombok.experimental.SuperBuilder; @SuperBuilder -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type" -) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") public class JacksonizedValue { - public JacksonizedValue() { - } + public JacksonizedValue() {} @SneakyThrows public String toString() { diff --git a/core/src/main/java/io/xpipe/core/util/ProxyProvider.java b/core/src/main/java/io/xpipe/core/util/ProxyProvider.java index 30c3e363..a722c9c4 100644 --- a/core/src/main/java/io/xpipe/core/util/ProxyProvider.java +++ b/core/src/main/java/io/xpipe/core/util/ProxyProvider.java @@ -29,12 +29,10 @@ public abstract class ProxyProvider { public abstract boolean isRemote(Object base); public abstract T createRemoteReadConnection( - DataSource source, ShellStore proxy - ) throws Exception; + DataSource source, ShellStore proxy) throws Exception; public abstract T createRemoteWriteConnection( - DataSource source, WriteMode mode, ShellStore proxy - ) throws Exception; + DataSource source, WriteMode mode, ShellStore proxy) throws Exception; public abstract ProxyFunction call(ProxyFunction func, ShellStore proxy); } diff --git a/core/src/main/java/io/xpipe/core/util/SecretProvider.java b/core/src/main/java/io/xpipe/core/util/SecretProvider.java index ac7082ca..69634669 100644 --- a/core/src/main/java/io/xpipe/core/util/SecretProvider.java +++ b/core/src/main/java/io/xpipe/core/util/SecretProvider.java @@ -12,7 +12,9 @@ public abstract class SecretProvider { public static SecretProvider get() { if (INSTANCE == null) { - INSTANCE = ServiceLoader.load(ModuleLayer.boot(), SecretProvider.class).findFirst().orElseThrow(); + INSTANCE = ServiceLoader.load(ModuleLayer.boot(), SecretProvider.class) + .findFirst() + .orElseThrow(); } return INSTANCE; diff --git a/core/src/main/java/io/xpipe/core/util/SimpleProxyFunction.java b/core/src/main/java/io/xpipe/core/util/SimpleProxyFunction.java index c9877afb..b6eb3651 100644 --- a/core/src/main/java/io/xpipe/core/util/SimpleProxyFunction.java +++ b/core/src/main/java/io/xpipe/core/util/SimpleProxyFunction.java @@ -19,5 +19,4 @@ public abstract class SimpleProxyFunction extends ProxyFunction { var result = callAndCopy(); return ((SimpleProxyFunction) result).getResult(); } - } diff --git a/core/src/main/java/io/xpipe/core/util/UuidHelper.java b/core/src/main/java/io/xpipe/core/util/UuidHelper.java index ed03e325..73903243 100644 --- a/core/src/main/java/io/xpipe/core/util/UuidHelper.java +++ b/core/src/main/java/io/xpipe/core/util/UuidHelper.java @@ -9,7 +9,7 @@ public class UuidHelper { public static Optional parse(String s) { try { - return Optional.of(UUID.fromString(s)); + return Optional.of(UUID.fromString(s)); } catch (IllegalArgumentException ex) { return Optional.empty(); } diff --git a/core/src/main/java/io/xpipe/core/util/ValidationException.java b/core/src/main/java/io/xpipe/core/util/ValidationException.java index c24afddf..a94ab39d 100644 --- a/core/src/main/java/io/xpipe/core/util/ValidationException.java +++ b/core/src/main/java/io/xpipe/core/util/ValidationException.java @@ -3,5 +3,4 @@ package io.xpipe.core.util; import lombok.experimental.StandardException; @StandardException -public class ValidationException extends Exception { -} +public class ValidationException extends Exception {} diff --git a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java index c6eda0cb..1cb4baf5 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java @@ -196,9 +196,7 @@ public class XPipeInstallation { } else if (OsType.getLocal().equals(OsType.LINUX)) { return path.resolve("logo.png"); } else { - return path.resolve("Contents") - .resolve("Resources") - .resolve("logo.icns"); + return path.resolve("Contents").resolve("Resources").resolve("logo.icns"); } } diff --git a/core/src/main/java/io/xpipe/core/util/XPipeTempDirectory.java b/core/src/main/java/io/xpipe/core/util/XPipeTempDirectory.java index 6f9eb2fa..3c450e63 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeTempDirectory.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeTempDirectory.java @@ -24,7 +24,9 @@ public class XPipeTempDirectory { var dir = FileNames.join(base, "xpipe"); if (!proc.executeBooleanSimpleCommand(proc.getShellType().getFileExistsCommand(dir))) { - proc.executeSimpleCommand(proc.getShellType().flatten(proc.getShellType().getMkdirsCommand(dir)), "Unable to access or create temporary directory " + dir); + proc.executeSimpleCommand( + proc.getShellType().flatten(proc.getShellType().getMkdirsCommand(dir)), + "Unable to access or create temporary directory " + dir); if (proc.getOsType().equals(OsType.LINUX) || proc.getOsType().equals(OsType.MACOS)) { proc.executeSimpleCommand("chmod -f 777 \"" + dir + "\""); diff --git a/core/src/main/java/module-info.java b/core/src/main/java/module-info.java index c2d408bf..c7800499 100644 --- a/core/src/main/java/module-info.java +++ b/core/src/main/java/module-info.java @@ -30,7 +30,10 @@ open module io.xpipe.core { uses io.xpipe.core.util.DataStateProvider; uses io.xpipe.core.util.SecretProvider; - provides WriteMode with WriteMode.Replace, WriteMode.Append, WriteMode.Prepend; + provides WriteMode with + WriteMode.Replace, + WriteMode.Append, + WriteMode.Prepend; provides com.fasterxml.jackson.databind.Module with CoreJacksonModule; } diff --git a/core/src/test/java/io/xpipe/core/test/DataSourceIdTest.java b/core/src/test/java/io/xpipe/core/test/DataSourceIdTest.java index c3a5952b..1f4eec15 100644 --- a/core/src/test/java/io/xpipe/core/test/DataSourceIdTest.java +++ b/core/src/test/java/io/xpipe/core/test/DataSourceIdTest.java @@ -42,18 +42,7 @@ public class DataSourceIdTest { } @ParameterizedTest - @ValueSource( - strings = { - "abc", - "abc:", - "ab::c", - "::abc", - " ab", - "::::", - "", - " " - } - ) + @ValueSource(strings = {"abc", "abc:", "ab::c", "::abc", " ab", "::::", "", " "}) public void testFromStringInvalidParameters(String arg) { Assertions.assertThrows(IllegalArgumentException.class, () -> { DataSourceId.fromString(arg); diff --git a/core/src/test/java/io/xpipe/core/test/DataSourceReferenceTest.java b/core/src/test/java/io/xpipe/core/test/DataSourceReferenceTest.java index 5d7a8dea..a3d183ec 100644 --- a/core/src/test/java/io/xpipe/core/test/DataSourceReferenceTest.java +++ b/core/src/test/java/io/xpipe/core/test/DataSourceReferenceTest.java @@ -22,13 +22,7 @@ public class DataSourceReferenceTest { } @ParameterizedTest - @ValueSource( - strings = { - "abc:", - "ab::c", - "::abc" - } - ) + @ValueSource(strings = {"abc:", "ab::c", "::abc"}) public void parseInvalidParameters(String arg) { Assertions.assertThrows(IllegalArgumentException.class, () -> { DataSourceReference.parse(arg); diff --git a/ext/base/src/main/java/io/xpipe/ext/base/HttpStore.java b/ext/base/src/main/java/io/xpipe/ext/base/HttpStore.java index 85f39f3f..34f553ce 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/HttpStore.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/HttpStore.java @@ -50,12 +50,14 @@ public class HttpStore extends JacksonizedValue implements StreamDataStore, Stat builder.contentEncoding(res.headers().firstValue("Content-Encoding").orElse(null)); var contentType = res.headers().firstValue("Content-Type"); if (contentType.isPresent()) { - var s = Arrays.stream(contentType.get().split(";")).map(String::trim).toList(); + var s = Arrays.stream(contentType.get().split(";")) + .map(String::trim) + .toList(); builder.mimeType(s.get(0)); if (s.size() > 1) { try { - var cs = Charset.forName(s.get(1)); - builder.charset(StreamCharset.get(cs,false)); + var cs = Charset.forName(s.get(1)); + builder.charset(StreamCharset.get(cs, false)); } catch (IllegalCharsetNameException ignored) { } @@ -69,9 +71,9 @@ public class HttpStore extends JacksonizedValue implements StreamDataStore, Stat String mimeType; } - public CachedResponseInfo getInfo() { - return getState("info", CachedResponseInfo.class, CachedResponseInfo.builder().build()); + return getState( + "info", CachedResponseInfo.class, CachedResponseInfo.builder().build()); } public URI getURL() { @@ -113,7 +115,9 @@ public class HttpStore extends JacksonizedValue implements StreamDataStore, Stat } private HttpClient createClient() { - var client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS).build(); + var client = HttpClient.newBuilder() + .followRedirects(HttpClient.Redirect.ALWAYS) + .build(); return client; } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/actions/AddStoreAction.java b/ext/base/src/main/java/io/xpipe/ext/base/actions/AddStoreAction.java index 5d54b59b..e6e68e35 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/actions/AddStoreAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/actions/AddStoreAction.java @@ -21,6 +21,7 @@ public class AddStoreAction implements ActionProvider { public boolean requiresPlatform() { return true; } + @Override public void execute() throws Exception { if (store == null) { diff --git a/ext/base/src/main/java/io/xpipe/ext/base/actions/FileEditAction.java b/ext/base/src/main/java/io/xpipe/ext/base/actions/FileEditAction.java index c55d926e..077f7f25 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/actions/FileEditAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/actions/FileEditAction.java @@ -27,7 +27,12 @@ public class FileEditAction implements ActionProvider { ExternalEditor.get().openInEditor(store.getFile()); } else { ExternalEditor.get() - .startEditing(store.getFileName(), store.getFileExtension(), store, () -> store.openInput(), () -> store.openOutput()); + .startEditing( + store.getFileName(), + store.getFileExtension(), + store, + () -> store.openInput(), + () -> store.openOutput()); } } } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/actions/ShareStoreAction.java b/ext/base/src/main/java/io/xpipe/ext/base/actions/ShareStoreAction.java index 5d195b93..7541654e 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/actions/ShareStoreAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/actions/ShareStoreAction.java @@ -43,7 +43,6 @@ public class ShareStoreAction implements ActionProvider { public DataStoreCallSite getDataStoreCallSite() { return new DataStoreCallSite() { - @Override public boolean showIfDisabled() { return false; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/actions/StreamExportAction.java b/ext/base/src/main/java/io/xpipe/ext/base/actions/StreamExportAction.java index f939acc6..c8cfa9d6 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/actions/StreamExportAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/actions/StreamExportAction.java @@ -68,7 +68,6 @@ public class StreamExportAction implements ActionProvider { return StreamDataStore.class; } - @Override public ObservableValue getName(StreamDataStore store) { return I18n.observable("base.exportStream"); @@ -78,7 +77,6 @@ public class StreamExportAction implements ActionProvider { public String getIcon(StreamDataStore store) { return "mdi2f-file-export-outline"; } - }; } } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/apps/CommandLineTarget.java b/ext/base/src/main/java/io/xpipe/ext/base/apps/CommandLineTarget.java index c28765f2..f19fa423 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/apps/CommandLineTarget.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/apps/CommandLineTarget.java @@ -2,8 +2,8 @@ package io.xpipe.ext.base.apps; import io.xpipe.core.source.DataSource; import io.xpipe.core.source.DataSourceId; -import io.xpipe.extension.I18n; import io.xpipe.extension.DataSourceTarget; +import io.xpipe.extension.I18n; import io.xpipe.extension.fxcomps.Comp; import io.xpipe.extension.fxcomps.impl.CodeSnippet; import io.xpipe.extension.fxcomps.impl.CodeSnippetComp; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/apps/DataSourceOutputTarget.java b/ext/base/src/main/java/io/xpipe/ext/base/apps/DataSourceOutputTarget.java index ca4dbe1f..28272923 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/apps/DataSourceOutputTarget.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/apps/DataSourceOutputTarget.java @@ -4,8 +4,8 @@ import io.xpipe.app.comp.source.GuiDsTableMappingConfirmation; import io.xpipe.core.source.*; import io.xpipe.extension.DataSourceProvider; import io.xpipe.extension.DataSourceProviders; -import io.xpipe.extension.I18n; import io.xpipe.extension.DataSourceTarget; +import io.xpipe.extension.I18n; import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.fxcomps.impl.WriteModeChoiceComp; import io.xpipe.extension.fxcomps.util.BindingsHelper; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/apps/JavaTarget.java b/ext/base/src/main/java/io/xpipe/ext/base/apps/JavaTarget.java index 4481b6ec..c96e296f 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/apps/JavaTarget.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/apps/JavaTarget.java @@ -2,8 +2,8 @@ package io.xpipe.ext.base.apps; import io.xpipe.core.source.DataSource; import io.xpipe.core.source.DataSourceId; -import io.xpipe.extension.I18n; import io.xpipe.extension.DataSourceTarget; +import io.xpipe.extension.I18n; import io.xpipe.extension.fxcomps.impl.CodeSnippet; import io.xpipe.extension.fxcomps.impl.CodeSnippetComp; import javafx.beans.binding.Bindings; diff --git a/ext/base/src/main/java/io/xpipe/ext/base/apps/RawFileOutputTarget.java b/ext/base/src/main/java/io/xpipe/ext/base/apps/RawFileOutputTarget.java index 51d28a7e..89dcd25b 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/apps/RawFileOutputTarget.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/apps/RawFileOutputTarget.java @@ -3,9 +3,9 @@ package io.xpipe.ext.base.apps; import io.xpipe.core.source.DataSource; import io.xpipe.core.source.DataSourceId; import io.xpipe.core.store.StreamDataStore; +import io.xpipe.extension.DataSourceTarget; import io.xpipe.extension.DataStoreProvider; import io.xpipe.extension.I18n; -import io.xpipe.extension.DataSourceTarget; import io.xpipe.extension.fxcomps.augment.GrowAugment; import io.xpipe.extension.util.DynamicOptionsBuilder; import io.xpipe.extension.util.XPipeDaemon; diff --git a/ext/base/src/main/java/module-info.java b/ext/base/src/main/java/module-info.java index 3b8ce660..d7c62320 100644 --- a/ext/base/src/main/java/module-info.java +++ b/ext/base/src/main/java/module-info.java @@ -2,8 +2,8 @@ import io.xpipe.ext.base.*; import io.xpipe.ext.base.actions.*; import io.xpipe.ext.base.apps.*; import io.xpipe.extension.DataSourceProvider; -import io.xpipe.extension.DataStoreProvider; import io.xpipe.extension.DataSourceTarget; +import io.xpipe.extension.DataStoreProvider; import io.xpipe.extension.util.ActionProvider; open module io.xpipe.ext.base { @@ -21,7 +21,8 @@ open module io.xpipe.ext.base { requires static net.synedra.validatorfx; requires static io.xpipe.app; - provides ActionProvider with AddStoreAction, + provides ActionProvider with + AddStoreAction, StreamExportAction, ShareStoreAction, FileBrowseAction, diff --git a/ext/csv/src/main/java/io/xpipe/ext/csv/CsvDelimiter.java b/ext/csv/src/main/java/io/xpipe/ext/csv/CsvDelimiter.java index 2fb02d0f..2492e9b3 100644 --- a/ext/csv/src/main/java/io/xpipe/ext/csv/CsvDelimiter.java +++ b/ext/csv/src/main/java/io/xpipe/ext/csv/CsvDelimiter.java @@ -57,7 +57,8 @@ public class CsvDelimiter { public static CsvDelimiter detectDelimiter(List lines, Character quote) { return CsvDelimiter.ALL.stream() - .filter(c -> isPossibleDelimiter(lines, quote, c.getNamedCharacter().getCharacter())) + .filter(c -> + isPossibleDelimiter(lines, quote, c.getNamedCharacter().getCharacter())) .max(Comparator.comparingInt(c -> getUnquotedOccurenceCount( lines.get(0), quote, c.getNamedCharacter().getCharacter()))) .orElse(ALL.get(0)); diff --git a/ext/csv/src/main/java/io/xpipe/ext/csv/CsvDetector.java b/ext/csv/src/main/java/io/xpipe/ext/csv/CsvDetector.java index c52b4026..761e405d 100644 --- a/ext/csv/src/main/java/io/xpipe/ext/csv/CsvDetector.java +++ b/ext/csv/src/main/java/io/xpipe/ext/csv/CsvDetector.java @@ -65,8 +65,8 @@ public class CsvDetector { } var delimiter = CsvDelimiter.detectDelimiter(lines, quoteChar); - var array = - CsvSplitter.splitRaw(lines, quoteChar, delimiter.getNamedCharacter().getCharacter()); + var array = CsvSplitter.splitRaw( + lines, quoteChar, delimiter.getNamedCharacter().getCharacter()); var headerState = CsvHeaderState.determine(array, quoteChar); event("Finished detection").handle(); diff --git a/ext/csv/src/test/java/io/xpipe/ext/csv/test/CsvDetectorTest.java b/ext/csv/src/test/java/io/xpipe/ext/csv/test/CsvDetectorTest.java index ec758d7a..e7415d05 100644 --- a/ext/csv/src/test/java/io/xpipe/ext/csv/test/CsvDetectorTest.java +++ b/ext/csv/src/test/java/io/xpipe/ext/csv/test/CsvDetectorTest.java @@ -22,17 +22,11 @@ public class CsvDetectorTest extends DaemonExtensionTest { Assertions.assertEquals( lines.at(0), TupleNode.of( - names, - List.of( - ValueNode.of("JAN"), - ValueNode.of(340), - ValueNode.of(360), - ValueNode.of(417)))); + names, List.of(ValueNode.of("JAN"), ValueNode.of(340), ValueNode.of(360), ValueNode.of(417)))); Assertions.assertEquals( lines.at(lines.size() - 1), TupleNode.of( - names, - List.of(ValueNode.of("DEC"), ValueNode.of(337), ValueNode.of(405), ValueNode.of(432)))); + names, List.of(ValueNode.of("DEC"), ValueNode.of(337), ValueNode.of(405), ValueNode.of(432)))); CsvSource detected = source.getInternalSource().asNeeded(); Assertions.assertEquals(detected.getHeaderState(), CsvHeaderState.INCLUDED); diff --git a/ext/jackson/src/main/java/io/xpipe/ext/jackson/json_table/JsonTableProvider.java b/ext/jackson/src/main/java/io/xpipe/ext/jackson/json_table/JsonTableProvider.java index e67ca203..1085e09b 100644 --- a/ext/jackson/src/main/java/io/xpipe/ext/jackson/json_table/JsonTableProvider.java +++ b/ext/jackson/src/main/java/io/xpipe/ext/jackson/json_table/JsonTableProvider.java @@ -27,7 +27,7 @@ import java.util.Map; public class JsonTableProvider implements UniformDataSourceProvider, - SimpleFileDataSourceProvider { + SimpleFileDataSourceProvider { @Override public boolean supportsConversion(JsonTableProvider.Source in, DataSourceType t) { diff --git a/ext/jackson/src/main/java/io/xpipe/ext/jackson/xml_table/XmlTableProvider.java b/ext/jackson/src/main/java/io/xpipe/ext/jackson/xml_table/XmlTableProvider.java index cb133d9b..22e28bbf 100644 --- a/ext/jackson/src/main/java/io/xpipe/ext/jackson/xml_table/XmlTableProvider.java +++ b/ext/jackson/src/main/java/io/xpipe/ext/jackson/xml_table/XmlTableProvider.java @@ -29,7 +29,7 @@ import java.util.Map; public class XmlTableProvider implements UniformDataSourceProvider, - SimpleFileDataSourceProvider { + SimpleFileDataSourceProvider { @Override public boolean shouldShow(DataSourceType type) { diff --git a/ext/pdx/src/main/java/io/xpipe/ext/pdx/PdxTextFileProvider.java b/ext/pdx/src/main/java/io/xpipe/ext/pdx/PdxTextFileProvider.java index e3bb71ef..efe7da74 100644 --- a/ext/pdx/src/main/java/io/xpipe/ext/pdx/PdxTextFileProvider.java +++ b/ext/pdx/src/main/java/io/xpipe/ext/pdx/PdxTextFileProvider.java @@ -18,7 +18,7 @@ import java.util.Map; public class PdxTextFileProvider implements UniformDataSourceProvider, - SimpleFileDataSourceProvider { + SimpleFileDataSourceProvider { @Override public Source createDefaultSource(DataStore input) throws Exception { diff --git a/ext/pdx/src/main/java/io/xpipe/ext/pdx/parser/TextFormatParser.java b/ext/pdx/src/main/java/io/xpipe/ext/pdx/parser/TextFormatParser.java index f3f436f3..2f1d841c 100644 --- a/ext/pdx/src/main/java/io/xpipe/ext/pdx/parser/TextFormatParser.java +++ b/ext/pdx/src/main/java/io/xpipe/ext/pdx/parser/TextFormatParser.java @@ -39,9 +39,7 @@ public final class TextFormatParser { public static TextFormatParser eu4() { return new TextFormatParser( - Charset.forName("windows-1252"), - TaggedNodes.NO_TAGS, - s -> s.equals("map_area_data")); + Charset.forName("windows-1252"), TaggedNodes.NO_TAGS, s -> s.equals("map_area_data")); } public static TextFormatParser ck3() { @@ -57,17 +55,11 @@ public final class TextFormatParser { } public static TextFormatParser ck2() { - return new TextFormatParser( - Charset.forName("windows-1252"), - TaggedNodes.NO_TAGS, - s -> false); + return new TextFormatParser(Charset.forName("windows-1252"), TaggedNodes.NO_TAGS, s -> false); } public static TextFormatParser vic2() { - return new TextFormatParser( - Charset.forName("windows-1252"), - TaggedNodes.NO_TAGS, - s -> false); + return new TextFormatParser(Charset.forName("windows-1252"), TaggedNodes.NO_TAGS, s -> false); } private void reset() { diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/CommandControlImpl.java b/ext/proc/src/main/java/io/xpipe/ext/proc/CommandControlImpl.java index 4f984239..31beca66 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/CommandControlImpl.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/CommandControlImpl.java @@ -38,8 +38,10 @@ public abstract class CommandControlImpl extends ProcessControlImpl implements C }); protected final ShellProcessControl parent; + @NonNull protected final FailableFunction command; + protected final FailableFunction terminalCommand; protected boolean elevated; protected int exitCode = -1; @@ -198,7 +200,9 @@ public abstract class CommandControlImpl extends ProcessControlImpl implements C } var exitCode = getExitCode(); - var success = (obeysReturnValueConvention && exitCode == 0) || (!obeysReturnValueConvention && !(read.get().isEmpty() && !readError.get().isEmpty())); + var success = (obeysReturnValueConvention && exitCode == 0) + || (!obeysReturnValueConvention + && !(read.get().isEmpty() && !readError.get().isEmpty())); if (success) { return read.get().trim(); } else { @@ -232,7 +236,9 @@ public abstract class CommandControlImpl extends ProcessControlImpl implements C } var exitCode = getExitCode(); - var success = (obeysReturnValueConvention && exitCode == 0) || (!obeysReturnValueConvention && !(read.get().isEmpty() && !readError.get().isEmpty())); + var success = (obeysReturnValueConvention && exitCode == 0) + || (!obeysReturnValueConvention + && !(read.get().isEmpty() && !readError.get().isEmpty())); if (!success) { throw new ProcessOutputException( "Command returned with " + exitCode + ": " + readError.get().trim()); diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/LocalCommandControlImpl.java b/ext/proc/src/main/java/io/xpipe/ext/proc/LocalCommandControlImpl.java index 45010772..33b6d834 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/LocalCommandControlImpl.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/LocalCommandControlImpl.java @@ -10,7 +10,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.concurrent.TimeUnit; -import java.util.function.Function; public class LocalCommandControlImpl extends CommandControlImpl { @@ -19,8 +18,7 @@ public class LocalCommandControlImpl extends CommandControlImpl { public LocalCommandControlImpl( ShellProcessControl parent, @NonNull FailableFunction command, - FailableFunction terminalCommand - ) { + FailableFunction terminalCommand) { super(parent, command, terminalCommand); } diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/LocalShellControlImpl.java b/ext/proc/src/main/java/io/xpipe/ext/proc/LocalShellControlImpl.java index d955ac7f..4090c075 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/LocalShellControlImpl.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/LocalShellControlImpl.java @@ -1,6 +1,5 @@ package io.xpipe.ext.proc; -import io.xpipe.core.process.ProcessControlProvider; import io.xpipe.core.process.*; import io.xpipe.core.util.FailableFunction; import io.xpipe.extension.event.TrackEvent; @@ -25,7 +24,8 @@ public class LocalShellControlImpl extends ShellControlImpl { @Override public CommandProcessControl command( - FailableFunction command, FailableFunction terminalCommand) { + FailableFunction command, + FailableFunction terminalCommand) { var control = ProcessControlProvider.createCommand(this, command, terminalCommand); if (control != null) { return control; @@ -183,5 +183,4 @@ public class LocalShellControlImpl extends ShellControlImpl { public InputStream getStderr() { return process.getErrorStream(); } - } diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/ProcProvider.java b/ext/proc/src/main/java/io/xpipe/ext/proc/ProcProvider.java index 2df2a33c..f42b6168 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/ProcProvider.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/ProcProvider.java @@ -11,17 +11,17 @@ public class ProcProvider extends ProcessControlProvider { @Override public ShellProcessControl sub( - ShellProcessControl parent, @NonNull FailableFunction commandFunction, - FailableBiFunction terminalCommand - ) { + ShellProcessControl parent, + @NonNull FailableFunction commandFunction, + FailableBiFunction terminalCommand) { return null; } @Override public CommandProcessControl command( - ShellProcessControl parent, @NonNull FailableFunction command, - FailableFunction terminalCommand - ) { + ShellProcessControl parent, + @NonNull FailableFunction command, + FailableFunction terminalCommand) { return null; } diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/ShellControlImpl.java b/ext/proc/src/main/java/io/xpipe/ext/proc/ShellControlImpl.java index 3dc0730b..8f190aed 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/ShellControlImpl.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/ShellControlImpl.java @@ -85,7 +85,8 @@ public abstract class ShellControlImpl extends ProcessControlImpl implements She @Override public CommandProcessControl command( - FailableFunction command, FailableFunction terminalCommand) { + FailableFunction command, + FailableFunction terminalCommand) { var control = ProcessControlProvider.createCommand(this, command, terminalCommand); return control; } diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/action/InstallConnectorAction.java b/ext/proc/src/main/java/io/xpipe/ext/proc/action/InstallConnectorAction.java index fe10aac7..3057490d 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/action/InstallConnectorAction.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/action/InstallConnectorAction.java @@ -24,7 +24,8 @@ public class InstallConnectorAction implements ActionProvider { @Override public void execute() throws Exception { - try (ShellProcessControl s = ((ShellStore) entry.getStore()).create().start()) { + try (ShellProcessControl s = + ((ShellStore) entry.getStore()).create().start()) { ProxyManagerProvider.get().setup(s); } } @@ -58,7 +59,6 @@ public class InstallConnectorAction implements ActionProvider { public String getIcon(ShellStore store) { return "mdi2c-code-greater-than"; } - }; } } diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/action/LaunchAction.java b/ext/proc/src/main/java/io/xpipe/ext/proc/action/LaunchAction.java index 36c6669b..babb8892 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/action/LaunchAction.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/action/LaunchAction.java @@ -20,11 +20,11 @@ public class LaunchAction implements ActionProvider { DataStoreEntry entry; - @Override public boolean requiresPlatform() { return false; } + @Override public void execute() throws Exception { var storeName = entry.getName(); @@ -45,7 +45,9 @@ public class LaunchAction implements ActionProvider { @Override public ActionProvider.Action createAction(List args) { - var entry = DataStorage.get().getStoreEntryByUuid(UUID.fromString(args.get(1))).orElseThrow(); + var entry = DataStorage.get() + .getStoreEntryByUuid(UUID.fromString(args.get(1))) + .orElseThrow(); return new Action(entry); } }; diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/action/LaunchShortcutAction.java b/ext/proc/src/main/java/io/xpipe/ext/proc/action/LaunchShortcutAction.java index 48b12941..98ef5ded 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/action/LaunchShortcutAction.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/action/LaunchShortcutAction.java @@ -33,7 +33,6 @@ public class LaunchShortcutAction implements ActionProvider { return XPipeDistributionType.get().supportsURLs(); } - @Override public DataStoreCallSite getDataStoreCallSite() { return new DataStoreCallSite() { diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/augment/CommandAugmentation.java b/ext/proc/src/main/java/io/xpipe/ext/proc/augment/CommandAugmentation.java index 44d97657..130d4b8a 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/augment/CommandAugmentation.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/augment/CommandAugmentation.java @@ -84,7 +84,8 @@ public abstract class CommandAugmentation { return proc.getShellType().flatten(split); } - protected abstract void prepareBaseCommand(ShellProcessControl processControl, List baseCommand) throws Exception; + protected abstract void prepareBaseCommand(ShellProcessControl processControl, List baseCommand) + throws Exception; protected abstract void modifyTerminalCommand(List baseCommand, boolean hasSubCommand); diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/augment/SshCommandAugmentation.java b/ext/proc/src/main/java/io/xpipe/ext/proc/augment/SshCommandAugmentation.java index b821fa30..99ce3c42 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/augment/SshCommandAugmentation.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/augment/SshCommandAugmentation.java @@ -24,7 +24,9 @@ public class SshCommandAugmentation extends CommandAugmentation { // Ensure proper permissions for keys var key = getParameter(baseCommand, "-i"); - if (key.isPresent() && (processControl.getOsType().equals(OsType.LINUX) || processControl.getOsType().equals(OsType.MACOS)) ){ + if (key.isPresent() + && (processControl.getOsType().equals(OsType.LINUX) + || processControl.getOsType().equals(OsType.MACOS))) { processControl.executeSimpleCommand("chmod 400 \"" + key.get() + "\""); } diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/store/DockerStoreProvider.java b/ext/proc/src/main/java/io/xpipe/ext/proc/store/DockerStoreProvider.java index eb7ed158..80fafc84 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/store/DockerStoreProvider.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/store/DockerStoreProvider.java @@ -41,10 +41,7 @@ public class DockerStoreProvider implements DataStoreProvider { Property containerProp = new SimpleObjectProperty<>(st.getContainerName()); var q = new DynamicOptionsBuilder(I18n.observable("configuration")) - .addComp( - I18n.observable("host"), - ShellStoreChoiceComp.host(st, shellProp), - shellProp) + .addComp(I18n.observable("host"), ShellStoreChoiceComp.host(st, shellProp), shellProp) .nonNull(val) .addString(I18n.observable("proc.container"), containerProp) .nonNull(val) diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellCommandStore.java b/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellCommandStore.java index 0bebefe5..32d2dd1f 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellCommandStore.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellCommandStore.java @@ -20,6 +20,7 @@ public class ShellCommandStore extends JacksonizedValue implements MachineStore private final String cmd; private final ShellStore host; + public ShellCommandStore(String cmd, ShellStore host) { this.cmd = cmd; this.host = host; diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellCommandStoreProvider.java b/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellCommandStoreProvider.java index 224f52cc..304d3494 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellCommandStoreProvider.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellCommandStoreProvider.java @@ -46,10 +46,7 @@ public class ShellCommandStoreProvider implements DataStoreProvider { Property commandProp = new SimpleObjectProperty<>(st.getCmd()); var q = new DynamicOptionsBuilder(I18n.observable("configuration")) - .addComp( - I18n.observable("host"), - ShellStoreChoiceComp.host(st, hostProperty), - hostProperty) + .addComp(I18n.observable("host"), ShellStoreChoiceComp.host(st, hostProperty), hostProperty) .nonNull(val) .addString(I18n.observable("proc.command"), commandProp) .nonNull(val) diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellEnvironmentStore.java b/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellEnvironmentStore.java index a15df23c..2555fe9f 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellEnvironmentStore.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/store/ShellEnvironmentStore.java @@ -21,7 +21,6 @@ public class ShellEnvironmentStore extends JacksonizedValue implements MachineSt private final ShellStore host; private final ShellType shell; - public ShellEnvironmentStore(String commands, ShellStore host, ShellType shell) { this.commands = commands; this.host = host; @@ -38,9 +37,7 @@ public class ShellEnvironmentStore extends JacksonizedValue implements MachineSt @Override public void validate() throws Exception { - try (var ignored = create().start()) { - - } + try (var ignored = create().start()) {} } @Override diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/store/SshStore.java b/ext/proc/src/main/java/io/xpipe/ext/proc/store/SshStore.java index 267ae348..2cec6ca9 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/store/SshStore.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/store/SshStore.java @@ -28,6 +28,7 @@ public class SshStore extends JacksonizedValue implements MachineStore { String user; SecretValue password; SshKey key; + public SshStore(ShellStore proxy, String host, Integer port, String user, SecretValue password, SshKey key) { this.proxy = proxy; this.host = host; diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/store/SshStoreProvider.java b/ext/proc/src/main/java/io/xpipe/ext/proc/store/SshStoreProvider.java index 2834ea76..78ff188f 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/store/SshStoreProvider.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/store/SshStoreProvider.java @@ -51,10 +51,7 @@ public class SshStoreProvider implements DataStoreProvider { var key = new SimpleObjectProperty<>(st.getKey()); var q = new DynamicOptionsBuilder(I18n.observable("configuration")) - .addComp( - I18n.observable("proxy"), - ShellStoreChoiceComp.host(st, shellProp), - shellProp) + .addComp(I18n.observable("proxy"), ShellStoreChoiceComp.host(st, shellProp), shellProp) .nonNull(val) .addString(I18n.observable("host"), host) .nonNull(val) @@ -94,9 +91,7 @@ public class SshStoreProvider implements DataStoreProvider { () -> { return keyFileProperty.get() != null ? SshStore.SshKey.builder() - .file(keyFileProperty - .get() - .getFile()) + .file(keyFileProperty.get().getFile()) .password(keyPasswordProperty.get()) .build() : null; diff --git a/ext/proc/src/main/java/io/xpipe/ext/proc/store/WslStoreProvider.java b/ext/proc/src/main/java/io/xpipe/ext/proc/store/WslStoreProvider.java index 36bdcfb7..54763501 100644 --- a/ext/proc/src/main/java/io/xpipe/ext/proc/store/WslStoreProvider.java +++ b/ext/proc/src/main/java/io/xpipe/ext/proc/store/WslStoreProvider.java @@ -38,10 +38,7 @@ public class WslStoreProvider implements DataStoreProvider { Property userProp = new SimpleObjectProperty<>(st.getUser()); var q = new DynamicOptionsBuilder(I18n.observable("configuration")) - .addComp( - I18n.observable("host"), - ShellStoreChoiceComp.host(st, shellProp), - shellProp) + .addComp(I18n.observable("host"), ShellStoreChoiceComp.host(st, shellProp), shellProp) .nonNull(val) .addString(I18n.observable("proc.distribution"), distProp) .nonNull(val) diff --git a/ext/proc/src/main/java/module-info.java b/ext/proc/src/main/java/module-info.java index eae485bc..c60f8c23 100644 --- a/ext/proc/src/main/java/module-info.java +++ b/ext/proc/src/main/java/module-info.java @@ -1,6 +1,8 @@ import io.xpipe.app.util.TerminalProvider; import io.xpipe.core.process.ProcessControlProvider; -import io.xpipe.ext.proc.*; +import io.xpipe.ext.proc.ProcPrefs; +import io.xpipe.ext.proc.ProcProvider; +import io.xpipe.ext.proc.TerminalProviderImpl; import io.xpipe.ext.proc.action.InstallConnectorAction; import io.xpipe.ext.proc.action.LaunchAction; import io.xpipe.ext.proc.action.LaunchShortcutAction; @@ -27,7 +29,8 @@ open module io.xpipe.ext.proc { requires static commons.exec; requires static com.dlsc.preferencesfx; - provides TerminalProvider with TerminalProviderImpl; + provides TerminalProvider with + TerminalProviderImpl; provides PrefsProvider with ProcPrefs; provides CommandAugmentation with diff --git a/ext/proc/src/test/java/test/CommandTests.java b/ext/proc/src/test/java/test/CommandTests.java index fcc32866..d5215370 100644 --- a/ext/proc/src/test/java/test/CommandTests.java +++ b/ext/proc/src/test/java/test/CommandTests.java @@ -61,7 +61,8 @@ public class CommandTests extends LocalExtensionTest { @ParameterizedTest @MethodSource("commandChecksProvider") - public void testSubDoubleCommandChecks(ShellProcessControl shellTestItem, CommandCheckTestItem tc) throws Exception { + public void testSubDoubleCommandChecks(ShellProcessControl shellTestItem, CommandCheckTestItem tc) + throws Exception { try (var pc = shellTestItem.start()) { try (ShellProcessControl sub = pc.subShell(pc.getShellType()).start()) { try (var c = sub.command(tc.getCommandFunction().apply(sub)).start()) { @@ -77,7 +78,8 @@ public class CommandTests extends LocalExtensionTest { @ParameterizedTest @MethodSource("commandChecksProvider") - public void testDoubleSubCommandChecks(ShellProcessControl shellTestItem, CommandCheckTestItem tc) throws Exception { + public void testDoubleSubCommandChecks(ShellProcessControl shellTestItem, CommandCheckTestItem tc) + throws Exception { try (var pc = shellTestItem.start()) { try (ShellProcessControl sub = pc.subShell(pc.getShellType()).start()) { try (var c = sub.command(tc.getCommandFunction().apply(sub)).start()) { diff --git a/ext/proc/src/test/java/test/item/ShellCheckTestItem.java b/ext/proc/src/test/java/test/item/ShellCheckTestItem.java index 984fbc8b..b50eedce 100644 --- a/ext/proc/src/test/java/test/item/ShellCheckTestItem.java +++ b/ext/proc/src/test/java/test/item/ShellCheckTestItem.java @@ -28,7 +28,8 @@ public enum ShellCheckTestItem { var content = ""; try (var c = shellProcessControl .subShell(shellProcessControl.getShellType()) - .initWith(List.of(shellProcessControl.getShellType().getSetEnvironmentVariableCommand("testVar", content))) + .initWith(List.of( + shellProcessControl.getShellType().getSetEnvironmentVariableCommand("testVar", content))) .start()) { var output = c.executeStringSimpleCommand( shellProcessControl.getShellType().getPrintEnvironmentVariableCommand("testVar")); @@ -38,7 +39,9 @@ public enum ShellCheckTestItem { STREAM_WRITE(shellProcessControl -> { var content = "hello\nworldß"; - var fileOne = FileNames.join(shellProcessControl.getOsType().getTempDirectory(shellProcessControl), UUID.randomUUID().toString()); + var fileOne = FileNames.join( + shellProcessControl.getOsType().getTempDirectory(shellProcessControl), + UUID.randomUUID().toString()); try (var c = shellProcessControl .command(shellProcessControl.getShellType().getStreamFileWriteCommand(fileOne)) .start()) { @@ -50,7 +53,9 @@ public enum ShellCheckTestItem { shellProcessControl.restart(); - var fileTwo = FileNames.join(shellProcessControl.getOsType().getTempDirectory(shellProcessControl), UUID.randomUUID().toString()); + var fileTwo = FileNames.join( + shellProcessControl.getOsType().getTempDirectory(shellProcessControl), + UUID.randomUUID().toString()); try (var c = shellProcessControl .subShell(shellProcessControl.getShellType()) .command(shellProcessControl.getShellType().getStreamFileWriteCommand(fileTwo)) @@ -73,11 +78,15 @@ public enum ShellCheckTestItem { SIMPLE_WRITE(shellProcessControl -> { var content = "hello worldß"; - var fileOne = FileNames.join(shellProcessControl.getOsType().getTempDirectory(shellProcessControl), UUID.randomUUID().toString()); + var fileOne = FileNames.join( + shellProcessControl.getOsType().getTempDirectory(shellProcessControl), + UUID.randomUUID().toString()); shellProcessControl.executeSimpleCommand( shellProcessControl.getShellType().getTextFileWriteCommand(content, fileOne)); - var fileTwo = FileNames.join(shellProcessControl.getOsType().getTempDirectory(shellProcessControl), UUID.randomUUID().toString()); + var fileTwo = FileNames.join( + shellProcessControl.getOsType().getTempDirectory(shellProcessControl), + UUID.randomUUID().toString()); shellProcessControl.executeSimpleCommand( shellProcessControl.getShellType().getTextFileWriteCommand(content, fileTwo)); @@ -95,12 +104,14 @@ public enum ShellCheckTestItem { COMMAND_TERMINAL_OPEN(shellProcessControl -> { for (CommandCheckTestItem v : CommandCheckTestItem.values()) { - shellProcessControl.prepareIntermediateTerminalOpen(v.getCommandFunction().apply(shellProcessControl)); + shellProcessControl.prepareIntermediateTerminalOpen( + v.getCommandFunction().apply(shellProcessControl)); } }), ECHO(shellProcessControl -> { - shellProcessControl.executeSimpleCommand(shellProcessControl.getShellType().getEchoCommand("test", false)); + shellProcessControl.executeSimpleCommand( + shellProcessControl.getShellType().getEchoCommand("test", false)); }); private final FailableConsumer shellCheck; diff --git a/ext/proc/src/test/java/test/item/ShellTestItem.java b/ext/proc/src/test/java/test/item/ShellTestItem.java index 43547a2a..c2a006e4 100644 --- a/ext/proc/src/test/java/test/item/ShellTestItem.java +++ b/ext/proc/src/test/java/test/item/ShellTestItem.java @@ -9,6 +9,7 @@ import java.util.stream.Stream; public class ShellTestItem { public static Stream> getAll() { - return TestModule.getArguments(ShellProcessControl.class, "test.item.BasicShellTestItem", "test.item.PrivateShellTestItem"); + return TestModule.getArguments( + ShellProcessControl.class, "test.item.BasicShellTestItem", "test.item.PrivateShellTestItem"); } } diff --git a/extension/src/main/java/io/xpipe/extension/DataSourceProvider.java b/extension/src/main/java/io/xpipe/extension/DataSourceProvider.java index eada799d..e2954331 100644 --- a/extension/src/main/java/io/xpipe/extension/DataSourceProvider.java +++ b/extension/src/main/java/io/xpipe/extension/DataSourceProvider.java @@ -33,8 +33,7 @@ public interface DataSourceProvider> { throw new ExtensionException(); } - default void init() throws Exception { - } + default void init() throws Exception {} default String i18n(String key) { return I18n.get(i18nKey(key)); diff --git a/extension/src/main/java/io/xpipe/extension/DataSourceProviders.java b/extension/src/main/java/io/xpipe/extension/DataSourceProviders.java index 1b0f01eb..650a8863 100644 --- a/extension/src/main/java/io/xpipe/extension/DataSourceProviders.java +++ b/extension/src/main/java/io/xpipe/extension/DataSourceProviders.java @@ -42,7 +42,7 @@ public class DataSourceProviders { case STRUCTURE -> DataSourceProviders.byId("xpbs"); case TEXT -> DataSourceProviders.byId("text"); case RAW -> DataSourceProviders.byId("binary"); - // TODO + // TODO case COLLECTION -> null; }; } catch (Exception ex) { @@ -126,7 +126,7 @@ public class DataSourceProviders { return ALL.stream() .filter(d -> d.getPossibleNames().stream() - .anyMatch(s -> nameAlternatives(s).stream().anyMatch(s1 -> s1.equalsIgnoreCase(name))) + .anyMatch(s -> nameAlternatives(s).stream().anyMatch(s1 -> s1.equalsIgnoreCase(name))) || d.getId().equalsIgnoreCase(name)) .findAny(); } @@ -139,8 +139,7 @@ public class DataSourceProviders { String.join("-", split), split.stream() .map(s -> s.equals(split.get(0)) ? s : s.substring(0, 1).toUpperCase() + s.substring(1)) - .collect(Collectors.joining()) - ); + .collect(Collectors.joining())); } public static Optional> byPreferredStore(DataStore store, DataSourceType type) { diff --git a/extension/src/main/java/io/xpipe/extension/DataSourceTarget.java b/extension/src/main/java/io/xpipe/extension/DataSourceTarget.java index ef2d88fd..0fb91faf 100644 --- a/extension/src/main/java/io/xpipe/extension/DataSourceTarget.java +++ b/extension/src/main/java/io/xpipe/extension/DataSourceTarget.java @@ -16,7 +16,8 @@ import java.util.ServiceLoader; public interface DataSourceTarget { - static List ALL = new ArrayList<>();; + static List ALL = new ArrayList<>(); + ; public static class Loader implements ModuleLayerLoader { @@ -24,7 +25,8 @@ public interface DataSourceTarget { public void init(ModuleLayer layer) { ALL.clear(); ALL.addAll(ServiceLoader.load(layer, DataSourceTarget.class).stream() - .map(ServiceLoader.Provider::get).toList()); + .map(ServiceLoader.Provider::get) + .toList()); } @Override diff --git a/extension/src/main/java/io/xpipe/extension/DataStoreProvider.java b/extension/src/main/java/io/xpipe/extension/DataStoreProvider.java index 44afb998..75e2d841 100644 --- a/extension/src/main/java/io/xpipe/extension/DataStoreProvider.java +++ b/extension/src/main/java/io/xpipe/extension/DataStoreProvider.java @@ -51,8 +51,7 @@ public interface DataStoreProvider { return true; } - default void storageInit() throws Exception { - } + default void storageInit() throws Exception {} default boolean isShareable() { return false; diff --git a/extension/src/main/java/io/xpipe/extension/DataStoreProviders.java b/extension/src/main/java/io/xpipe/extension/DataStoreProviders.java index 0f5dd3d2..830b33e0 100644 --- a/extension/src/main/java/io/xpipe/extension/DataStoreProviders.java +++ b/extension/src/main/java/io/xpipe/extension/DataStoreProviders.java @@ -42,7 +42,7 @@ public class DataStoreProviders { return ALL.stream() .filter(d -> d.getPossibleNames().stream() - .anyMatch(s -> nameAlternatives(s).stream().anyMatch(s1 -> s1.equalsIgnoreCase(name))) + .anyMatch(s -> nameAlternatives(s).stream().anyMatch(s1 -> s1.equalsIgnoreCase(name))) || d.getId().equalsIgnoreCase(name)) .findAny(); } @@ -55,8 +55,7 @@ public class DataStoreProviders { String.join("-", split), split.stream() .map(s -> s.equals(split.get(0)) ? s : s.substring(0, 1).toUpperCase() + s.substring(1)) - .collect(Collectors.joining()) - ); + .collect(Collectors.joining())); } @SuppressWarnings("unchecked") diff --git a/extension/src/main/java/io/xpipe/extension/DownloadModuleInstall.java b/extension/src/main/java/io/xpipe/extension/DownloadModuleInstall.java index 89323013..79fc2456 100644 --- a/extension/src/main/java/io/xpipe/extension/DownloadModuleInstall.java +++ b/extension/src/main/java/io/xpipe/extension/DownloadModuleInstall.java @@ -8,12 +8,11 @@ public abstract class DownloadModuleInstall extends ModuleInstall { private String licenseFile; private String vendorURL; + @Getter private List assets; - public DownloadModuleInstall( - String id, String module, String licenseFile, String vendorURL, List assets - ) { + public DownloadModuleInstall(String id, String module, String licenseFile, String vendorURL, List assets) { super(id, module); this.licenseFile = licenseFile; this.vendorURL = vendorURL; diff --git a/extension/src/main/java/io/xpipe/extension/ExtensionException.java b/extension/src/main/java/io/xpipe/extension/ExtensionException.java index fab3705c..2670e8d4 100644 --- a/extension/src/main/java/io/xpipe/extension/ExtensionException.java +++ b/extension/src/main/java/io/xpipe/extension/ExtensionException.java @@ -2,8 +2,7 @@ package io.xpipe.extension; public class ExtensionException extends RuntimeException { - public ExtensionException() { - } + public ExtensionException() {} public ExtensionException(String message) { super(message); diff --git a/extension/src/main/java/io/xpipe/extension/ModuleInstall.java b/extension/src/main/java/io/xpipe/extension/ModuleInstall.java index 8d15e7ff..a6c2a804 100644 --- a/extension/src/main/java/io/xpipe/extension/ModuleInstall.java +++ b/extension/src/main/java/io/xpipe/extension/ModuleInstall.java @@ -8,6 +8,7 @@ public abstract class ModuleInstall { @Getter private final String id; + @Getter private final String module; diff --git a/extension/src/main/java/io/xpipe/extension/event/ErrorEvent.java b/extension/src/main/java/io/xpipe/extension/event/ErrorEvent.java index b313967d..9214abe4 100644 --- a/extension/src/main/java/io/xpipe/extension/event/ErrorEvent.java +++ b/extension/src/main/java/io/xpipe/extension/event/ErrorEvent.java @@ -15,11 +15,15 @@ public class ErrorEvent { private final List trackEvents = EventHandler.get().snapshotEvents(); private String description; private boolean terminal; + @Builder.Default private boolean omitted = false; + @Builder.Default private boolean reportable = true; + private Throwable throwable; + @Singular private List attachments; diff --git a/extension/src/main/java/io/xpipe/extension/event/EventHandler.java b/extension/src/main/java/io/xpipe/extension/event/EventHandler.java index 41ede629..5b99ecf9 100644 --- a/extension/src/main/java/io/xpipe/extension/event/EventHandler.java +++ b/extension/src/main/java/io/xpipe/extension/event/EventHandler.java @@ -32,9 +32,7 @@ public abstract class EventHandler { } @Override - public void modify(ErrorEvent ee) { - - } + public void modify(ErrorEvent ee) {} }; public static final EventHandler OMIT = new EventHandler() { @@ -44,17 +42,13 @@ public abstract class EventHandler { } @Override - public void handle(TrackEvent te) { - } + public void handle(TrackEvent te) {} @Override - public void handle(ErrorEvent ee) { - } + public void handle(ErrorEvent ee) {} @Override - public void modify(ErrorEvent ee) { - - } + public void modify(ErrorEvent ee) {} }; private static EventHandler INSTANCE; diff --git a/extension/src/main/java/io/xpipe/extension/event/TrackEvent.java b/extension/src/main/java/io/xpipe/extension/event/TrackEvent.java index 14c3307e..10471808 100644 --- a/extension/src/main/java/io/xpipe/extension/event/TrackEvent.java +++ b/extension/src/main/java/io/xpipe/extension/event/TrackEvent.java @@ -19,8 +19,10 @@ public class TrackEvent { private String type; private String message; private String category; + @Singular private Map tags; + @Singular private List elements; @@ -117,16 +119,13 @@ public class TrackEvent { var valueString = e.getValue() != null ? e.getValue().toString() : "null"; var value = valueString.contains("\n") ? "\n" - + (valueString.toString() - .lines() - .map(line -> " | " + line) - .collect(Collectors.joining("\n"))) + + (valueString + .toString() + .lines() + .map(line -> " | " + line) + .collect(Collectors.joining("\n"))) : valueString; - s.append(" ") - .append(e.getKey()) - .append("=") - .append(value) - .append("\n"); + s.append(" ").append(e.getKey()).append("=").append(value).append("\n"); } s.append("}"); } @@ -134,9 +133,7 @@ public class TrackEvent { if (elements.size() > 0) { s.append(" [\n"); for (var e : elements) { - s.append(" ") - .append(e != null ? e.toString() : "null") - .append("\n"); + s.append(" ").append(e != null ? e.toString() : "null").append("\n"); } s.append("]"); } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/Comp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/Comp.java index f982526c..d0e206a1 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/Comp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/Comp.java @@ -34,8 +34,7 @@ public abstract class Comp> { @SuppressWarnings("unchecked") public static , OR extends Region> Comp> derive( - Comp comp, Function r - ) { + Comp comp, Function r) { return of(() -> r.apply((IR) comp.createRegion())); } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/augment/GrowAugment.java b/extension/src/main/java/io/xpipe/extension/fxcomps/augment/GrowAugment.java index 1a8244cf..59cf6e2a 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/augment/GrowAugment.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/augment/GrowAugment.java @@ -31,8 +31,7 @@ public class GrowAugment> implements Augment { - p.getInsets().getLeft() - p.getInsets().getRight(), p.widthProperty(), - p.insetsProperty() - )); + p.insetsProperty())); } if (height) { r.prefHeightProperty() @@ -47,8 +46,7 @@ public class GrowAugment> implements Augment { return val; }, p.heightProperty(), - p.insetsProperty() - )); + p.insetsProperty())); } } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CharChoiceComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CharChoiceComp.java index 9cec677e..b2fa1b52 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CharChoiceComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CharChoiceComp.java @@ -20,8 +20,7 @@ public class CharChoiceComp extends Comp> { public CharChoiceComp( Property value, Map> range, - ObservableValue customName - ) { + ObservableValue customName) { this.value = value; this.range = range; this.customName = customName; diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CharsetChoiceComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CharsetChoiceComp.java index 4bca58ac..a2e83604 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CharsetChoiceComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CharsetChoiceComp.java @@ -22,11 +22,10 @@ public class CharsetChoiceComp extends SimpleComp { charset, streamCharset -> { return new Label(streamCharset.getCharset().displayName() - + (streamCharset.hasByteOrderMark() ? " (BOM)" : "")); + + (streamCharset.hasByteOrderMark() ? " (BOM)" : "")); }, new Label(I18n.get("extension.none")), - null - ); + null); builder.addFilter((charset, filter) -> { return charset.getCharset().displayName().contains(filter); }); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ChoiceComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ChoiceComp.java index 6cee51b5..e8c23254 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ChoiceComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ChoiceComp.java @@ -18,10 +18,7 @@ import lombok.experimental.FieldDefaults; import java.util.Map; -@FieldDefaults( - makeFinal = true, - level = AccessLevel.PRIVATE -) +@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) public class ChoiceComp extends Comp>> { Property value; diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ChoicePaneComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ChoicePaneComp.java index d7d5a2a2..8b4a592d 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ChoicePaneComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ChoicePaneComp.java @@ -20,10 +20,7 @@ import lombok.experimental.FieldDefaults; import java.util.List; import java.util.function.Function; -@FieldDefaults( - makeFinal = true, - level = AccessLevel.PRIVATE -) +@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) @AllArgsConstructor public class ChoicePaneComp extends Comp> { @@ -78,6 +75,5 @@ public class ChoicePaneComp extends Comp> { return new SimpleCompStructure<>(vbox); } - public record Entry(ObservableValue name, Comp comp) { - } + public record Entry(ObservableValue name, Comp comp) {} } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CodeSnippet.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CodeSnippet.java index 9bfff371..791e1833 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CodeSnippet.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CodeSnippet.java @@ -120,9 +120,7 @@ public record CodeSnippet(List lines) { } } - public record Line(List elements) { - } + public record Line(List elements) {} - public record ColorScheme(Color keyword, Color identifier, Color type, Color string) { - } + public record ColorScheme(Color keyword, Color identifier, Color type, Color string) {} } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CodeSnippetComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CodeSnippetComp.java index 9651c6e2..de333f0a 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CodeSnippetComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/CodeSnippetComp.java @@ -36,8 +36,7 @@ public class CodeSnippetComp extends Comp> { private static String toRGBCode(Color color) { return String.format( "#%02X%02X%02X", - (int) (color.getRed() * 255), (int) (color.getGreen() * 255), (int) (color.getBlue() * 255) - ); + (int) (color.getRed() * 255), (int) (color.getGreen() * 255), (int) (color.getBlue() * 255)); } private void fillArea(VBox lineNumbers, InlineCssTextArea s) { @@ -88,7 +87,8 @@ public class CodeSnippetComp extends Comp> { s.getParent().fireEvent(e); e.consume(); }); - s.prefHeightProperty().setValue(20 * this.value.getValue().lines().stream().count()); + s.prefHeightProperty() + .setValue(20 * this.value.getValue().lines().stream().count()); var lineNumbers = new VBox(); lineNumbers.getStyleClass().add("line-numbers"); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/DynamicOptionsComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/DynamicOptionsComp.java index 8e82f1d8..0dfde6ae 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/DynamicOptionsComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/DynamicOptionsComp.java @@ -104,8 +104,7 @@ public class DynamicOptionsComp extends Comp> { .orElse(0.0); return m; }, - compRegions.stream().map(Region::widthProperty).toList().toArray(new Observable[0]) - ); + compRegions.stream().map(Region::widthProperty).toList().toArray(new Observable[0])); compRegions.forEach(r -> r.prefWidthProperty().bind(compWidthBinding)); } @@ -122,8 +121,7 @@ public class DynamicOptionsComp extends Comp> { .orElse(0.0); return m; }, - nameRegions.stream().map(Region::widthProperty).toList().toArray(new Observable[0]) - ); + nameRegions.stream().map(Region::widthProperty).toList().toArray(new Observable[0])); nameRegions.forEach(r -> r.prefWidthProperty().bind(nameWidthBinding)); } @@ -134,6 +132,5 @@ public class DynamicOptionsComp extends Comp> { return entries; } - public record Entry(String key, ObservableValue name, Comp comp) { - } + public record Entry(String key, ObservableValue name, Comp comp) {} } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FancyTooltipAugment.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FancyTooltipAugment.java index d8f87195..15413f74 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FancyTooltipAugment.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FancyTooltipAugment.java @@ -21,7 +21,8 @@ import javafx.util.Duration; public class FancyTooltipAugment> implements Augment { - private static final TooltipBehavior BEHAVIOR = new TooltipBehavior(Duration.millis(400), Duration.INDEFINITE, Duration.millis(100)); + private static final TooltipBehavior BEHAVIOR = + new TooltipBehavior(Duration.millis(400), Duration.INDEFINITE, Duration.millis(100)); private final ObservableValue text; public FancyTooltipAugment(ObservableValue text) { @@ -67,6 +68,7 @@ public class FancyTooltipAugment> implements Augment< * the next tooltip to be shown */ private JFXTooltip nextTooltip; + private final EventHandler exitHandler = (MouseEvent event) -> { // stop running hover timer as the mouse exited the node if (hoverTimer.getStatus() == Timeline.Status.RUNNING) { @@ -109,7 +111,7 @@ public class FancyTooltipAugment> implements Augment< // set tooltip orientation NodeOrientation nodeOrientation = hoveredNode.getEffectiveNodeOrientation(); nextTooltip.getScene().setNodeOrientation(nodeOrientation); - //show tooltip + // show tooltip showTooltip(nextTooltip); currentTooltip = nextTooltip; hoveredNode = null; @@ -131,7 +133,9 @@ public class FancyTooltipAugment> implements Augment< private void setVisibleDuration(Duration duration) { visibleTimer.getKeyFrames().setAll(new KeyFrame(duration)); - } private final EventHandler moveHandler = (MouseEvent event) -> { + } + + private final EventHandler moveHandler = (MouseEvent event) -> { // if tool tip is already showing, do nothing if (visibleTimer.getStatus() == Timeline.Status.RUNNING) { return; @@ -169,7 +173,9 @@ public class FancyTooltipAugment> implements Augment< private void setLeftDelay(Duration duration) { leftTimer.getKeyFrames().setAll(new KeyFrame(duration)); - } private final WeakEventHandler weakMoveHandler = new WeakEventHandler<>(moveHandler); + } + + private final WeakEventHandler weakMoveHandler = new WeakEventHandler<>(moveHandler); private void hideCurrentTooltip() { currentTooltip.hide(); @@ -229,9 +235,5 @@ public class FancyTooltipAugment> implements Augment< final Scene scene = node == null ? null : node.getScene(); return scene == null ? null : scene.getWindow(); } - - - - } } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FileStoreChoiceComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FileStoreChoiceComp.java index 6bf73daa..a6771e1f 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FileStoreChoiceComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FileStoreChoiceComp.java @@ -53,14 +53,14 @@ public class FileStoreChoiceComp extends SimpleComp { var fileNameComp = new TextFieldComp(fileProperty).apply(struc -> HBox.setHgrow(struc.get(), Priority.ALWAYS)); var fileBrowseButton = new IconButtonComp("mdi2f-folder-open-outline", () -> { - if (fileSystemProperty.get() != null && fileSystemProperty.get() instanceof LocalStore) { - var fileChooser = createChooser(); - File file = fileChooser.showOpenDialog(null); - if (file != null && file.exists()) { - fileProperty.setValue(file.toString()); - } - } - }) + if (fileSystemProperty.get() != null && fileSystemProperty.get() instanceof LocalStore) { + var fileChooser = createChooser(); + File file = fileChooser.showOpenDialog(null); + if (file != null && file.exists()) { + fileProperty.setValue(file.toString()); + } + } + }) .hide(fileSystemProperty.isNotEqualTo(new LocalStore())); var layout = new HorizontalComp(List.of(fileSystemChoiceComp, fileNameComp, fileBrowseButton)); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FilterComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FilterComp.java index 7ae2cb5d..e3a237a4 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FilterComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/FilterComp.java @@ -40,8 +40,7 @@ public class FilterComp extends Comp { .bind(Bindings.createBooleanBinding( () -> (filter.getText() == null || filter.getText().isEmpty()), filter.textProperty(), - filter.focusedProperty() - )); + filter.focusedProperty())); var stack = new StackPane(bgLabel, filter); stack.getStyleClass().add("filter-comp"); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/IntFieldComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/IntFieldComp.java index f5dff51a..50e22231 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/IntFieldComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/IntFieldComp.java @@ -11,10 +11,7 @@ import javafx.scene.input.KeyEvent; import lombok.AccessLevel; import lombok.experimental.FieldDefaults; -@FieldDefaults( - makeFinal = true, - level = AccessLevel.PRIVATE -) +@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) public class IntFieldComp extends Comp> { Property value; diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/PrettyImageComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/PrettyImageComp.java index e92c0abe..de4b55f1 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/PrettyImageComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/PrettyImageComp.java @@ -37,8 +37,7 @@ public class PrettyImageComp extends SimpleComp { return height * aspectRatioProperty.doubleValue(); } }, - aspectRatioProperty - ); + aspectRatioProperty); var heightProperty = Bindings.createDoubleBinding( () -> { boolean widthLimited = width / height < aspectRatioProperty.doubleValue(); @@ -48,22 +47,20 @@ public class PrettyImageComp extends SimpleComp { return height; } }, - aspectRatioProperty - ); + aspectRatioProperty); Node node; if (value.getValue().endsWith(".svg")) { - var storeIcon = - SvgComp.create(Bindings.createStringBinding(() -> XPipeDaemon.getInstance().svgImage(value.getValue()), value)); + var storeIcon = SvgComp.create( + Bindings.createStringBinding(() -> XPipeDaemon.getInstance().svgImage(value.getValue()), value)); aspectRatioProperty.bind(Bindings.createDoubleBinding( () -> { return storeIcon.getWidth().getValue().doubleValue() / storeIcon.getHeight().getValue().doubleValue(); }, storeIcon.getWidth(), - storeIcon.getHeight() - )); + storeIcon.getHeight())); node = storeIcon.createWebview(); ((WebView) node).prefWidthProperty().bind(widthProperty); ((WebView) node).maxWidthProperty().bind(widthProperty); @@ -81,8 +78,7 @@ public class PrettyImageComp extends SimpleComp { aspectRatioProperty.set(image.getWidth() / image.getHeight()); return image; }, - PlatformThread.sync(value) - )); + PlatformThread.sync(value))); storeIcon.fitWidthProperty().bind(widthProperty); storeIcon.fitHeightProperty().bind(heightProperty); storeIcon.setSmooth(true); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ShellStoreChoiceComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ShellStoreChoiceComp.java index f5967a5e..8bb27d26 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ShellStoreChoiceComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ShellStoreChoiceComp.java @@ -28,7 +28,6 @@ public class ShellStoreChoiceComp extends SimpleComp { return new ShellStoreChoiceComp<>(Mode.HOST_CHOICE, null, selected, ShellStore.class, shellStore -> true); } - public static ShellStoreChoiceComp proxy(ShellStore self, Property selected) { return new ShellStoreChoiceComp<>(Mode.PROXY_CHOICE, self, selected, ShellStore.class, shellStore -> true); } @@ -71,7 +70,8 @@ public class ShellStoreChoiceComp extends SimpleComp { @Override @SuppressWarnings("unchecked") protected Region createSimple() { - var comboBox = new CustomComboBoxBuilder(selected, this::createGraphic, new Label(I18n.get("none")), n -> true); + var comboBox = + new CustomComboBoxBuilder(selected, this::createGraphic, new Label(I18n.get("none")), n -> true); comboBox.setUnknownNode(t -> createGraphic(t)); var available = XPipeDaemon.getInstance().getNamedStores().stream() diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/SvgComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/SvgComp.java index 9505ba66..5044a4d1 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/SvgComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/SvgComp.java @@ -40,8 +40,7 @@ public class SvgComp { return new Size( Double.parseDouble(string.substring( 0, string.length() - unit.toString().length())), - unit - ); + unit); } } return new Size(Double.parseDouble(string), SizeUnits.PX); @@ -97,8 +96,7 @@ public class SvgComp { return wv.getWidth() / width.getValue().doubleValue(); }, wv.widthProperty(), - width - )); + width)); wv.maxWidthProperty().bind(wv.prefWidthProperty()); wv.maxHeightProperty().bind(wv.prefHeightProperty()); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TabPaneComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TabPaneComp.java index 53cc0af3..bab53d1d 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TabPaneComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TabPaneComp.java @@ -60,6 +60,5 @@ public class TabPaneComp extends Comp> { return new SimpleCompStructure<>(tabPane); } - public record Entry(ObservableValue name, String graphic, Comp comp) { - } + public record Entry(ObservableValue name, String graphic, Comp comp) {} } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TextFieldComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TextFieldComp.java index ae854201..7e34b5f4 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TextFieldComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/TextFieldComp.java @@ -35,8 +35,7 @@ public class TextFieldComp extends Comp> { @Override public CompStructure createBase() { - var text = new TextField( - currentValue.getValue() != null ? currentValue.getValue() : null); + var text = new TextField(currentValue.getValue() != null ? currentValue.getValue() : null); text.textProperty().addListener((c, o, n) -> { currentValue.setValue(n != null && n.length() > 0 ? n : null); }); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ToggleGroupComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ToggleGroupComp.java index d9b6c1fd..2452a3e7 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ToggleGroupComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/ToggleGroupComp.java @@ -59,7 +59,10 @@ public class ToggleGroupComp extends Comp> { for (int i = 1; i < box.getChildren().size() - 1; i++) { box.getChildren().get(i).getStyleClass().add("center"); } - box.getChildren().get(box.getChildren().size() - 1).getStyleClass().add("last"); + box.getChildren() + .get(box.getChildren().size() - 1) + .getStyleClass() + .add("last"); } }); diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/WriteModeChoiceComp.java b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/WriteModeChoiceComp.java index 47c23d0f..8940230a 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/impl/WriteModeChoiceComp.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/impl/WriteModeChoiceComp.java @@ -41,7 +41,8 @@ public class WriteModeChoiceComp extends SimpleComp implements Validatable { @Override protected Region createSimple() { var a = available; - Property>> map = new SimpleObjectProperty<>(new LinkedHashMap>()); + Property>> map = + new SimpleObjectProperty<>(new LinkedHashMap>()); for (WriteMode writeMode : a) { map.getValue().put(writeMode, I18n.observable(writeMode.getId())); } diff --git a/extension/src/main/java/io/xpipe/extension/fxcomps/util/BindingsHelper.java b/extension/src/main/java/io/xpipe/extension/fxcomps/util/BindingsHelper.java index ee6837aa..b17010ea 100644 --- a/extension/src/main/java/io/xpipe/extension/fxcomps/util/BindingsHelper.java +++ b/extension/src/main/java/io/xpipe/extension/fxcomps/util/BindingsHelper.java @@ -19,11 +19,11 @@ import java.util.function.Predicate; public class BindingsHelper { - private static final Set REFERENCES = Collections.newSetFromMap(new ConcurrentHashMap()); + private static final Set REFERENCES = + Collections.newSetFromMap(new ConcurrentHashMap()); public static void bindExclusive( - Property selected, Map> map, Property toBind - ) { + Property selected, Map> map, Property toBind) { selected.addListener((c, o, n) -> { toBind.unbind(); toBind.bind(map.get(n)); @@ -69,9 +69,8 @@ public class BindingsHelper { public static > T persist(T binding) { var dependencies = new HashSet(); while (dependencies.addAll(binding.getDependencies().stream() - .map(o -> (javafx.beans.Observable) o) - .toList())) { - } + .map(o -> (javafx.beans.Observable) o) + .toList())) {} dependencies.add(binding); BINDINGS.put(new WeakReference<>(binding), dependencies); return binding; @@ -80,9 +79,8 @@ public class BindingsHelper { public static > T persist(T binding) { var dependencies = new HashSet(); while (dependencies.addAll(binding.getDependencies().stream() - .map(o -> (javafx.beans.Observable) o) - .toList())) { - } + .map(o -> (javafx.beans.Observable) o) + .toList())) {} dependencies.add(binding); BINDINGS.put(new WeakReference<>(binding), dependencies); return binding; @@ -131,11 +129,12 @@ public class BindingsHelper { return l1; } - public static ObservableList filteredContentBinding(ObservableList l2,Predicate predicate) { + public static ObservableList filteredContentBinding(ObservableList l2, Predicate predicate) { return filteredContentBinding(l2, new SimpleObjectProperty<>(predicate)); } - public static ObservableList filteredContentBinding(ObservableList l2, ObservableValue> predicate) { + public static ObservableList filteredContentBinding( + ObservableList l2, ObservableValue> predicate) { ObservableList l1 = FXCollections.observableList(new ArrayList<>()); Runnable runnable = () -> { setContent(l1, l2.stream().filter(predicate.getValue()).toList()); @@ -144,7 +143,7 @@ public class BindingsHelper { l2.addListener((ListChangeListener) c -> { runnable.run(); }); - predicate.addListener((c,o,n) -> { + predicate.addListener((c, o, n) -> { runnable.run(); }); linkPersistently(l2, l1); diff --git a/extension/src/main/java/io/xpipe/extension/prefs/PrefsChoiceValue.java b/extension/src/main/java/io/xpipe/extension/prefs/PrefsChoiceValue.java index 71d38580..261f94a9 100644 --- a/extension/src/main/java/io/xpipe/extension/prefs/PrefsChoiceValue.java +++ b/extension/src/main/java/io/xpipe/extension/prefs/PrefsChoiceValue.java @@ -39,7 +39,9 @@ public interface PrefsChoiceValue extends Translatable { throw new AssertionError(); } - return all.stream().filter(t -> ((PrefsChoiceValue) t).isSelectable()).toList(); + return all.stream() + .filter(t -> ((PrefsChoiceValue) t).isSelectable()) + .toList(); } } diff --git a/extension/src/main/java/io/xpipe/extension/prefs/PrefsProvider.java b/extension/src/main/java/io/xpipe/extension/prefs/PrefsProvider.java index c23b90fa..8beb2715 100644 --- a/extension/src/main/java/io/xpipe/extension/prefs/PrefsProvider.java +++ b/extension/src/main/java/io/xpipe/extension/prefs/PrefsProvider.java @@ -38,7 +38,10 @@ public abstract class PrefsProvider { @SuppressWarnings("unchecked") public static T get(Class c) { - return (T) ALL.stream().filter(prefsProvider -> prefsProvider.getClass().equals(c)).findAny().orElseThrow(); + return (T) ALL.stream() + .filter(prefsProvider -> prefsProvider.getClass().equals(c)) + .findAny() + .orElseThrow(); } protected > T editable(T o, ObservableBooleanValue v) { diff --git a/extension/src/main/java/io/xpipe/extension/test/ExtensionTest.java b/extension/src/main/java/io/xpipe/extension/test/ExtensionTest.java index dc445fc3..62b542a1 100644 --- a/extension/src/main/java/io/xpipe/extension/test/ExtensionTest.java +++ b/extension/src/main/java/io/xpipe/extension/test/ExtensionTest.java @@ -15,7 +15,8 @@ public class ExtensionTest { Assertions.assertEquals(expected, actual); } else { for (int i = 0; i < Math.min(expected.size(), actual.size()); i++) { - Assertions.assertEquals(expected.getNodes().get(i), actual.getNodes().get(i)); + Assertions.assertEquals( + expected.getNodes().get(i), actual.getNodes().get(i)); } Assertions.assertEquals(expected, actual); } diff --git a/extension/src/main/java/io/xpipe/extension/util/ActionProvider.java b/extension/src/main/java/io/xpipe/extension/util/ActionProvider.java index 791f730c..777ced85 100644 --- a/extension/src/main/java/io/xpipe/extension/util/ActionProvider.java +++ b/extension/src/main/java/io/xpipe/extension/util/ActionProvider.java @@ -72,7 +72,6 @@ public interface ActionProvider { return null; } - public static interface DataStoreCallSite { Action createAction(T store); diff --git a/extension/src/main/java/io/xpipe/extension/util/ApplicationHelper.java b/extension/src/main/java/io/xpipe/extension/util/ApplicationHelper.java index 51b5eb0a..f8df8c85 100644 --- a/extension/src/main/java/io/xpipe/extension/util/ApplicationHelper.java +++ b/extension/src/main/java/io/xpipe/extension/util/ApplicationHelper.java @@ -12,7 +12,9 @@ public class ApplicationHelper { public static void executeLocalApplication(String s) throws Exception { var args = ShellTypes.getPlatformDefault().executeCommandListWithShell(s); - TrackEvent.withDebug("proc", "Executing local application").elements(args).handle(); + TrackEvent.withDebug("proc", "Executing local application") + .elements(args) + .handle(); try (var c = ShellStore.local().create().command(s).start()) { c.discardOrThrow(); } @@ -20,17 +22,21 @@ public class ApplicationHelper { public static void executeLocalApplication(List s) throws Exception { var args = ShellTypes.getPlatformDefault().executeCommandListWithShell(s); - TrackEvent.withDebug("proc", "Executing local application").elements(args).handle(); + TrackEvent.withDebug("proc", "Executing local application") + .elements(args) + .handle(); try (var c = ShellStore.local().create().command(s).start()) { c.discardOrThrow(); } } public static boolean isInPath(ShellProcessControl processControl, String executable) throws Exception { - return processControl.executeBooleanSimpleCommand(processControl.getShellType().getWhichCommand(executable)); + return processControl.executeBooleanSimpleCommand( + processControl.getShellType().getWhichCommand(executable)); } - public static void checkSupport(ShellProcessControl processControl, String executable, String displayName) throws Exception { + public static void checkSupport(ShellProcessControl processControl, String executable, String displayName) + throws Exception { if (!isInPath(processControl, executable)) { throw new IOException(displayName + " executable " + executable + " not found in PATH"); } diff --git a/extension/src/main/java/io/xpipe/extension/util/ChainedValidator.java b/extension/src/main/java/io/xpipe/extension/util/ChainedValidator.java index 39a55820..318c6d83 100644 --- a/extension/src/main/java/io/xpipe/extension/util/ChainedValidator.java +++ b/extension/src/main/java/io/xpipe/extension/util/ChainedValidator.java @@ -104,7 +104,6 @@ public class ChainedValidator implements Validator { .map(v -> v.createStringBinding(prefix, separator).get()) .collect(Collectors.joining("\n")); }, - observables - ); + observables); } } diff --git a/extension/src/main/java/io/xpipe/extension/util/CustomComboBoxBuilder.java b/extension/src/main/java/io/xpipe/extension/util/CustomComboBoxBuilder.java index 1ec0baf5..8ee8b41b 100644 --- a/extension/src/main/java/io/xpipe/extension/util/CustomComboBoxBuilder.java +++ b/extension/src/main/java/io/xpipe/extension/util/CustomComboBoxBuilder.java @@ -38,8 +38,7 @@ public class CustomComboBoxBuilder { private Function unknownNode; public CustomComboBoxBuilder( - Property selected, Function nodeFunction, Node emptyNode, Predicate veto - ) { + Property selected, Function nodeFunction, Node emptyNode, Predicate veto) { this.selected = selected; this.nodeFunction = nodeFunction; this.emptyNode = emptyNode; @@ -106,7 +105,7 @@ public class CustomComboBoxBuilder { .filter(e -> Objects.equals(c, e.getValue())) .map(e -> e.getKey()) .findAny() - .orElse(c == null || unknownNode == null? emptyNode : unknownNode.apply(c)); + .orElse(c == null || unknownNode == null ? emptyNode : unknownNode.apply(c)); cb.setValue(item); }); cb.valueProperty().addListener((c, o, n) -> { @@ -128,9 +127,9 @@ public class CustomComboBoxBuilder { var filteredNodes = nodes.stream() .filter(e -> e.equals(cb.getValue()) || !(nodeMap.get(e) != null - && (filterable.contains(nodeMap.get(e)) - && filterString.getValue() != null - && !filterPredicate.test(nodeMap.get(e), c)))) + && (filterable.contains(nodeMap.get(e)) + && filterString.getValue() != null + && !filterPredicate.test(nodeMap.get(e), c)))) .toList(); cb.setItems(FXCollections.observableList(filteredNodes)); }); diff --git a/extension/src/main/java/io/xpipe/extension/util/DataStoreFormatter.java b/extension/src/main/java/io/xpipe/extension/util/DataStoreFormatter.java index ed2c72fd..ffe2ff75 100644 --- a/extension/src/main/java/io/xpipe/extension/util/DataStoreFormatter.java +++ b/extension/src/main/java/io/xpipe/extension/util/DataStoreFormatter.java @@ -92,8 +92,7 @@ public class DataStoreFormatter { var lengthShare = (length - 3) / 2; return String.format( "%s.%s", - DataStoreFormatter.cut(name, lengthShare), DataStoreFormatter.cut(region, length - lengthShare) - ); + DataStoreFormatter.cut(name, lengthShare), DataStoreFormatter.cut(region, length - lengthShare)); } if (input.endsWith(".compute.amazonaws.com")) { @@ -103,8 +102,7 @@ public class DataStoreFormatter { var lengthShare = (length - 3) / 2; return String.format( "%s.%s", - DataStoreFormatter.cut(name, lengthShare), DataStoreFormatter.cut(region, length - lengthShare) - ); + DataStoreFormatter.cut(name, lengthShare), DataStoreFormatter.cut(region, length - lengthShare)); } return cut(input, length); diff --git a/extension/src/main/java/io/xpipe/extension/util/DataTypeParser.java b/extension/src/main/java/io/xpipe/extension/util/DataTypeParser.java index 4f1c4d80..b22d2b58 100644 --- a/extension/src/main/java/io/xpipe/extension/util/DataTypeParser.java +++ b/extension/src/main/java/io/xpipe/extension/util/DataTypeParser.java @@ -10,8 +10,8 @@ import java.util.stream.Collectors; public class DataTypeParser { - private static final Map currencies = - Currency.getAvailableCurrencies().stream().collect(Collectors.toMap(currency -> currency.getSymbol(), currency -> currency)); + private static final Map currencies = Currency.getAvailableCurrencies().stream() + .collect(Collectors.toMap(currency -> currency.getSymbol(), currency -> currency)); public static Optional parseMonetary(String val) { for (var availableCurrency : currencies.entrySet()) { @@ -23,7 +23,9 @@ public class DataTypeParser { } return Optional.of(ValueNode.ofCurrency( - val, node.get().getMetaAttribute(DataStructureNode.DECIMAL_VALUE), availableCurrency.getValue())); + val, + node.get().getMetaAttribute(DataStructureNode.DECIMAL_VALUE), + availableCurrency.getValue())); } } return Optional.empty(); diff --git a/extension/src/main/java/io/xpipe/extension/util/DynamicOptionsBuilder.java b/extension/src/main/java/io/xpipe/extension/util/DynamicOptionsBuilder.java index 94bab447..f23da1ed 100644 --- a/extension/src/main/java/io/xpipe/extension/util/DynamicOptionsBuilder.java +++ b/extension/src/main/java/io/xpipe/extension/util/DynamicOptionsBuilder.java @@ -76,8 +76,7 @@ public class DynamicOptionsBuilder { } public DynamicOptionsBuilder addCharacter( - Property prop, ObservableValue name, Map> names - ) { + Property prop, ObservableValue name, Map> names) { var comp = new CharChoiceComp(prop, names, null); entries.add(new DynamicOptionsComp.Entry(null, name, comp)); props.add(prop); @@ -88,28 +87,28 @@ public class DynamicOptionsBuilder { Property prop, ObservableValue name, Map> names, - ObservableValue customName - ) { + ObservableValue customName) { var comp = new CharChoiceComp(prop, names, customName); entries.add(new DynamicOptionsComp.Entry(null, name, comp)); props.add(prop); return this; } - public DynamicOptionsBuilder addToggle( - String nameKey, - Property prop - ) { - var comp = new ToggleGroupComp<>(prop, new SimpleObjectProperty<>( - Map.of(Boolean.TRUE, I18n.observable("extension.yes"), Boolean.FALSE, I18n.observable("extension.no")))); + public DynamicOptionsBuilder addToggle(String nameKey, Property prop) { + var comp = new ToggleGroupComp<>( + prop, + new SimpleObjectProperty<>(Map.of( + Boolean.TRUE, + I18n.observable("extension.yes"), + Boolean.FALSE, + I18n.observable("extension.no")))); entries.add(new DynamicOptionsComp.Entry(nameKey, I18n.observable(nameKey), comp)); props.add(prop); return this; } public DynamicOptionsBuilder addToggle( - Property prop, ObservableValue name, Map> names - ) { + Property prop, ObservableValue name, Map> names) { var comp = new ToggleGroupComp<>(prop, new SimpleObjectProperty<>(names)); entries.add(new DynamicOptionsComp.Entry(null, name, comp)); props.add(prop); @@ -117,8 +116,10 @@ public class DynamicOptionsBuilder { } public DynamicOptionsBuilder addChoice( - Property prop, ObservableValue name, Map> names, boolean includeNone - ) { + Property prop, + ObservableValue name, + Map> names, + boolean includeNone) { var comp = new ChoiceComp<>(prop, names, includeNone); entries.add(new DynamicOptionsComp.Entry(null, name, comp)); props.add(prop); @@ -126,8 +127,10 @@ public class DynamicOptionsBuilder { } public DynamicOptionsBuilder addChoice( - Property prop, ObservableValue name, ObservableValue>> names, boolean includeNone - ) { + Property prop, + ObservableValue name, + ObservableValue>> names, + boolean includeNone) { var comp = new ChoiceComp<>(prop, names, includeNone); entries.add(new DynamicOptionsComp.Entry(null, name, comp)); props.add(prop); @@ -241,8 +244,7 @@ public class DynamicOptionsBuilder { } public final DynamicOptionsBuilder bindChoice( - Supplier> creator, Property toSet - ) { + Supplier> creator, Property toSet) { props.forEach(prop -> { prop.addListener((c, o, n) -> { toSet.unbind(); @@ -258,8 +260,9 @@ public class DynamicOptionsBuilder { entries.add( 0, new DynamicOptionsComp.Entry( - null, null, Comp.of(() -> new Label(title.getValue())).styleClass("title-header")) - ); + null, + null, + Comp.of(() -> new Label(title.getValue())).styleClass("title-header"))); } return new DynamicOptionsComp(entries, wrap); } diff --git a/extension/src/main/java/io/xpipe/extension/util/ExclusiveValidator.java b/extension/src/main/java/io/xpipe/extension/util/ExclusiveValidator.java index d06d8fe3..ebe08759 100644 --- a/extension/src/main/java/io/xpipe/extension/util/ExclusiveValidator.java +++ b/extension/src/main/java/io/xpipe/extension/util/ExclusiveValidator.java @@ -81,7 +81,6 @@ public final class ExclusiveValidator implements Validator { () -> { return get().createStringBinding(prefix, separator).get(); }, - observables - ); + observables); } } diff --git a/extension/src/main/java/io/xpipe/extension/util/HttpHelper.java b/extension/src/main/java/io/xpipe/extension/util/HttpHelper.java index ee83b6e2..d589259e 100644 --- a/extension/src/main/java/io/xpipe/extension/util/HttpHelper.java +++ b/extension/src/main/java/io/xpipe/extension/util/HttpHelper.java @@ -13,8 +13,7 @@ public class HttpHelper { public static Path downloadFile(String urlS) throws Exception { var url = new URL(urlS); - var bytes = HttpHelper.executeGet(url, aFloat -> { - }); + var bytes = HttpHelper.executeGet(url, aFloat -> {}); var downloadFile = Files.createTempFile(null, null); Files.write(downloadFile, bytes); return downloadFile; diff --git a/extension/src/main/java/io/xpipe/extension/util/PrettyListView.java b/extension/src/main/java/io/xpipe/extension/util/PrettyListView.java index 4e4b0ce2..826a6d3d 100644 --- a/extension/src/main/java/io/xpipe/extension/util/PrettyListView.java +++ b/extension/src/main/java/io/xpipe/extension/util/PrettyListView.java @@ -79,16 +79,14 @@ public class PrettyListView extends ListView { w - prefWidth - insets.getRight(), insets.getTop(), prefWidth, - h - insets.getTop() - insets.getBottom() - ); + h - insets.getTop() - insets.getBottom()); final double prefHeight = hBar.prefHeight(-1); hBar.resizeRelocate( insets.getLeft(), h - prefHeight - insets.getBottom(), w - insets.getLeft() - insets.getRight(), - prefHeight - ); + prefHeight); } public static class NoSelectionModel extends MultipleSelectionModel { @@ -104,40 +102,31 @@ public class PrettyListView extends ListView { } @Override - public void selectIndices(int index, int... indices) { - } + public void selectIndices(int index, int... indices) {} @Override - public void selectAll() { - } + public void selectAll() {} @Override - public void selectFirst() { - } + public void selectFirst() {} @Override - public void selectLast() { - } + public void selectLast() {} @Override - public void clearAndSelect(int index) { - } + public void clearAndSelect(int index) {} @Override - public void select(int index) { - } + public void select(int index) {} @Override - public void select(T obj) { - } + public void select(T obj) {} @Override - public void clearSelection(int index) { - } + public void clearSelection(int index) {} @Override - public void clearSelection() { - } + public void clearSelection() {} @Override public boolean isSelected(int index) { @@ -150,11 +139,9 @@ public class PrettyListView extends ListView { } @Override - public void selectPrevious() { - } + public void selectPrevious() {} @Override - public void selectNext() { - } + public void selectNext() {} } } \ No newline at end of file diff --git a/extension/src/main/java/io/xpipe/extension/util/ScriptHelper.java b/extension/src/main/java/io/xpipe/extension/util/ScriptHelper.java index fbd55c96..fa0190ac 100644 --- a/extension/src/main/java/io/xpipe/extension/util/ScriptHelper.java +++ b/extension/src/main/java/io/xpipe/extension/util/ScriptHelper.java @@ -120,7 +120,8 @@ public class ScriptHelper { } // Check for special case of the command being a shell command - if (Arrays.stream(ShellTypes.getAllShellTypes()).anyMatch(shellType -> cmd.equals(shellType.getNormalOpenCommand()))) { + if (Arrays.stream(ShellTypes.getAllShellTypes()) + .anyMatch(shellType -> cmd.equals(shellType.getNormalOpenCommand()))) { return cmd; } } diff --git a/extension/src/main/java/io/xpipe/extension/util/SimpleValidator.java b/extension/src/main/java/io/xpipe/extension/util/SimpleValidator.java index 19f62868..2da21711 100644 --- a/extension/src/main/java/io/xpipe/extension/util/SimpleValidator.java +++ b/extension/src/main/java/io/xpipe/extension/util/SimpleValidator.java @@ -132,7 +132,6 @@ public class SimpleValidator implements Validator { } return str.toString(); }, - validationResultProperty - ); + validationResultProperty); } } diff --git a/extension/src/main/java/io/xpipe/extension/util/Validators.java b/extension/src/main/java/io/xpipe/extension/util/Validators.java index 85c5d49d..7ac80792 100644 --- a/extension/src/main/java/io/xpipe/extension/util/Validators.java +++ b/extension/src/main/java/io/xpipe/extension/util/Validators.java @@ -28,7 +28,8 @@ public class Validators { } } - public static void hostFeature(ShellStore host, Predicate predicate, String name) throws ValidationException { + public static void hostFeature(ShellStore host, Predicate predicate, String name) + throws ValidationException { if (!predicate.test(host)) { throw new ValidationException(I18n.get("extension.hostFeatureUnsupported", name)); } diff --git a/extension/src/main/java/io/xpipe/extension/util/WindowsRegistry.java b/extension/src/main/java/io/xpipe/extension/util/WindowsRegistry.java index 069b846f..1673b0a3 100644 --- a/extension/src/main/java/io/xpipe/extension/util/WindowsRegistry.java +++ b/extension/src/main/java/io/xpipe/extension/util/WindowsRegistry.java @@ -15,7 +15,8 @@ public class WindowsRegistry { } public static Optional readString(int hkey, String key, String valueName) { - if (!Advapi32Util.registryValueExists(hkey == HKEY_LOCAL_MACHINE ? WinReg.HKEY_LOCAL_MACHINE : WinReg.HKEY_CURRENT_USER, key, valueName)) { + if (!Advapi32Util.registryValueExists( + hkey == HKEY_LOCAL_MACHINE ? WinReg.HKEY_LOCAL_MACHINE : WinReg.HKEY_CURRENT_USER, key, valueName)) { return Optional.empty(); } diff --git a/extension/src/main/java/io/xpipe/extension/util/XPipeDaemon.java b/extension/src/main/java/io/xpipe/extension/util/XPipeDaemon.java index c84f92ad..7ce2d484 100644 --- a/extension/src/main/java/io/xpipe/extension/util/XPipeDaemon.java +++ b/extension/src/main/java/io/xpipe/extension/util/XPipeDaemon.java @@ -42,24 +42,20 @@ public interface XPipeDaemon { Property storeProperty, Property> provider, boolean showAnonymous, - boolean showSaved - ); + boolean showSaved); & Validatable> T namedStoreChooser( ObservableValue> filter, Property selected, - DataStoreProvider.Category category - ); + DataStoreProvider.Category category); & Validatable> T namedSourceChooser( ObservableValue>> filter, Property> selected, - DataSourceProvider.Category category - ); + DataSourceProvider.Category category); & Validatable> T sourceProviderChooser( - Property> provider, DataSourceProvider.Category category, DataSourceType filter - ); + Property> provider, DataSourceProvider.Category category, DataSourceType filter); Optional getNamedStore(String name); diff --git a/extension/src/main/java/module-info.java b/extension/src/main/java/module-info.java index 3a89582e..ba7fa4c0 100644 --- a/extension/src/main/java/module-info.java +++ b/extension/src/main/java/module-info.java @@ -54,5 +54,8 @@ open module io.xpipe.extension { uses ActionProvider; uses io.xpipe.extension.util.ModuleLayerLoader; - provides ModuleLayerLoader with DataSourceTarget.Loader, ActionProvider.Loader, PrefsProvider.Loader; + provides ModuleLayerLoader with + DataSourceTarget.Loader, + ActionProvider.Loader, + PrefsProvider.Loader; }