X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fserializing%2FIndirectGUIComponentCreator.java;fp=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fserializing%2FIndirectGUIComponentCreator.java;h=23f8bcb8d82daefb3f35459b855e7229b355c306;hb=6ff37062ffff3ee3499e15b8d8bf532b4eaa6608;hp=1c6a4846d981ea061d0bf4b75929c9b2b8ead440;hpb=13e72d4157b071cbb58942d964f3c0bb00c26029;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectGUIComponentCreator.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectGUIComponentCreator.java index 1c6a4846..23f8bcb8 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectGUIComponentCreator.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/serializing/IndirectGUIComponentCreator.java @@ -2,6 +2,7 @@ package net.mograsim.logic.model.serializing; import java.io.IOException; import java.io.InputStream; +import java.io.UncheckedIOException; import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -11,6 +12,7 @@ import com.google.gson.JsonNull; import net.mograsim.logic.model.model.ViewModelModifiable; import net.mograsim.logic.model.model.components.GUIComponent; +import net.mograsim.logic.model.snippets.CodeSnippetSupplier; import net.mograsim.logic.model.util.JsonHandler; public class IndirectGUIComponentCreator @@ -94,9 +96,18 @@ public class IndirectGUIComponentCreator if (componentSupplier != null) return componentSupplier.create(model, params, name); } else - // we know id has to start with "file:" here - // because standardComponentIDs only contains strings starting with "class:" or "file:" - return SubmodelComponentDeserializer.create(model, resolvedID.substring(5), name); + // we know id has to start with "file:" here + // because standardComponentIDs only contains strings starting with "class:" or "file:" + if (params != null && !JsonNull.INSTANCE.equals(params)) + throw new IllegalArgumentException("Can't give params to a component deserialized from a JSON file"); + try + { + return SubmodelComponentSerializer.deserialize(model, resolvedID.substring(5), name, id, null); + } + catch (IOException e) + { + throw new UncheckedIOException(e); + } } throw new RuntimeException("Could not get component supplier for ID " + id); }