mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-03 11:20:34 +00:00
Fix category select on connection edit
This commit is contained in:
@@ -63,9 +63,7 @@ public class StoreCreationDialog {
|
||||
.getStoreCategoryIfPresent(e.getCategoryUuid())
|
||||
.orElseThrow();
|
||||
PlatformThread.runLaterIfNeeded(() -> {
|
||||
StoreViewState.get()
|
||||
.getActiveCategory()
|
||||
.setValue(StoreViewState.get().getCategoryWrapper(cat));
|
||||
StoreViewState.get().selectCategoryIntoViewIfNeeded(StoreViewState.get().getCategoryWrapper(cat));
|
||||
});
|
||||
|
||||
c.accept(e);
|
||||
@@ -106,9 +104,7 @@ public class StoreCreationDialog {
|
||||
.getStoreCategoryIfPresent(e.getCategoryUuid())
|
||||
.orElseThrow();
|
||||
PlatformThread.runLaterIfNeeded(() -> {
|
||||
StoreViewState.get()
|
||||
.getActiveCategory()
|
||||
.setValue(StoreViewState.get().getCategoryWrapper(cat));
|
||||
StoreViewState.get().selectCategoryIntoViewIfNeeded(StoreViewState.get().getCategoryWrapper(cat));
|
||||
});
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -12,7 +12,6 @@ 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 javafx.application.Platform;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.binding.Bindings;
|
||||
@@ -247,17 +246,21 @@ public class StoreViewState {
|
||||
.toList();
|
||||
if (matchingCats.size() == 1) {
|
||||
var onlyMatch = matchingCats.getFirst();
|
||||
StoreCategoryWrapper matchingParent = onlyMatch;
|
||||
while ((matchingParent = matchingParent.getParent()) != null) {
|
||||
if (matchingParent.equals(activeCategory.getValue())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
selectCategoryIntoViewIfNeeded(onlyMatch);
|
||||
}
|
||||
}
|
||||
|
||||
if (matchingParent == null) {
|
||||
activeCategory.setValue(onlyMatch);
|
||||
public void selectCategoryIntoViewIfNeeded(StoreCategoryWrapper category) {
|
||||
StoreCategoryWrapper matchingParent = category;
|
||||
while ((matchingParent = matchingParent.getParent()) != null) {
|
||||
if (matchingParent.equals(activeCategory.getValue())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matchingParent == null) {
|
||||
activeCategory.setValue(category);
|
||||
}
|
||||
}
|
||||
|
||||
private void initBatchListeners() {
|
||||
|
||||
Reference in New Issue
Block a user