mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-27 19:05:46 +00:00
Various
This commit is contained in:
@@ -160,7 +160,8 @@ class BrowserFileListNameCell extends TableCell<BrowserEntry, String> {
|
||||
text.addListener(listener);
|
||||
|
||||
editing.addListener((observable, oldValue, newValue) -> {
|
||||
if (getTableRow().getItem() != null && getTableRow().getItem().equals(newValue)) {
|
||||
var item = getTableRow().getItem();
|
||||
if (item != null && item.equals(newValue)) {
|
||||
PlatformThread.runLaterIfNeeded(() -> {
|
||||
textField.setDisable(false);
|
||||
textField.requestFocus();
|
||||
@@ -168,7 +169,7 @@ class BrowserFileListNameCell extends TableCell<BrowserEntry, String> {
|
||||
var content = textField.getText();
|
||||
if (content != null && !content.isEmpty()) {
|
||||
var name = FilePath.of(content);
|
||||
var baseNameEnd = name.getBaseName().toString().length();
|
||||
var baseNameEnd = item.getRawFileEntry().getKind() == FileKind.DIRECTORY ? content.length() : name.getBaseName().toString().length();
|
||||
textField.selectRange(0, baseNameEnd);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -77,7 +77,10 @@ public class LeftSplitPaneComp extends Comp<LeftSplitPaneComp.Structure> {
|
||||
divs.getFirst().setPosition(d);
|
||||
r.layout();
|
||||
Platform.runLater(() -> {
|
||||
divs.getFirst().setPosition(oldPos / r.getWidth());
|
||||
// Div might be removed again since last time
|
||||
if (divs.size() > 0) {
|
||||
divs.getFirst().setPosition(oldPos / r.getWidth());
|
||||
}
|
||||
});
|
||||
if (onDividerChange != null) {
|
||||
onDividerChange.accept(d);
|
||||
|
||||
@@ -44,16 +44,20 @@ public class DataStoreProviders {
|
||||
return ALL.stream().filter(d -> d.getId().equalsIgnoreCase(id)).findAny();
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends DataStoreProvider> T byStore(DataStore store) {
|
||||
public static <T extends DataStoreProvider> Optional<T> byStoreIfPresent(DataStore store) {
|
||||
if (ALL == null) {
|
||||
throw new IllegalStateException("Not initialized");
|
||||
}
|
||||
|
||||
return (T) ALL.stream()
|
||||
return (Optional<T>) ALL.stream()
|
||||
.filter(d -> d.getStoreClasses().contains(store.getClass()))
|
||||
.findAny()
|
||||
.orElseThrow(() -> new IllegalArgumentException("Unknown store class"));
|
||||
.findAny();
|
||||
}
|
||||
|
||||
public static <T extends DataStoreProvider> T byStore(DataStore store) {
|
||||
return DataStoreProviders.<T>byStoreIfPresent(store).orElseThrow(() -> new IllegalArgumentException("Unknown store class"));
|
||||
}
|
||||
|
||||
public static List<DataStoreProvider> getAll() {
|
||||
|
||||
@@ -19,12 +19,16 @@ public abstract class Session implements AutoCloseable {
|
||||
}
|
||||
|
||||
protected void startAliveListener() {
|
||||
GlobalTimer.scheduleUntil(Duration.ofMillis(5000), false, () -> {
|
||||
GlobalTimer.scheduleUntil(Duration.ofMillis(10000), false, () -> {
|
||||
if (!isRunning()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ThreadHelper.runAsync(() -> {
|
||||
if (!isRunning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var r = checkAlive();
|
||||
if (r) {
|
||||
|
||||
@@ -28,9 +28,9 @@ public class ShellSession extends Session {
|
||||
try {
|
||||
shellControl.start();
|
||||
|
||||
var supportsAliveCheck =
|
||||
shellControl.getShellDialect().getDumbMode().supportsAnyPossibleInteraction();
|
||||
if (supportsAliveCheck) {
|
||||
var shouldAliveCheck = !shellControl.isLocal();
|
||||
var supportsAliveCheck = shellControl.getShellDialect().getDumbMode().supportsAnyPossibleInteraction();
|
||||
if (shouldAliveCheck && supportsAliveCheck) {
|
||||
startAliveListener();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -77,6 +77,10 @@ public class ShellSession extends Session {
|
||||
|
||||
@Override
|
||||
public boolean checkAlive() throws Exception {
|
||||
if (shellControl.isSubShellActive()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
// Don't print it constantly
|
||||
return shellControl
|
||||
|
||||
@@ -19,6 +19,7 @@ public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore
|
||||
stopSessionIfNeeded();
|
||||
} else {
|
||||
try {
|
||||
existingSession.getShellControl().waitForSubShellExit();
|
||||
existingSession.getShellControl().command(" echo xpipetest").execute();
|
||||
return new StubShellControl(existingSession.getShellControl());
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class BatchStoreAction<T extends DataStore> extends SerializableAct
|
||||
@Override
|
||||
public String getShortcutName() {
|
||||
var names = actions.size() > 3
|
||||
? actions.size() + "..."
|
||||
? actions.size() + " connections"
|
||||
: actions.stream()
|
||||
.map(a -> DataStorage.get()
|
||||
.getStoreEntryDisplayName(a.getRef().get()))
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class MultiStoreAction<T extends DataStore> extends Serializable
|
||||
@Override
|
||||
public String getShortcutName() {
|
||||
var names = refs.size() > 3
|
||||
? refs.size() + "..."
|
||||
? refs.size() + " connections"
|
||||
: refs.stream()
|
||||
.map(ref -> DataStorage.get().getStoreEntryDisplayName(ref.get()))
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.xpipe.app.process;
|
||||
|
||||
import io.xpipe.app.ext.DataStore;
|
||||
import io.xpipe.app.ext.StatefulDataStore;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.core.FailableConsumer;
|
||||
import io.xpipe.core.FailableFunction;
|
||||
import io.xpipe.core.FilePath;
|
||||
@@ -33,6 +34,16 @@ public interface ShellControl extends ProcessControl {
|
||||
|
||||
void write(byte[] b) throws IOException;
|
||||
|
||||
void setSubShellActive(boolean active);
|
||||
|
||||
boolean isSubShellActive();
|
||||
|
||||
default void waitForSubShellExit() {
|
||||
while (isSubShellActive()) {
|
||||
ThreadHelper.sleep(10);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
LocalProcessInputStream getStdout();
|
||||
|
||||
|
||||
@@ -246,6 +246,16 @@ public class WrapperShellControl implements ShellControl {
|
||||
parent.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSubShellActive(boolean active) {
|
||||
parent.setSubShellActive(active);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSubShellActive() {
|
||||
return parent.isSubShellActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
parent.close();
|
||||
|
||||
@@ -112,8 +112,8 @@ public class DataStoreEntry extends StorageElement {
|
||||
this.categoryUuid = categoryUuid;
|
||||
this.store = store;
|
||||
this.storeNode = storeNode;
|
||||
this.validity = validity;
|
||||
this.provider = store != null ? DataStoreProviders.byStore(store) : null;
|
||||
this.provider = store != null ? DataStoreProviders.byStoreIfPresent(store).orElse(null) : null;
|
||||
this.validity = this.provider != null ? validity : Validity.LOAD_FAILED;
|
||||
this.storePersistentStateNode = storePersistentState;
|
||||
this.notes = notes;
|
||||
this.icon = icon;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.root:windows { -color-bg-default-transparent: #1C1C1ED2; }
|
||||
.root:windows { -color-bg-default-transparent: #1C1C1ED5; }
|
||||
|
||||
.root:macos { -color-bg-default-transparent: #0d0d10D6; }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.root:windows { -color-bg-default-transparent: #0d1117b8; }
|
||||
.root:windows { -color-bg-default-transparent: #0d1117c3; }
|
||||
|
||||
.root:macos { -color-bg-default-transparent: #080d13d3; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user