mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-26 18:35:43 +00:00
Cleanup
This commit is contained in:
@@ -14,9 +14,6 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.SequencedCollection;
|
||||
import java.util.SequencedSet;
|
||||
|
||||
public class ActionJacksonMapper {
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.xpipe.app.beacon;
|
||||
|
||||
import io.xpipe.app.ext.DataStore;
|
||||
import io.xpipe.app.ext.ShellStore;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.beacon.BeaconClientException;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.xpipe.app.beacon.impl;
|
||||
|
||||
import io.xpipe.app.core.AppLayoutModel;
|
||||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.terminal.TerminalView;
|
||||
import io.xpipe.app.util.*;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class DaemonModeExchangeImpl extends DaemonModeExchange {
|
||||
|
||||
OperationMode.switchToSyncIfPossible(mode);
|
||||
return DaemonModeExchange.Response.builder()
|
||||
.usedMode(OperationMode.map(OperationMode.get()))
|
||||
.usedMode(msg.getMode())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@ import io.modelcontextprotocol.spec.McpSchema;
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreCategory;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.storage.StorageListener;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.Value;
|
||||
@@ -178,8 +174,6 @@ public class AppMcpServer {
|
||||
} else {
|
||||
transportProvider.doOther(exchange);
|
||||
}
|
||||
} finally {
|
||||
exchange.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+1
-3
@@ -312,9 +312,7 @@ public class HttpStreamableServerTransportProvider implements McpStreamableServe
|
||||
return;
|
||||
}
|
||||
|
||||
McpSchema.InitializeRequest initializeRequest = objectMapper.convertValue(jsonrpcRequest.params(),
|
||||
new TypeReference<McpSchema.InitializeRequest>() {
|
||||
});
|
||||
McpSchema.InitializeRequest initializeRequest = objectMapper.convertValue(jsonrpcRequest.params(), new TypeReference<>() {});
|
||||
McpStreamableServerSession.McpStreamableServerSessionInit init = this.sessionFactory
|
||||
.startSession(initializeRequest);
|
||||
this.sessions.put(init.session().getId(), init.session());
|
||||
|
||||
@@ -5,8 +5,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import io.modelcontextprotocol.server.McpServerFeatures;
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.beacon.BeaconClientException;
|
||||
import io.xpipe.beacon.api.CategoryInfoExchange;
|
||||
import io.xpipe.core.JacksonMapper;
|
||||
import io.xpipe.core.StorePath;
|
||||
import lombok.Builder;
|
||||
@@ -15,7 +13,6 @@ import lombok.Value;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -72,7 +69,7 @@ public final class McpResources {
|
||||
JsonNode config;
|
||||
}
|
||||
|
||||
public static McpServerFeatures.SyncResourceSpecification connections() throws IOException {
|
||||
public static McpServerFeatures.SyncResourceSpecification connections() {
|
||||
McpSchema.Annotations annotations = new McpSchema.Annotations(List.of(McpSchema.Role.ASSISTANT), 1.0);
|
||||
var resource = McpSchema.Resource.builder()
|
||||
.uri("xpipe://connections")
|
||||
@@ -115,7 +112,7 @@ public final class McpResources {
|
||||
}
|
||||
|
||||
|
||||
public static McpServerFeatures.SyncResourceSpecification categories() throws IOException {
|
||||
public static McpServerFeatures.SyncResourceSpecification categories() {
|
||||
McpSchema.Annotations annotations = new McpSchema.Annotations(List.of(McpSchema.Role.ASSISTANT), 0.3);
|
||||
var resource = McpSchema.Resource.builder()
|
||||
.uri("xpipe://categories")
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface McpToolHandler extends BiFunction<McpSyncServerExchange, McpSch
|
||||
return request;
|
||||
}
|
||||
|
||||
public Optional<String> getOptionalStringArgument(String key) throws BeaconClientException {
|
||||
public Optional<String> getOptionalStringArgument(String key) {
|
||||
var o = request.arguments().get(key);
|
||||
if (o == null) {
|
||||
return Optional.empty();
|
||||
@@ -60,7 +60,7 @@ public interface McpToolHandler extends BiFunction<McpSyncServerExchange, McpSch
|
||||
return s;
|
||||
}
|
||||
|
||||
public Optional<Boolean> getOptionalBooleanArgument(String key) throws BeaconClientException {
|
||||
public Optional<Boolean> getOptionalBooleanArgument(String key) {
|
||||
var o = request.arguments().get(key);
|
||||
if (o == null) {
|
||||
return Optional.empty();
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import io.modelcontextprotocol.server.McpServerFeatures;
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
import io.xpipe.app.beacon.AppBeaconServer;
|
||||
import io.xpipe.app.beacon.BlobManager;
|
||||
import io.xpipe.app.core.AppExtensionManager;
|
||||
import io.xpipe.app.ext.ConnectionFileSystem;
|
||||
import io.xpipe.app.ext.FileEntry;
|
||||
@@ -12,23 +11,18 @@ import io.xpipe.app.ext.SingletonSessionStore;
|
||||
import io.xpipe.app.process.ShellControl;
|
||||
import io.xpipe.app.process.TerminalInitScriptConfig;
|
||||
import io.xpipe.app.process.WorkingDirectoryFunction;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStorageQuery;
|
||||
import io.xpipe.app.terminal.TerminalLaunch;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.util.CommandDialog;
|
||||
import io.xpipe.app.util.CommandSupport;
|
||||
import io.xpipe.app.util.ScriptHelper;
|
||||
import io.xpipe.beacon.BeaconClientException;
|
||||
import io.xpipe.core.FileInfo;
|
||||
import io.xpipe.core.FilePath;
|
||||
import io.xpipe.core.JacksonMapper;
|
||||
import io.xpipe.core.ModuleLayerLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class McpTools {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BrowserAbstractSessionModel<T extends BrowserSessionTab> {
|
||||
}
|
||||
|
||||
public void openSync(T e, BooleanProperty externalBusy) throws Exception {
|
||||
try (var b = new BooleanScope(externalBusy != null ? externalBusy : new SimpleBooleanProperty()).start()) {
|
||||
try (var ignored = new BooleanScope(externalBusy != null ? externalBusy : new SimpleBooleanProperty()).start()) {
|
||||
e.init();
|
||||
// Prevent multiple calls from interfering with each other
|
||||
synchronized (this) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public class BrowserFileChooserSessionModel extends BrowserAbstractSessionModel<
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
BrowserFileSystemTabModel model;
|
||||
|
||||
try (var b = new BooleanScope(externalBusy != null ? externalBusy : new SimpleBooleanProperty()).start()) {
|
||||
try (var ignored = new BooleanScope(externalBusy != null ? externalBusy : new SimpleBooleanProperty()).start()) {
|
||||
model = new BrowserFileSystemTabModel(this, store, selectionMode);
|
||||
model.init();
|
||||
// Prevent multiple calls from interfering with each other
|
||||
|
||||
@@ -221,8 +221,8 @@ public class BrowserFullSessionModel extends BrowserAbstractSessionModel<Browser
|
||||
boolean select)
|
||||
throws Exception {
|
||||
BrowserFileSystemTabModel model;
|
||||
try (var b = new BooleanScope(externalBusy != null ? externalBusy : new SimpleBooleanProperty()).start()) {
|
||||
try (var sessionBusy = new BooleanScope(busy).exclusive().start()) {
|
||||
try (var ignored = new BooleanScope(externalBusy != null ? externalBusy : new SimpleBooleanProperty()).start()) {
|
||||
try (var ignored2 = new BooleanScope(busy).exclusive().start()) {
|
||||
model = new BrowserFileSystemTabModel(this, store, BrowserFileSystemTabModel.SelectionMode.ALL);
|
||||
model.init();
|
||||
// Prevent multiple calls from interfering with each other
|
||||
|
||||
+3
-3
@@ -28,7 +28,7 @@ public class OpenFileNativeDetailsActionProvider implements BrowserActionProvide
|
||||
var e = entry.getRawFileEntry().getPath();
|
||||
var localFile = sc.getLocalSystemAccess().translateToLocalSystemPath(e);
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> {
|
||||
case OsType.Windows ignored -> {
|
||||
var shell = LocalShell.getLocalPowershell();
|
||||
if (shell.isEmpty()) {
|
||||
return;
|
||||
@@ -50,7 +50,7 @@ public class OpenFileNativeDetailsActionProvider implements BrowserActionProvide
|
||||
// So let's keep one process running
|
||||
shell.get().command(content).notComplex().execute();
|
||||
}
|
||||
case OsType.Linux linux -> {
|
||||
case OsType.Linux ignored -> {
|
||||
var dbus = String.format(
|
||||
"""
|
||||
dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItemProperties array:string:"file://%s" string:""
|
||||
@@ -69,7 +69,7 @@ public class OpenFileNativeDetailsActionProvider implements BrowserActionProvide
|
||||
: e.getParent()))
|
||||
.execute();
|
||||
}
|
||||
case OsType.MacOs macOs -> {
|
||||
case OsType.MacOs ignored -> {
|
||||
sc.osascriptCommand(String.format(
|
||||
"""
|
||||
set fileEntry to (POSIX file "%s") as text
|
||||
|
||||
@@ -7,7 +7,6 @@ import io.xpipe.app.util.GlobalClipboard;
|
||||
|
||||
import io.xpipe.app.util.GlobalObjectProperty;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.scene.input.ClipboardContent;
|
||||
import javafx.scene.input.DataFormat;
|
||||
import javafx.scene.input.Dragboard;
|
||||
|
||||
@@ -37,7 +37,6 @@ import static javafx.scene.control.TableColumn.SortType.ASCENDING;
|
||||
|
||||
public final class BrowserFileListComp extends SimpleComp {
|
||||
|
||||
private static final PseudoClass HIDDEN = PseudoClass.getPseudoClass("hidden");
|
||||
private static final PseudoClass EMPTY = PseudoClass.getPseudoClass("empty");
|
||||
private static final PseudoClass FILE = PseudoClass.getPseudoClass("file");
|
||||
private static final PseudoClass FOLDER = PseudoClass.getPseudoClass("folder");
|
||||
|
||||
@@ -58,10 +58,6 @@ public final class BrowserFileSystemHistory {
|
||||
cursor.set(history.size() - 1);
|
||||
}
|
||||
|
||||
public FilePath back() {
|
||||
return back(1);
|
||||
}
|
||||
|
||||
public FilePath back(int i) {
|
||||
if (!canGoBack.get()) {
|
||||
return null;
|
||||
|
||||
@@ -25,15 +25,12 @@ import io.xpipe.core.FileKind;
|
||||
import io.xpipe.core.FilePath;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.beans.value.ObservableDoubleValue;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import javafx.scene.control.SelectionMode;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@@ -318,7 +317,6 @@ public class BrowserFileTransferOperation {
|
||||
var targetFs = target.getFileSystem().createTransferOptimizedFileSystem();
|
||||
|
||||
try {
|
||||
var start = Instant.now();
|
||||
AtomicLong transferred = new AtomicLong();
|
||||
for (var e : flatFiles.entrySet()) {
|
||||
if (cancelled()) {
|
||||
@@ -355,8 +353,7 @@ public class BrowserFileTransferOperation {
|
||||
targetFile,
|
||||
targetFs,
|
||||
transferred,
|
||||
totalSize,
|
||||
start);
|
||||
totalSize);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -377,8 +374,7 @@ public class BrowserFileTransferOperation {
|
||||
FilePath targetFile,
|
||||
FileSystem targetFs,
|
||||
AtomicLong transferred,
|
||||
AtomicLong totalSize,
|
||||
Instant start)
|
||||
AtomicLong totalSize)
|
||||
throws Exception {
|
||||
if (cancelled()) {
|
||||
return;
|
||||
|
||||
@@ -21,8 +21,6 @@ import javafx.scene.layout.Region;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
@Value
|
||||
|
||||
@@ -4,7 +4,6 @@ import lombok.Value;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
@Value
|
||||
|
||||
@@ -20,13 +20,6 @@ public abstract class BrowserIconDirectoryType {
|
||||
|
||||
private static final List<BrowserIconDirectoryType> ALL = new ArrayList<>();
|
||||
|
||||
public static synchronized BrowserIconDirectoryType byId(String id) {
|
||||
return ALL.stream()
|
||||
.filter(fileType -> fileType.getId().equals(id))
|
||||
.findAny()
|
||||
.orElseThrow();
|
||||
}
|
||||
|
||||
public static synchronized void loadDefinitions() {
|
||||
ALL.add(new BrowserIconDirectoryType() {
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@ public class BrowserIconVariant {
|
||||
private final String lightIcon;
|
||||
private final String darkIcon;
|
||||
|
||||
public BrowserIconVariant(String icon) {
|
||||
this(icon, icon);
|
||||
}
|
||||
|
||||
public BrowserIconVariant(String lightIcon, String darkIcon) {
|
||||
this.lightIcon = lightIcon;
|
||||
this.darkIcon = darkIcon;
|
||||
|
||||
@@ -2,13 +2,10 @@ package io.xpipe.app.browser.menu;
|
||||
|
||||
import io.xpipe.app.browser.file.BrowserEntry;
|
||||
import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.util.LicenseProvider;
|
||||
|
||||
import javafx.scene.control.Menu;
|
||||
import javafx.scene.control.MenuItem;
|
||||
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BrowserMenuBranchProvider extends BrowserMenuItemProvider {
|
||||
|
||||
@@ -9,8 +9,6 @@ import io.xpipe.app.browser.file.BrowserFileSystemTabModel;
|
||||
import io.xpipe.app.comp.base.TooltipHelper;
|
||||
import io.xpipe.app.hub.action.StoreAction;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.BindingsHelper;
|
||||
import io.xpipe.app.util.LicenseProvider;
|
||||
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.MenuItem;
|
||||
@@ -19,7 +17,6 @@ import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
public abstract class MultiExecuteMenuProvider implements BrowserMenuBranchProvider {
|
||||
|
||||
protected abstract CommandBuilder createCommand(
|
||||
ShellControl sc, BrowserFileSystemTabModel model, BrowserEntry entry) throws Exception;
|
||||
ShellControl sc, BrowserFileSystemTabModel model, BrowserEntry entry);
|
||||
|
||||
@Override
|
||||
public List<BrowserMenuLeafProvider> getBranchingActions(
|
||||
|
||||
+3
-3
@@ -33,9 +33,9 @@ public class BrowseInNativeManagerMenuProvider implements BrowserMenuLeafProvide
|
||||
@Override
|
||||
public ObservableValue<String> getName(BrowserFileSystemTabModel model, List<BrowserEntry> entries) {
|
||||
return switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> AppI18n.observable("browseInWindowsExplorer");
|
||||
case OsType.Linux linux -> AppI18n.observable("browseInDefaultFileManager");
|
||||
case OsType.MacOs macOs -> AppI18n.observable("browseInFinder");
|
||||
case OsType.Windows ignored -> AppI18n.observable("browseInWindowsExplorer");
|
||||
case OsType.Linux ignored -> AppI18n.observable("browseInDefaultFileManager");
|
||||
case OsType.MacOs ignored -> AppI18n.observable("browseInFinder");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class RunFileMenuProvider extends MultiExecuteMenuProvider {
|
||||
return entries.stream().allMatch(entry -> isExecutable(entry.getRawFileEntry()));
|
||||
}
|
||||
|
||||
protected CommandBuilder createCommand(ShellControl sc, BrowserFileSystemTabModel model, BrowserEntry entry) throws Exception {
|
||||
protected CommandBuilder createCommand(ShellControl sc, BrowserFileSystemTabModel model, BrowserEntry entry) {
|
||||
return CommandBuilder.of()
|
||||
.add(sc.getShellDialect()
|
||||
.runScriptCommand(sc, entry.getRawFileEntry().getPath().toString()));
|
||||
|
||||
@@ -24,7 +24,6 @@ import atlantafx.base.controls.Spacer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class Comp<S extends CompStructure<?>> {
|
||||
@@ -72,12 +71,6 @@ public abstract class Comp<S extends CompStructure<?>> {
|
||||
return of(() -> new Separator(Orientation.VERTICAL));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <IR extends Region, SIN extends CompStructure<IR>, OR extends Region> Comp<CompStructure<OR>> derive(
|
||||
Comp<SIN> comp, Function<IR, OR> r) {
|
||||
return of(() -> r.apply((IR) comp.createRegion()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Comp<S>> T apply(Augment<S> augment) {
|
||||
if (augments == null) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.xpipe.app.comp.SimpleCompStructure;
|
||||
import io.xpipe.app.util.LabelGraphic;
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
|
||||
import javafx.beans.property.ReadOnlyDoubleWrapper;
|
||||
import javafx.beans.property.ReadOnlyIntegerWrapper;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
@@ -4,12 +4,10 @@ import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.CompStructure;
|
||||
import io.xpipe.app.comp.SimpleCompStructure;
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
import io.xpipe.core.FilePath;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.ListCell;
|
||||
@@ -18,7 +16,6 @@ import javafx.scene.input.KeyEvent;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.CompStructure;
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.layout.StackPane;
|
||||
|
||||
@@ -17,10 +16,6 @@ public class FontIconComp extends Comp<FontIconComp.Structure> {
|
||||
|
||||
private final ObservableValue<String> icon;
|
||||
|
||||
public FontIconComp(String icon) {
|
||||
this.icon = new SimpleStringProperty(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FontIconComp.Structure createBase() {
|
||||
var fi = new FontIcon();
|
||||
|
||||
@@ -7,8 +7,6 @@ import io.xpipe.app.util.LabelGraphic;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
import javafx.beans.property.ReadOnlyIntegerWrapper;
|
||||
import javafx.css.Size;
|
||||
import javafx.css.SizeUnits;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.HBox;
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package io.xpipe.app.comp.base;
|
||||
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.SimpleComp;
|
||||
import io.xpipe.app.core.AppFontSizes;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
import atlantafx.base.controls.Popover;
|
||||
import atlantafx.base.theme.Styles;
|
||||
|
||||
public class PopupMenuButtonComp extends SimpleComp {
|
||||
|
||||
private final ObservableValue<String> name;
|
||||
private final Comp<?> content;
|
||||
private final boolean lazy;
|
||||
|
||||
public PopupMenuButtonComp(ObservableValue<String> name, Comp<?> content, boolean lazy) {
|
||||
this.name = name;
|
||||
this.content = content;
|
||||
this.lazy = lazy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Region createSimple() {
|
||||
var popover = new Popover();
|
||||
if (!lazy) {
|
||||
popover.setContentNode(content.createRegion());
|
||||
}
|
||||
popover.setCloseButtonEnabled(false);
|
||||
popover.setHeaderAlwaysVisible(false);
|
||||
popover.setDetachable(true);
|
||||
AppFontSizes.xs(popover.getContentNode());
|
||||
|
||||
var extendedDescription = new Button();
|
||||
extendedDescription.textProperty().bind(name);
|
||||
extendedDescription.setMinWidth(Region.USE_PREF_SIZE);
|
||||
extendedDescription.getStyleClass().add(Styles.BUTTON_OUTLINED);
|
||||
extendedDescription.getStyleClass().add(Styles.ACCENT);
|
||||
extendedDescription.getStyleClass().add("long-description");
|
||||
extendedDescription.setOnAction(e -> {
|
||||
if (popover.isShowing()) {
|
||||
e.consume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (lazy) {
|
||||
popover.setContentNode(content.createRegion());
|
||||
}
|
||||
|
||||
popover.show(extendedDescription);
|
||||
e.consume();
|
||||
});
|
||||
return extendedDescription;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package io.xpipe.app.comp.base;
|
||||
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.CompStructure;
|
||||
import io.xpipe.app.comp.SimpleCompStructure;
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.control.ToolBar;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ToolbarComp extends Comp<CompStructure<ToolBar>> {
|
||||
|
||||
private final ObservableList<Comp<?>> entries;
|
||||
|
||||
public ToolbarComp(List<Comp<?>> comps) {
|
||||
entries = FXCollections.observableArrayList(List.copyOf(comps));
|
||||
}
|
||||
|
||||
public ToolbarComp(ObservableList<Comp<?>> entries) {
|
||||
this.entries = PlatformThread.sync(entries);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompStructure<ToolBar> createBase() {
|
||||
var b = new ToolBar();
|
||||
b.getStyleClass().add("horizontal-comp");
|
||||
entries.addListener((ListChangeListener<? super Comp<?>>) c -> {
|
||||
b.getItems().setAll(c.getList().stream().map(Comp::createRegion).toList());
|
||||
});
|
||||
for (var entry : entries) {
|
||||
b.getItems().add(entry.createRegion());
|
||||
}
|
||||
b.visibleProperty().bind(Bindings.isNotEmpty(entries));
|
||||
return new SimpleCompStructure<>(b);
|
||||
}
|
||||
}
|
||||
@@ -88,9 +88,9 @@ public class AppFontSizes {
|
||||
|
||||
public static AppFontSizes forOs(AppFontSizes windows, AppFontSizes linux, AppFontSizes mac) {
|
||||
return switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux1 -> linux;
|
||||
case OsType.MacOs macOs -> mac;
|
||||
case OsType.Windows windows1 -> windows;
|
||||
case OsType.Linux ignored -> linux;
|
||||
case OsType.MacOs ignored -> mac;
|
||||
case OsType.Windows ignored -> windows;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import io.xpipe.app.util.PlatformThread;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -45,13 +45,13 @@ public abstract class AppInstallation {
|
||||
|
||||
private static Path determineDefaultInstallationBasePath(boolean stage) {
|
||||
return switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux -> {
|
||||
case OsType.Linux ignored -> {
|
||||
yield Path.of(stage ? "/opt/xpipe-ptb" : "/opt/xpipe");
|
||||
}
|
||||
case OsType.MacOs macOs -> {
|
||||
case OsType.MacOs ignored -> {
|
||||
yield Path.of(stage ? "/Applications/XPipe PTB.app" : "/Applications/XPipe.app");
|
||||
}
|
||||
case OsType.Windows windows -> {
|
||||
case OsType.Windows ignored -> {
|
||||
var pg = AppLocations.getWindows().getProgramFiles();
|
||||
var systemPath = pg.resolve(stage ? "XPipe PTB" : "XPipe");
|
||||
if (Files.exists(systemPath)) {
|
||||
@@ -99,13 +99,13 @@ public abstract class AppInstallation {
|
||||
private static Path getInstallationBasePathForDaemonExecutable(Path executable) {
|
||||
// Resolve root path of installation relative to executable in a JPackage installation
|
||||
return switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux -> {
|
||||
case OsType.Linux ignored -> {
|
||||
yield executable.getParent().getParent();
|
||||
}
|
||||
case OsType.MacOs macOs -> {
|
||||
case OsType.MacOs ignored -> {
|
||||
yield executable.getParent().getParent().getParent();
|
||||
}
|
||||
case OsType.Windows windows -> {
|
||||
case OsType.Windows ignored -> {
|
||||
yield executable.getParent();
|
||||
}
|
||||
};
|
||||
@@ -114,10 +114,10 @@ public abstract class AppInstallation {
|
||||
private static Path getInstallationBasePathForJavaExecutable(Path executable) {
|
||||
// Resolve root path of installation relative to executable in a JPackage installation
|
||||
return switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux -> {
|
||||
case OsType.Linux ignored -> {
|
||||
yield executable.getParent().getParent().getParent().getParent();
|
||||
}
|
||||
case OsType.MacOs macOs -> {
|
||||
case OsType.MacOs ignored -> {
|
||||
yield executable
|
||||
.getParent()
|
||||
.getParent()
|
||||
@@ -126,7 +126,7 @@ public abstract class AppInstallation {
|
||||
.getParent()
|
||||
.getParent();
|
||||
}
|
||||
case OsType.Windows windows -> {
|
||||
case OsType.Windows ignored -> {
|
||||
yield executable.getParent().getParent();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.xpipe.core.Deobfuscator;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.slf4j.ILoggerFactory;
|
||||
import org.slf4j.IMarkerFactory;
|
||||
import org.slf4j.Logger;
|
||||
@@ -362,7 +361,6 @@ public class AppLogs {
|
||||
@Override
|
||||
protected void handleNormalizedLoggingCall(
|
||||
Level level, Marker marker, String msg, Object[] arguments, Throwable throwable) {
|
||||
var formatted = msg;
|
||||
if (arguments != null) {
|
||||
for (var arg : arguments) {
|
||||
msg = msg.replaceFirst("\\{}", Objects.toString(arg));
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package io.xpipe.app.core;
|
||||
|
||||
public class AppMacros {
|
||||
|
||||
private static AppMacros INSTANCE;
|
||||
|
||||
public static void init() {
|
||||
INSTANCE = new AppMacros();
|
||||
}
|
||||
|
||||
public static AppMacros get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public boolean isMacroSelectionModeEnabled() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -80,16 +80,6 @@ public class AppResources {
|
||||
withResource(module, file, con);
|
||||
}
|
||||
|
||||
public static void withResourceInLayer(
|
||||
String module, String file, ModuleLayer layer, FailableConsumer<Path, IOException> con) {
|
||||
try (var fs = FileSystems.newFileSystem(URI.create("module:/" + module), Map.of("layer", layer))) {
|
||||
var f = fs.getPath(module.replace('.', '/') + "/resources/" + file);
|
||||
con.accept(f);
|
||||
} catch (IOException e) {
|
||||
ErrorEventFactory.fromThrowable(e).omitted(true).build().handle();
|
||||
}
|
||||
}
|
||||
|
||||
private static void withResource(String module, String file, FailableConsumer<Path, IOException> con) {
|
||||
var path = module.startsWith("io.xpipe") ? module.replace('.', '/') + "/resources/" + file : file;
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.xpipe.app.core;
|
||||
|
||||
import io.xpipe.app.core.mode.OperationMode;
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.process.ShellDialect;
|
||||
import io.xpipe.app.process.ShellDialects;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
@@ -72,7 +71,7 @@ public class AppRestart {
|
||||
}
|
||||
|
||||
public static String getBackgroundRestartCommand() {
|
||||
return getBackgroundRestartCommand(ProcessControlProvider.get().getEffectiveLocalDialect());
|
||||
return getBackgroundRestartCommand(LocalShell.getDialect());
|
||||
}
|
||||
|
||||
public static String getTerminalRestartCommand(ShellDialect dialect) {
|
||||
@@ -88,7 +87,7 @@ public class AppRestart {
|
||||
}
|
||||
|
||||
public static String getTerminalRestartCommand() {
|
||||
return getTerminalRestartCommand(ProcessControlProvider.get().getEffectiveLocalDialect());
|
||||
return getTerminalRestartCommand(LocalShell.getDialect());
|
||||
}
|
||||
|
||||
public static void restart() {
|
||||
|
||||
@@ -293,10 +293,6 @@ public class AppTheme {
|
||||
Application.setUserAgentStylesheet(Styles.toDataURI(builder.toString()));
|
||||
}
|
||||
|
||||
public List<String> getAdditionalStylesheets() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableValue<String> toTranslatedString() {
|
||||
return new SimpleStringProperty(name);
|
||||
@@ -470,17 +466,17 @@ public class AppTheme {
|
||||
|
||||
static Theme getDefaultLightTheme() {
|
||||
return switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> PRIMER_LIGHT;
|
||||
case OsType.Linux linux -> PRIMER_LIGHT;
|
||||
case OsType.MacOs macOs -> CUPERTINO_LIGHT;
|
||||
case OsType.Windows ignored -> PRIMER_LIGHT;
|
||||
case OsType.Linux ignored -> PRIMER_LIGHT;
|
||||
case OsType.MacOs ignored -> CUPERTINO_LIGHT;
|
||||
};
|
||||
}
|
||||
|
||||
static Theme getDefaultDarkTheme() {
|
||||
return switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> PRIMER_DARK;
|
||||
case OsType.Linux linux -> PRIMER_DARK;
|
||||
case OsType.MacOs macOs -> CUPERTINO_DARK;
|
||||
case OsType.Windows ignored -> PRIMER_DARK;
|
||||
case OsType.Linux ignored -> PRIMER_DARK;
|
||||
case OsType.MacOs ignored -> CUPERTINO_DARK;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ public class AppTrayIcon {
|
||||
|
||||
var image =
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> "img/logo/full/logo_16x16.png";
|
||||
case OsType.Linux linux -> "img/logo/full/logo_24x24.png";
|
||||
case OsType.MacOs macOs -> "img/logo/padded/logo_24x24.png";
|
||||
case OsType.Windows ignored -> "img/logo/full/logo_16x16.png";
|
||||
case OsType.Linux ignored -> "img/logo/full/logo_24x24.png";
|
||||
case OsType.MacOs ignored -> "img/logo/padded/logo_24x24.png";
|
||||
};
|
||||
var url = AppResources.getResourceURL(AppResources.XPIPE_MODULE, image).orElseThrow();
|
||||
|
||||
@@ -68,14 +68,6 @@ public class AppTrayIcon {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isSupported() {
|
||||
return Desktop.isDesktopSupported() && SystemTray.isSupported();
|
||||
}
|
||||
|
||||
public final TrayIcon getAwtTrayIcon() {
|
||||
return trayIcon;
|
||||
}
|
||||
|
||||
private void ensureSystemTraySupported() {
|
||||
if (!SystemTray.isSupported()) {
|
||||
throw new UnsupportedOperationException(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.app.core.check;
|
||||
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.process.ShellDialects;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -30,7 +30,7 @@ public class AppCertutilCheck {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ProcessControlProvider.get().getEffectiveLocalDialect() != ShellDialects.CMD) {
|
||||
if (LocalShell.getDialect() != ShellDialects.CMD) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ public class AppShellCheck {
|
||||
public static void check() throws Exception {
|
||||
var checker =
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux ->
|
||||
case OsType.Linux ignored ->
|
||||
new AppShellChecker() {
|
||||
|
||||
@Override
|
||||
@@ -25,7 +25,7 @@ public class AppShellCheck {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
case OsType.MacOs macOs ->
|
||||
case OsType.MacOs ignored ->
|
||||
new AppShellChecker() {
|
||||
|
||||
@Override
|
||||
@@ -51,7 +51,7 @@ public class AppShellCheck {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
case OsType.Windows windows ->
|
||||
case OsType.Windows ignored ->
|
||||
new AppShellChecker() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public abstract class AppShellChecker {
|
||||
%s
|
||||
"""
|
||||
.formatted(
|
||||
ProcessControlProvider.get().getEffectiveLocalDialect().getDisplayName(),
|
||||
LocalShell.getDialect().getDisplayName(),
|
||||
modifyOutput(output),
|
||||
listReasons(),
|
||||
fallback);
|
||||
|
||||
@@ -175,6 +175,7 @@ public class BaseMode extends OperationMode {
|
||||
public void finalTeardown() throws Exception {
|
||||
TrackEvent.withInfo("Base mode shutdown started").build();
|
||||
AbstractAction.reset();
|
||||
AppMcpServer.reset();
|
||||
DataStorage.reset();
|
||||
DataStorageSyncHandler.getInstance().reset();
|
||||
SshLocalBridge.reset();
|
||||
@@ -195,6 +196,7 @@ public class BaseMode extends OperationMode {
|
||||
AppDataLock.unlock();
|
||||
BlobManager.reset();
|
||||
FileBridge.reset();
|
||||
AppFileWatcher.reset();
|
||||
GlobalTimer.reset();
|
||||
TrackEvent.info("Base mode shutdown finished");
|
||||
}
|
||||
|
||||
@@ -50,22 +50,6 @@ public abstract class OperationMode {
|
||||
};
|
||||
}
|
||||
|
||||
public static XPipeDaemonMode map(OperationMode mode) {
|
||||
if (mode == BACKGROUND) {
|
||||
return XPipeDaemonMode.BACKGROUND;
|
||||
}
|
||||
|
||||
if (mode == TRAY) {
|
||||
return XPipeDaemonMode.TRAY;
|
||||
}
|
||||
|
||||
if (mode == GUI) {
|
||||
return XPipeDaemonMode.GUI;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void externalShutdown() {
|
||||
// If we used System.exit(), we don't want to do this
|
||||
if (OperationMode.isInShutdown()) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.prefs.CloseBehaviourDialog;
|
||||
import io.xpipe.app.update.AppDistributionType;
|
||||
import io.xpipe.app.util.NativeWinWindowControl;
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.core.OsType;
|
||||
@@ -101,7 +102,7 @@ public class AppMainWindow {
|
||||
content.prefHeightProperty().bind(scene.heightProperty());
|
||||
scene.setFill(Color.TRANSPARENT);
|
||||
|
||||
ModifiedStage.prepareStage(stage);
|
||||
AppModifiedStage.prepareStage(stage);
|
||||
stage.setScene(scene);
|
||||
if (AppPrefs.get() != null) {
|
||||
stage.opacityProperty().bind(PlatformThread.sync(AppPrefs.get().windowOpacity()));
|
||||
|
||||
+6
-4
@@ -2,6 +2,8 @@ package io.xpipe.app.core.window;
|
||||
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.NativeMacOsWindowControl;
|
||||
import io.xpipe.app.util.NativeWinWindowControl;
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
@@ -18,7 +20,7 @@ import javafx.util.Duration;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
|
||||
public class ModifiedStage extends Stage {
|
||||
public class AppModifiedStage extends Stage {
|
||||
|
||||
public static boolean mergeFrame() {
|
||||
return SystemUtils.IS_OS_WINDOWS_10 || SystemUtils.IS_OS_WINDOWS_11 || SystemUtils.IS_OS_MAC;
|
||||
@@ -76,8 +78,8 @@ public class ModifiedStage extends Stage {
|
||||
|
||||
try {
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux -> {}
|
||||
case OsType.MacOs macOs -> {
|
||||
case OsType.Linux ignored -> {}
|
||||
case OsType.MacOs ignored -> {
|
||||
var ctrl = new NativeMacOsWindowControl(stage);
|
||||
var seamlessFrame = AppMainWindow.getInstance() != null
|
||||
&& AppMainWindow.getInstance().getStage() == stage
|
||||
@@ -96,7 +98,7 @@ public class ModifiedStage extends Stage {
|
||||
.pseudoClassStateChanged(
|
||||
PseudoClass.getPseudoClass("separate-frame"), !seamlessFrameApplied);
|
||||
}
|
||||
case OsType.Windows windows -> {
|
||||
case OsType.Windows ignored -> {
|
||||
var ctrl = new NativeWinWindowControl(stage);
|
||||
ctrl.setWindowAttribute(
|
||||
NativeWinWindowControl.DmwaWindowAttribute.DWMWA_USE_IMMERSIVE_DARK_MODE.get(),
|
||||
@@ -1,6 +1,5 @@
|
||||
package io.xpipe.app.core.window;
|
||||
|
||||
import io.xpipe.app.core.App;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
import javafx.geometry.Rectangle2D;
|
||||
@@ -52,29 +51,6 @@ public class AppWindowBounds {
|
||||
});
|
||||
}
|
||||
|
||||
public static Stage centerStage() {
|
||||
var stage = new Stage() {
|
||||
@Override
|
||||
public void centerOnScreen() {
|
||||
if (App.getApp() == null) {
|
||||
super.centerOnScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
var stage = App.getApp().getStage();
|
||||
this.setX(stage.getX() + stage.getWidth() / 2 - this.getWidth() / 2);
|
||||
this.setY(stage.getY() + stage.getHeight() / 2 - this.getHeight() / 2);
|
||||
clampWindow(this).ifPresent(rectangle2D -> {
|
||||
this.setX(rectangle2D.getMinX());
|
||||
this.setY(rectangle2D.getMinY());
|
||||
this.setWidth(rectangle2D.getWidth());
|
||||
this.setHeight(rectangle2D.getHeight());
|
||||
});
|
||||
}
|
||||
};
|
||||
return stage;
|
||||
}
|
||||
|
||||
public static Optional<Rectangle2D> clampWindow(Stage stage) {
|
||||
if (!areNumbersValid(stage.getWidth(), stage.getHeight())) {
|
||||
return Optional.empty();
|
||||
|
||||
@@ -51,9 +51,9 @@ public class AppWindowHelper {
|
||||
AppResources.with(AppResources.XPIPE_MODULE, dir, path -> {
|
||||
var size =
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux -> 128;
|
||||
case OsType.MacOs macOs -> 128;
|
||||
case OsType.Windows windows -> 32;
|
||||
case OsType.Linux ignored -> 128;
|
||||
case OsType.MacOs ignored -> 128;
|
||||
case OsType.Windows ignored -> 32;
|
||||
};
|
||||
stage.getIcons().add(AppImages.loadImage(path.resolve("logo_" + size + "x" + size + ".png")));
|
||||
});
|
||||
@@ -128,7 +128,7 @@ public class AppWindowHelper {
|
||||
}
|
||||
alert.getDialogPane().getScene().setFill(Color.TRANSPARENT);
|
||||
var stage = (Stage) alert.getDialogPane().getScene().getWindow();
|
||||
ModifiedStage.prepareStage(stage);
|
||||
AppModifiedStage.prepareStage(stage);
|
||||
addIcons(stage);
|
||||
setupStylesheets(alert.getDialogPane().getScene());
|
||||
return alert;
|
||||
|
||||
@@ -7,7 +7,6 @@ import io.xpipe.core.FilePath;
|
||||
import java.io.Closeable;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.xpipe.app.ext;
|
||||
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.util.SimpleValidator;
|
||||
import io.xpipe.app.util.Validator;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -13,9 +12,4 @@ public class GuiDialog {
|
||||
|
||||
Comp<?> comp;
|
||||
Validator validator;
|
||||
|
||||
public GuiDialog(Comp<?> comp) {
|
||||
this.comp = comp;
|
||||
this.validator = new SimpleValidator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.xpipe.app.ext;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,6 +30,7 @@ public class HostAddress {
|
||||
}
|
||||
|
||||
private final String value;
|
||||
@Getter
|
||||
private final List<String> available;
|
||||
|
||||
private HostAddress(String value, List<String> available) {this.value = value;
|
||||
@@ -57,7 +58,4 @@ public class HostAddress {
|
||||
return value;
|
||||
}
|
||||
|
||||
public List<String> getAvailable() {
|
||||
return available;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,7 @@ import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.CompStructure;
|
||||
import io.xpipe.app.comp.SimpleCompStructure;
|
||||
import io.xpipe.app.comp.base.*;
|
||||
import io.xpipe.app.hub.comp.StoreChoicePopover;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.DerivedObservableList;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.collections.ObservableList;
|
||||
@@ -20,10 +14,7 @@ import javafx.css.PseudoClass;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListCell;
|
||||
import javafx.scene.control.skin.ComboBoxListViewSkin;
|
||||
import javafx.scene.input.MouseButton;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.text.TextAlignment;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -2,18 +2,12 @@ package io.xpipe.app.ext;
|
||||
|
||||
import io.xpipe.app.storage.DataStateHandler;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public interface InternalCacheDataStore extends DataStore {
|
||||
|
||||
default <T> T getCache(String key, Class<T> c, T def) {
|
||||
return DataStateHandler.get().getCache(this, key, c, () -> def);
|
||||
}
|
||||
|
||||
default <T> T getOrCompute(String key, Class<T> c, Supplier<T> def) {
|
||||
return DataStateHandler.get().getCache(this, key, c, def);
|
||||
}
|
||||
|
||||
default void setCache(String key, Object val) {
|
||||
DataStateHandler.get().putCache(this, key, val);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.xpipe.app.ext;
|
||||
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.browser.BrowserStoreSessionTab;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.ModalOverlay;
|
||||
import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.CommandControl;
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface SetupProvider {
|
||||
|
||||
LabelGraphic getGraphic();
|
||||
|
||||
boolean checkInstalled() throws Exception;
|
||||
boolean checkInstalled();
|
||||
|
||||
void execute() throws Exception;
|
||||
|
||||
|
||||
@@ -2,12 +2,8 @@ package io.xpipe.app.ext;
|
||||
|
||||
import io.xpipe.app.action.AbstractAction;
|
||||
import io.xpipe.app.action.ActionProvider;
|
||||
import io.xpipe.app.comp.base.ModalOverlay;
|
||||
import io.xpipe.app.core.window.AppDialog;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.process.ShellScript;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import lombok.extern.jackson.Jacksonized;
|
||||
@@ -30,7 +26,7 @@ public class SetupToolActionProvider implements ActionProvider {
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void executeImpl() throws Exception {
|
||||
public void executeImpl() {
|
||||
var provider = SetupProvider.byId(type);
|
||||
if (provider.isEmpty()) {
|
||||
throw ErrorEventFactory.expected(new IllegalArgumentException("Setup action not found: " + type));
|
||||
|
||||
@@ -82,7 +82,7 @@ public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore
|
||||
|
||||
@Override
|
||||
default void validate() throws Exception {
|
||||
try (var sc = tempControl().start()) {}
|
||||
try (var ignored = tempControl().start()) {}
|
||||
}
|
||||
|
||||
default ShellControl standaloneControl() throws Exception {
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
package io.xpipe.app.hub.action.impl;
|
||||
|
||||
import io.xpipe.app.action.AbstractAction;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.ext.DataStore;
|
||||
import io.xpipe.app.ext.HostAddressSwitchStore;
|
||||
import io.xpipe.app.hub.action.HubBranchProvider;
|
||||
import io.xpipe.app.hub.action.HubLeafProvider;
|
||||
import io.xpipe.app.hub.action.HubMenuItemProvider;
|
||||
import io.xpipe.app.hub.action.StoreActionCategory;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.LabelGraphic;
|
||||
import javafx.beans.property.ReadOnlyStringWrapper;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class HostAddressSwitchBranchProvider implements HubBranchProvider<HostAddressSwitchStore> {
|
||||
|
||||
@@ -8,7 +8,6 @@ import io.xpipe.app.process.SystemState;
|
||||
import io.xpipe.core.FilePath;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
@@ -24,10 +23,6 @@ public class OsLogoComp extends SimpleComp {
|
||||
private final StoreEntryWrapper wrapper;
|
||||
private final ObservableValue<SystemStateComp.State> state;
|
||||
|
||||
public OsLogoComp(StoreEntryWrapper wrapper) {
|
||||
this(wrapper, new SimpleObjectProperty<>(SystemStateComp.State.SUCCESS));
|
||||
}
|
||||
|
||||
public OsLogoComp(StoreEntryWrapper wrapper, ObservableValue<SystemStateComp.State> state) {
|
||||
this.wrapper = wrapper;
|
||||
this.state = state;
|
||||
|
||||
@@ -235,8 +235,4 @@ public class StoreCategoryWrapper {
|
||||
public Property<String> nameProperty() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Property<Instant> lastAccessProperty() {
|
||||
return lastAccess;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,35 +5,24 @@ import io.xpipe.app.comp.SimpleComp;
|
||||
import io.xpipe.app.comp.base.*;
|
||||
import io.xpipe.app.core.AppFontSizes;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.core.window.AppDialog;
|
||||
import io.xpipe.app.ext.DataStore;
|
||||
import io.xpipe.app.ext.LocalStore;
|
||||
import io.xpipe.app.ext.ShellStore;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.BindingsHelper;
|
||||
import io.xpipe.app.util.DataStoreCategoryChoiceComp;
|
||||
import io.xpipe.app.util.LabelGraphic;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.MenuButton;
|
||||
import javafx.scene.input.MouseButton;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
import atlantafx.base.controls.Popover;
|
||||
import atlantafx.base.theme.Styles;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -4,7 +4,6 @@ import atlantafx.base.controls.Popover;
|
||||
import atlantafx.base.theme.Styles;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.*;
|
||||
import io.xpipe.app.core.AppFont;
|
||||
import io.xpipe.app.core.AppFontSizes;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.core.window.AppDialog;
|
||||
@@ -27,7 +26,6 @@ import javafx.scene.Node;
|
||||
import javafx.scene.control.MenuButton;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.app.ext.ValidationException;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.prefs.SupportedLocale;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
|
||||
import java.nio.file.Files;
|
||||
@@ -56,10 +55,6 @@ public class SystemIconManager {
|
||||
return all;
|
||||
}
|
||||
|
||||
public static Map<SystemIconSource, SystemIconSourceData> getSources() {
|
||||
return LOADED;
|
||||
}
|
||||
|
||||
public static Set<SystemIcon> getIcons() {
|
||||
return ICONS;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface SystemIconSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() throws Exception {}
|
||||
public void refresh() {}
|
||||
|
||||
@Override
|
||||
public Path getPath() {
|
||||
@@ -65,7 +65,7 @@ public interface SystemIconSource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() throws Exception {
|
||||
public void open() {
|
||||
if (Files.exists(path)) {
|
||||
DesktopHelper.browsePathLocal(path);
|
||||
}
|
||||
@@ -154,5 +154,5 @@ public interface SystemIconSource {
|
||||
|
||||
String getDescription();
|
||||
|
||||
void open() throws Exception;
|
||||
void open();
|
||||
}
|
||||
|
||||
@@ -6,10 +6,6 @@ public abstract class EventHandler {
|
||||
|
||||
private static EventHandler INSTANCE;
|
||||
|
||||
public static void set(EventHandler handler) {
|
||||
INSTANCE = handler;
|
||||
}
|
||||
|
||||
private static void init() {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = ServiceLoader.load(EventHandler.class).findFirst().orElseThrow();
|
||||
|
||||
@@ -15,8 +15,6 @@ import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.geometry.Insets;
|
||||
|
||||
import atlantafx.base.theme.Styles;
|
||||
import javafx.scene.layout.Background;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -2,18 +2,12 @@ package io.xpipe.app.prefs;
|
||||
|
||||
import io.xpipe.app.beacon.AppBeaconServer;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.ButtonComp;
|
||||
import io.xpipe.app.comp.base.TextAreaComp;
|
||||
import io.xpipe.app.comp.base.TextFieldComp;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.app.util.DocumentationLink;
|
||||
import io.xpipe.app.util.LabelGraphic;
|
||||
import io.xpipe.app.util.OptionsBuilder;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.ReadOnlyBooleanWrapper;
|
||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
public class ApiCategory extends AppPrefsCategory {
|
||||
|
||||
@@ -362,10 +362,6 @@ public class AppPrefs {
|
||||
public ObservableBooleanValue pinLocalMachineOnStartup() {
|
||||
return pinLocalMachineOnStartup;
|
||||
}
|
||||
|
||||
private final BooleanProperty confirmDeletions =
|
||||
mapLocal(new GlobalBooleanProperty(true), "confirmDeletions", Boolean.class, false);
|
||||
|
||||
@Getter
|
||||
private final List<AppPrefsCategory> categories;
|
||||
|
||||
@@ -407,7 +403,7 @@ public class AppPrefs {
|
||||
this.selectedCategory = new GlobalObjectProperty<>(categories.getFirst());
|
||||
}
|
||||
|
||||
public static void initLocal() throws Exception {
|
||||
public static void initLocal() {
|
||||
INSTANCE = new AppPrefs();
|
||||
PrefsProvider.getAll().forEach(prov -> prov.addPrefs(INSTANCE.extensionHandler));
|
||||
INSTANCE.loadLocal();
|
||||
@@ -556,10 +552,6 @@ public class AppPrefs {
|
||||
return automaticallyCheckForUpdates;
|
||||
}
|
||||
|
||||
public ReadOnlyBooleanProperty confirmDeletions() {
|
||||
return confirmDeletions;
|
||||
}
|
||||
|
||||
public ObservableValue<ExternalTerminalType> terminalType() {
|
||||
return terminalType;
|
||||
}
|
||||
|
||||
@@ -159,8 +159,4 @@ public class AppPrefsStorageHandler {
|
||||
return defaultObject;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean clear() {
|
||||
return FileUtils.deleteQuietly(file.toFile());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.ShellScript;
|
||||
import io.xpipe.app.terminal.TerminalLaunch;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
import io.xpipe.app.util.WindowsRegistry;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.xpipe.app.prefs;
|
||||
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.ContextualFileReferenceChoiceComp;
|
||||
import io.xpipe.app.comp.base.TextFieldComp;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.util.LabelGraphic;
|
||||
import io.xpipe.app.util.OptionsBuilder;
|
||||
|
||||
@@ -2,22 +2,18 @@ package io.xpipe.app.prefs;
|
||||
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.base.ButtonComp;
|
||||
import io.xpipe.app.comp.base.HorizontalComp;
|
||||
import io.xpipe.app.core.AppI18n;
|
||||
import io.xpipe.app.pwman.PasswordManager;
|
||||
import io.xpipe.app.util.*;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.Region;
|
||||
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PasswordManagerCategory extends AppPrefsCategory {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,6 @@ import javafx.scene.paint.Color;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class TerminalCategory extends AppPrefsCategory {
|
||||
|
||||
|
||||
@@ -14,10 +14,8 @@ import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.issue.UserReportComp;
|
||||
import io.xpipe.app.process.ShellScript;
|
||||
import io.xpipe.app.terminal.TerminalLaunch;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.update.AppDistributionType;
|
||||
import io.xpipe.app.util.*;
|
||||
import io.xpipe.core.FilePath;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
import com.sun.management.HotSpotDiagnosticMXBean;
|
||||
|
||||
@@ -10,9 +10,7 @@ import io.xpipe.app.util.ThreadHelper;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.layout.Background;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public class UpdateCheckComp extends SimpleComp {
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class WorkspaceCreationDialog {
|
||||
var shortcutName = name.get();
|
||||
var file =
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Windows w -> {
|
||||
case OsType.Windows ignored -> {
|
||||
var exec = AppInstallation.ofCurrent().getDaemonExecutablePath().toString();
|
||||
yield DesktopShortcuts.create(
|
||||
exec,
|
||||
|
||||
@@ -64,8 +64,4 @@ public class ProcessOutputException extends Exception {
|
||||
|| exitCode == CommandControl.INTERNAL_ERROR_EXIT_CODE
|
||||
|| exitCode == CommandControl.ELEVATION_FAILED_EXIT_CODE;
|
||||
}
|
||||
|
||||
public boolean isKill() {
|
||||
return exitCode == CommandControl.START_FAILED_EXIT_CODE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,6 @@ public interface ShellControl extends ProcessControl {
|
||||
|
||||
void writeLine(String line, boolean log) throws IOException;
|
||||
|
||||
void write(byte[] b) throws IOException;
|
||||
|
||||
void setSubShellActive(boolean active);
|
||||
|
||||
boolean isSubShellActive();
|
||||
@@ -82,8 +80,6 @@ public interface ShellControl extends ProcessControl {
|
||||
|
||||
ShellControl withSourceStore(DataStore store);
|
||||
|
||||
List<ShellTerminalInitCommand> getTerminalInitCommands();
|
||||
|
||||
ParentSystemAccess getParentSystemAccess();
|
||||
|
||||
void setParentSystemAccess(ParentSystemAccess access);
|
||||
@@ -96,8 +92,6 @@ public interface ShellControl extends ProcessControl {
|
||||
return true;
|
||||
}
|
||||
|
||||
ShellControl getMachineRootSession() throws Exception;
|
||||
|
||||
String getOsName();
|
||||
|
||||
ReentrantLock getLock();
|
||||
|
||||
@@ -16,5 +16,4 @@ public interface ShellLaunchCommand {
|
||||
|
||||
List<String> loginCommand(OsType.Any os);
|
||||
|
||||
List<String> openCommand();
|
||||
}
|
||||
|
||||
@@ -23,10 +23,6 @@ public class ShellStoreState extends DataStoreState implements SystemState {
|
||||
ShellTtyState ttyState;
|
||||
Boolean running;
|
||||
|
||||
public boolean isRunning() {
|
||||
return running != null ? running : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataStoreState mergeCopy(DataStoreState newer) {
|
||||
var shellStoreState = (ShellStoreState) newer;
|
||||
|
||||
@@ -91,11 +91,6 @@ public class WrapperShellControl implements ShellControl {
|
||||
return parent.withSourceStore(store);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShellTerminalInitCommand> getTerminalInitCommands() {
|
||||
return parent.getTerminalInitCommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParentSystemAccess getParentSystemAccess() {
|
||||
return parent.getParentSystemAccess();
|
||||
@@ -116,11 +111,6 @@ public class WrapperShellControl implements ShellControl {
|
||||
return parent.isLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShellControl getMachineRootSession() throws Exception {
|
||||
return parent.getMachineRootSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOsName() {
|
||||
return parent.getOsName();
|
||||
@@ -247,11 +237,6 @@ public class WrapperShellControl implements ShellControl {
|
||||
parent.writeLine(line, log);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
parent.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubShellActive(boolean active) {
|
||||
parent.setSubShellActive(active);
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.ShellControl;
|
||||
import io.xpipe.app.process.ShellScript;
|
||||
import io.xpipe.app.terminal.TerminalLaunch;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.util.*;
|
||||
import io.xpipe.core.InPlaceSecretValue;
|
||||
import io.xpipe.core.JacksonMapper;
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.ShellControl;
|
||||
import io.xpipe.app.process.ShellScript;
|
||||
import io.xpipe.app.terminal.TerminalLaunch;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.util.CommandSupport;
|
||||
import io.xpipe.core.InPlaceSecretValue;
|
||||
import io.xpipe.core.JacksonMapper;
|
||||
|
||||
@@ -158,18 +158,18 @@ public class KeePassXcPasswordManager implements PasswordManager {
|
||||
|
||||
Optional<Path> found =
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux -> {
|
||||
case OsType.Linux ignored -> {
|
||||
var paths = List.of(
|
||||
Path.of("/usr/bin/keepassxc-proxy"),
|
||||
Path.of("/usr/local/bin/keepassxc-proxy"),
|
||||
Path.of("/snap/keepassxc/current/usr/bin/keepassxc-proxy"));
|
||||
yield paths.stream().filter(path -> Files.exists(path)).findFirst();
|
||||
}
|
||||
case OsType.MacOs macOs -> {
|
||||
case OsType.MacOs ignored -> {
|
||||
var paths = List.of(Path.of("/Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy"));
|
||||
yield paths.stream().filter(path -> Files.exists(path)).findFirst();
|
||||
}
|
||||
case OsType.Windows windows -> {
|
||||
case OsType.Windows ignored -> {
|
||||
try {
|
||||
var foundKey = WindowsRegistry.local()
|
||||
.findKeyForEqualValueMatchRecursive(
|
||||
|
||||
@@ -4,7 +4,6 @@ import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.process.*;
|
||||
import io.xpipe.app.terminal.TerminalLaunch;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.util.CommandSupport;
|
||||
import io.xpipe.app.util.SecretManager;
|
||||
import io.xpipe.app.util.SecretRetrievalStrategy;
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.ShellControl;
|
||||
import io.xpipe.app.process.ShellScript;
|
||||
import io.xpipe.app.terminal.TerminalLaunch;
|
||||
import io.xpipe.app.terminal.TerminalLauncher;
|
||||
import io.xpipe.app.util.*;
|
||||
import io.xpipe.core.InPlaceSecretValue;
|
||||
import io.xpipe.core.JacksonMapper;
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.xpipe.app.storage;
|
||||
|
||||
import io.xpipe.app.ext.*;
|
||||
import io.xpipe.app.icon.SystemIconManager;
|
||||
import io.xpipe.app.icon.SystemIconSourceData;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.core.JacksonMapper;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package io.xpipe.app.storage;
|
||||
|
||||
public enum DataStoreEntryUserScope {
|
||||
PER_USER,
|
||||
SHARED
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.app.terminal;
|
||||
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.prefs.ExternalApplicationType;
|
||||
import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.ShellDialects;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
|
||||
public class CmdTerminalType
|
||||
implements ExternalApplicationType.PathApplication, ExternalTerminalType, TrackableTerminalType {
|
||||
@@ -20,7 +20,7 @@ public class CmdTerminalType
|
||||
|
||||
@Override
|
||||
public int getProcessHierarchyOffset() {
|
||||
var powershell = ShellDialects.isPowershell(ProcessControlProvider.get().getEffectiveLocalDialect());
|
||||
var powershell = ShellDialects.isPowershell(LocalShell.getDialect());
|
||||
return powershell ? 0 : -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,10 +46,6 @@ public abstract class ConfigFileTerminalPrompt implements TerminalPrompt {
|
||||
|
||||
protected String configuration;
|
||||
|
||||
protected void prepareCustomConfigFile(ShellControl sc, FilePath file) throws Exception {
|
||||
sc.view().writeTextFile(file, configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShellTerminalInitCommand terminalCommand() throws Exception {
|
||||
return new ShellTerminalInitCommand() {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package io.xpipe.app.terminal;
|
||||
|
||||
import io.xpipe.app.ext.PrefsChoiceValue;
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.prefs.ExternalApplicationType;
|
||||
import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.ShellDialects;
|
||||
import io.xpipe.app.process.TerminalInitFunction;
|
||||
import io.xpipe.app.update.AppDistributionType;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
import io.xpipe.core.OsType;
|
||||
|
||||
import lombok.Getter;
|
||||
@@ -71,17 +71,17 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
|
||||
// Fallback to an available default
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Linux linux -> {
|
||||
case OsType.Linux ignored -> {
|
||||
// This should not be termius or wave as all others take precedence
|
||||
var def = determineDefault(null);
|
||||
// If there's no other terminal available, use a fallback which won't work
|
||||
return def != TERMIUS && def != WaveTerminalType.WAVE_LINUX ? def : XTERM;
|
||||
}
|
||||
case OsType.MacOs macOs -> {
|
||||
case OsType.MacOs ignored -> {
|
||||
return MACOS_TERMINAL;
|
||||
}
|
||||
case OsType.Windows windows -> {
|
||||
return ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.CMD ? CMD : POWERSHELL;
|
||||
case OsType.Windows ignored -> {
|
||||
return LocalShell.getDialect() == ShellDialects.CMD ? CMD : POWERSHELL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -515,7 +515,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
|
||||
@Override
|
||||
public int getProcessHierarchyOffset() {
|
||||
return ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.BASH ? 0 : 1;
|
||||
return LocalShell.getDialect() == ShellDialects.BASH ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -626,7 +626,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
static ExternalTerminalType determineDefault(ExternalTerminalType existing) {
|
||||
// Check for incompatibility with fallback shell
|
||||
if (ExternalTerminalType.CMD.equals(existing)
|
||||
&& ProcessControlProvider.get().getEffectiveLocalDialect() != ShellDialects.CMD) {
|
||||
&& LocalShell.getDialect() != ShellDialects.CMD) {
|
||||
return ExternalTerminalType.POWERSHELL;
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||
// Check if detection failed for some reason
|
||||
if (r == null) {
|
||||
var def = OsType.getLocal() == OsType.WINDOWS
|
||||
? (ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.CMD
|
||||
? (LocalShell.getDialect() == ShellDialects.CMD
|
||||
? ExternalTerminalType.CMD
|
||||
: ExternalTerminalType.POWERSHELL)
|
||||
: OsType.getLocal() == OsType.MACOS ? ExternalTerminalType.MACOS_TERMINAL : null;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.xpipe.app.terminal;
|
||||
|
||||
import io.xpipe.app.core.AppInstallation;
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.prefs.ExternalApplicationType;
|
||||
import io.xpipe.app.process.CommandBuilder;
|
||||
@@ -99,7 +98,7 @@ public interface KittyTerminalType extends ExternalTerminalType, TrackableTermin
|
||||
|
||||
@Override
|
||||
public int getProcessHierarchyOffset() {
|
||||
return ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.BASH ? 0 : 1;
|
||||
return LocalShell.getDialect() == ShellDialects.BASH ? 0 : 1;
|
||||
}
|
||||
|
||||
public boolean isAvailable() {
|
||||
@@ -160,7 +159,7 @@ public interface KittyTerminalType extends ExternalTerminalType, TrackableTermin
|
||||
|
||||
@Override
|
||||
public int getProcessHierarchyOffset() {
|
||||
return ProcessControlProvider.get().getEffectiveLocalDialect() == ShellDialects.ZSH ? 1 : 0;
|
||||
return LocalShell.getDialect() == ShellDialects.ZSH ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package io.xpipe.app.terminal;
|
||||
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.prefs.ExternalApplicationType;
|
||||
import io.xpipe.app.process.CommandBuilder;
|
||||
import io.xpipe.app.process.ShellDialects;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
@@ -27,7 +27,7 @@ public class PowerShellTerminalType implements ExternalApplicationType.PathAppli
|
||||
|
||||
@Override
|
||||
public int getProcessHierarchyOffset() {
|
||||
var powershell = ShellDialects.isPowershell(ProcessControlProvider.get().getEffectiveLocalDialect());
|
||||
var powershell = ShellDialects.isPowershell(LocalShell.getDialect());
|
||||
return powershell ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,19 +56,17 @@ public class SecureCrtTerminalType implements ExternalApplicationType.WindowsTyp
|
||||
|
||||
@Override
|
||||
public void launch(TerminalLaunchConfiguration configuration) throws Exception {
|
||||
try (var sc = LocalShell.getShell()) {
|
||||
SshLocalBridge.init();
|
||||
var b = SshLocalBridge.get();
|
||||
var command = CommandBuilder.of()
|
||||
.add("/T")
|
||||
.add("/SSH2", "/ACCEPTHOSTKEYS", "/I")
|
||||
.addFile(b.getIdentityKey().toString())
|
||||
.add("/P", "" + b.getPort())
|
||||
.add("/L")
|
||||
.addQuoted(b.getUser())
|
||||
.add("localhost");
|
||||
launch(command);
|
||||
}
|
||||
SshLocalBridge.init();
|
||||
var b = SshLocalBridge.get();
|
||||
var command = CommandBuilder.of()
|
||||
.add("/T")
|
||||
.add("/SSH2", "/ACCEPTHOSTKEYS", "/I")
|
||||
.addFile(b.getIdentityKey().toString())
|
||||
.add("/P", "" + b.getPort())
|
||||
.add("/L")
|
||||
.addQuoted(b.getUser())
|
||||
.add("localhost");
|
||||
launch(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,6 @@ import lombok.Builder;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Value
|
||||
@Builder
|
||||
@@ -61,7 +60,7 @@ public class TerminalLaunch {
|
||||
l.launch();
|
||||
}
|
||||
|
||||
public TerminalLaunchBuilder localScript(ShellScript script) throws Exception {
|
||||
public TerminalLaunchBuilder localScript(ShellScript script) {
|
||||
var c = LocalShell.getShell().command(script);
|
||||
return command(c);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.xpipe.app.terminal;
|
||||
|
||||
import io.xpipe.app.core.AppInstallation;
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.app.ext.ProcessControlProvider;
|
||||
import io.xpipe.app.issue.ErrorEventFactory;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.process.CommandBuilder;
|
||||
@@ -56,7 +55,7 @@ public class TerminalLaunchConfiguration {
|
||||
var color = entry != null ? DataStorage.get().getEffectiveColor(entry) : null;
|
||||
|
||||
if (!AppPrefs.get().enableTerminalLogging().get()) {
|
||||
var d = ProcessControlProvider.get().getEffectiveLocalDialect();
|
||||
var d = LocalShell.getDialect();
|
||||
var launcherScript = d.terminalLauncherScript(request, adjustedTitle, alwaysPromptRestart);
|
||||
var config = new TerminalLaunchConfiguration(
|
||||
entry != null ? color : null, adjustedTitle, cleanTitle, preferTabs, launcherScript, d);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user