From 3363ad9f41972194bc874f34933b994fc38e04a4 Mon Sep 17 00:00:00 2001 From: crschnick Date: Fri, 10 May 2024 04:44:11 +0000 Subject: [PATCH] Update file host on file choice if needed --- .../impl/ContextualFileReferenceChoiceComp.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/main/java/io/xpipe/app/fxcomps/impl/ContextualFileReferenceChoiceComp.java b/app/src/main/java/io/xpipe/app/fxcomps/impl/ContextualFileReferenceChoiceComp.java index 60de3eb5d..816fb97e9 100644 --- a/app/src/main/java/io/xpipe/app/fxcomps/impl/ContextualFileReferenceChoiceComp.java +++ b/app/src/main/java/io/xpipe/app/fxcomps/impl/ContextualFileReferenceChoiceComp.java @@ -47,6 +47,19 @@ public class ContextualFileReferenceChoiceComp extends Comp> this.filePath = filePath; } + + public ContextualFileReferenceChoiceComp( + Property> fileSystem, Property filePath) { + this.fileSystem = new SimpleObjectProperty<>(); + fileSystem.subscribe(val -> { + this.fileSystem.setValue(val); + }); + this.fileSystem.addListener((observable, oldValue, newValue) -> { + fileSystem.setValue(newValue.get().ref()); + }); + this.filePath = filePath; + } + @Override public CompStructure createBase() { var fileNameComp = new TextFieldComp(filePath)