More rework

This commit is contained in:
crschnick 2024-06-14 13:04:47 +00:00
parent 4a2bc6a458
commit 4b263adb16
10 changed files with 19 additions and 26 deletions

View file

@ -10,7 +10,6 @@ import io.xpipe.app.fxcomps.augment.DragOverPseudoClassAugment;
import io.xpipe.app.fxcomps.impl.*;
import io.xpipe.app.fxcomps.util.DerivedObservableList;
import io.xpipe.app.fxcomps.util.PlatformThread;
import io.xpipe.core.process.OsType;
import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
import javafx.geometry.Insets;
@ -183,13 +182,7 @@ public class BrowserTransferComp extends SimpleComp {
event.consume();
});
struc.get().setOnDragDone(event -> {
// macOS does always report false here, which is unfortunate
if (!event.isAccepted() && !OsType.getLocal().equals(OsType.MACOS)) {
return;
}
// Don't clear, it might be more convenient to keep the contents
// model.clear();
model.clear();
event.consume();
});
}),

View file

@ -4,7 +4,6 @@ import io.xpipe.core.store.FileKind;
import io.xpipe.core.store.FileSystem;
import io.xpipe.core.store.LocalStore;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@ -19,13 +18,13 @@ public class LocalFileSystem {
}
}
public static FileSystem.FileEntry getLocalFileEntry(Path file) throws IOException {
public static FileSystem.FileEntry getLocalFileEntry(Path file) throws Exception {
if (localFileSystem == null) {
throw new IllegalStateException();
}
return new FileSystem.FileEntry(
localFileSystem,
localFileSystem.open(),
file.toString(),
Files.getLastModifiedTime(file).toInstant(),
Files.isHidden(file),

View file

@ -13,6 +13,7 @@ import javafx.scene.control.ScrollPane;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
@ -65,11 +66,11 @@ public class ListBoxViewComp<T> extends Comp<CompStructure<ScrollPane>> {
VBox listView, List<? extends T> shown, List<? extends T> all, Map<T, Region> cache, boolean asynchronous) {
Runnable update = () -> {
// Clear cache of unused values
if (cache.keySet().removeIf(t -> !all.contains(t))) {
int a = 0;
}
cache.keySet().removeIf(t -> !all.contains(t));
var newShown = shown.stream()
// Create copy to reduce chances of concurrent modification
var shownCopy = new ArrayList<>(shown);
var newShown = shownCopy.stream()
.map(v -> {
if (!cache.containsKey(v)) {
var comp = compFunction.apply(v);

View file

@ -262,7 +262,7 @@ public abstract class StoreEntryComp extends SimpleComp {
}
protected Comp<?> createSettingsButton() {
var settingsButton = new IconButtonComp("mdi2d-dots-horizontal-circle-outline", () -> {});
var settingsButton = new IconButtonComp("mdi2d-dots-horizontal-circle-outline", null);
settingsButton.styleClass("settings");
settingsButton.accessibleText("More");
settingsButton.apply(new ContextMenuAugment<>(

View file

@ -72,7 +72,7 @@ public class AppExtensionManager {
private void loadBaseExtension() {
var baseModule = findAndParseExtension("base", ModuleLayer.boot());
if (baseModule.isEmpty()) {
throw new ExtensionException("Missing base module. Is the installation corrupt?");
throw new ExtensionException("Missing base module. Is the installation data corrupt?");
}
baseLayer = baseModule.get().getModule().getLayer();

View file

@ -21,6 +21,6 @@ public class ExtensionException extends RuntimeException {
}
public static ExtensionException corrupt(String message) {
return new ExtensionException(message + ". Is the installation corrupt?");
return new ExtensionException(message + ". Is the installation data corrupt?");
}
}

View file

@ -53,12 +53,12 @@ public class IconButtonComp extends Comp<CompStructure<Button>> {
});
// fi.iconColorProperty().bind(button.textFillProperty());
button.setGraphic(fi);
button.setOnAction(e -> {
if (listener != null) {
if (listener != null) {
button.setOnAction(e -> {
listener.run();
e.consume();
}
});
});
}
button.getStyleClass().add("icon-button-comp");
return new SimpleCompStructure<>(button);
}

View file

@ -42,7 +42,6 @@ public final class FilePath {
return this;
}
var backslash = value.contains("\\");
var p = Pattern.compile("[^/\\\\]+");
var m = p.matcher(value);
var replaced = m.replaceAll(matchResult -> osType.makeFileSystemCompatible(matchResult.group()));

View file

@ -59,10 +59,10 @@ open module io.xpipe.ext.base {
JavapAction,
JarAction;
provides ActionProvider with ServiceOpenAction, ServiceCopyUrlAction,
CloneStoreAction, RefreshChildrenStoreAction, ScanStoreAction, LaunchStoreAction,
CloneStoreAction, RefreshChildrenStoreAction, LaunchStoreAction,
XPipeUrlAction,
EditStoreAction, DeleteChildrenStoreAction,
BrowseStoreAction;
BrowseStoreAction, ScanStoreAction;
provides DataStoreProvider with FixedServiceGroupStoreProvider, ServiceGroupStoreProvider, CustomServiceStoreProvider, MappedServiceStoreProvider, FixedServiceStoreProvider, SimpleScriptStoreProvider, DesktopEnvironmentStoreProvider, DesktopApplicationStoreProvider, DesktopCommandStoreProvider, ScriptGroupStoreProvider;
provides DataStorageExtensionProvider with ScriptDataStorageProvider;
}

View file

@ -332,4 +332,5 @@ dockerContext.displayDescription=Interact with containers located in a specific
containerActions=Container actions
vmActions=VM actions
dockerContextActions=Context actions
k8sPodActions=Pod actions
k8sPodActions=Pod actions
openVnc=Set up VNC