Fix connection category target computation

This commit is contained in:
crschnick committed 2023-12-29 00:40:17 +00:00
1 parent a533de0300
commit dd87d07e1f
2 files changed
+30 -5

No files matched your search

@@ -110,13 +110,22 @@ public class GuiDsStoreCreator extends MultiStepComp.Step<CompStructure<?>> {
name.getValue(),
store.getValue());
var p = provider.getValue().getDisplayParent(testE);
var targetCategory = p != null
? p.getCategoryUuid()
: DataStorage.get()
.getSelectedCategory()
.getUuid();
var rootCategory = DataStorage.get().getRootCategory(DataStorage.get().getStoreCategoryIfPresent(targetCategory).orElseThrow());
// Don't put connections in the scripts category ever
if (!provider.getValue().getCreationCategory().equals(DataStoreProvider.CreationCategory.SCRIPT) &&
rootCategory.equals(DataStorage.get().getAllScriptsCategory())) {
targetCategory = DataStorage.get().getDefaultCategory().getUuid();
}
return DataStoreEntry.createNew(
UUID.randomUUID(),
p != null
? p.getCategoryUuid()
: DataStorage.get()
.getSelectedCategory()
.getUuid(),
targetCategory,
name.getValue(),
store.getValue());
}, name, store);