Small fixes

This commit is contained in:
crschnick 2024-08-06 14:19:13 +00:00
parent 3d05c9b443
commit f8d13841ac
6 changed files with 20 additions and 16 deletions

View file

@ -164,7 +164,7 @@ public class StoreSection {
other -> {
// Legacy implementation that does not use children caches. Use for testing
// if (true) return DataStorage.get()
// .getDisplayParent(other.getEntry())
// .getDefaultDisplayParent(other.getEntry())
// .map(found -> found.equals(e.getEntry()))
// .orElse(false);

View file

@ -2,10 +2,8 @@ package io.xpipe.app.ext;
import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.store.DataStore;
import io.xpipe.core.util.FailableRunnable;
import io.xpipe.core.util.ModuleLayerLoader;
import lombok.AllArgsConstructor;
import lombok.Value;
@ -22,10 +20,6 @@ public abstract class ScanProvider {
return ALL;
}
public ScanOperation create(DataStore store) {
return null;
}
public ScanOperation create(DataStoreEntry entry, ShellControl sc) throws Exception {
return null;
}

View file

@ -10,6 +10,9 @@ import io.xpipe.app.fxcomps.util.PlatformThread;
import javafx.beans.binding.Bindings;
import javafx.beans.property.Property;
import javafx.scene.Cursor;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseButton;
import atlantafx.base.controls.CustomTextField;
@ -53,6 +56,13 @@ public class FilterComp extends Comp<CompStructure<CustomTextField>> {
filter.focusedProperty()));
filter.setAccessibleText("Filter");
filter.addEventFilter(KeyEvent.KEY_PRESSED,event -> {
if (new KeyCodeCombination(KeyCode.ESCAPE).match(event)) {
filter.getScene().getRoot().requestFocus();
event.consume();
}
});
filterText.subscribe(val -> {
PlatformThread.runLaterIfNeeded(() -> {
clear.setVisible(val != null);

View file

@ -157,7 +157,7 @@ public class DataStoreEntry extends StorageElement {
null,
uuid,
categoryUuid,
name,
name.trim(),
Instant.now(),
Instant.now(),
storeFromNode,
@ -194,7 +194,7 @@ public class DataStoreEntry extends StorageElement {
var categoryUuid = Optional.ofNullable(json.get("categoryUuid"))
.map(jsonNode -> UUID.fromString(jsonNode.textValue()))
.orElse(DataStorage.DEFAULT_CATEGORY_UUID);
var name = json.required("name").textValue();
var name = json.required("name").textValue().trim();
var persistentState = stateJson.get("persistentState");
var lastUsed = Optional.ofNullable(stateJson.get("lastUsed"))

View file

@ -40,7 +40,7 @@ public class ScanAlert {
});
}
private static void showForShellStore(DataStoreEntry initial) {
public static void showForShellStore(DataStoreEntry initial) {
show(initial, (DataStoreEntry entry, ShellControl sc) -> {
if (!sc.getShellDialect().getDumbMode().supportsAnyPossibleInteraction()) {
return null;

View file

@ -7,9 +7,7 @@ import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.ScanAlert;
import io.xpipe.core.process.ShellStoreState;
import io.xpipe.core.store.ShellStore;
import javafx.beans.value.ObservableValue;
import lombok.Value;
public class ScanStoreAction implements ActionProvider {
@ -67,7 +65,9 @@ public class ScanStoreAction implements ActionProvider {
@Override
public void execute() {
ScanAlert.showAsync(entry);
if (entry == null || entry.getStore() instanceof ShellStore) {
ScanAlert.showForShellStore(entry);
}
}
}
}