X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.editor%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Feditor%2FSaveLoadManager.java;h=e690200e93d98443d532373acb2ab790d4ecdf4f;hb=148a58630b38b30d4d24a21e3f55c357f5b4d0bc;hp=6d951affca751fd3805bc9b945da579a4add5337;hpb=f0cbb45372e15f8fe1a36334f78d61c387d6c4c9;p=Mograsim.git diff --git a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/SaveLoadManager.java b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/SaveLoadManager.java index 6d951aff..e690200e 100644 --- a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/SaveLoadManager.java +++ b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/SaveLoadManager.java @@ -1,8 +1,6 @@ package net.mograsim.logic.model.editor; import java.io.IOException; -import java.util.Map; -import java.util.Map.Entry; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.FileDialog; @@ -10,11 +8,8 @@ import org.eclipse.swt.widgets.Shell; import net.mograsim.logic.model.model.ViewModelModifiable; import net.mograsim.logic.model.serializing.DeserializedSubmodelComponent; -import net.mograsim.logic.model.serializing.IdentifierGetter; import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; import net.mograsim.logic.model.serializing.SubmodelComponentSerializer; -import net.mograsim.logic.model.snippets.SubmodelComponentSnippetSuppliers; -import net.mograsim.logic.model.snippets.highlevelstatehandlers.standard.StandardHighLevelStateHandlerSnippetSuppliers; public class SaveLoadManager { @@ -53,24 +48,7 @@ public class SaveLoadManager { try { - IdentifierGetter idGetter = new IdentifierGetter(); - idGetter.componentIDs = c -> - { - if (Editor.identifierPerComponent.containsKey(c)) - return Editor.identifierPerComponent.get(c); - return getStandardID(c, IndirectGUIComponentCreator.getStandardComponentIDs(), true); - }; - idGetter.symbolRendererIDs = h -> getStandardID(h, - SubmodelComponentSnippetSuppliers.symbolRendererSupplier.getStandardSnippetIDs()); - idGetter.outlineRendererIDs = h -> getStandardID(h, - SubmodelComponentSnippetSuppliers.outlineRendererSupplier.getStandardSnippetIDs()); - idGetter.highLevelStateHandlerIDs = h -> getStandardID(h, - SubmodelComponentSnippetSuppliers.highLevelStateHandlerSupplier.getStandardSnippetIDs()); - idGetter.atomicHighLevelStateHandlerIDs = h -> getStandardID(h, - StandardHighLevelStateHandlerSnippetSuppliers.atomicHandlerSupplier.getStandardSnippetIDs()); - idGetter.subcomponentHighLevelStateHandlerIDs = h -> getStandardID(h, - StandardHighLevelStateHandlerSnippetSuppliers.subcomponentHandlerSupplier.getStandardSnippetIDs()); - SubmodelComponentSerializer.serialize(editor.toBeEdited, idGetter, savePath); + SubmodelComponentSerializer.serialize(editor.toBeEdited, savePath); } catch (IOException e) { @@ -80,18 +58,6 @@ public class SaveLoadManager } } - private static String getStandardID(Object o, Map standardIDs) - { - return getStandardID(o, standardIDs, false); - } - - private static String getStandardID(Object o, Map standardIDs, boolean standardIDsHaveClassConcatenated) - { - String verboseID = (standardIDsHaveClassConcatenated ? "class:" : "") + o.getClass().getCanonicalName(); - return standardIDs.entrySet().stream().filter(e -> e.getValue().equals(verboseID)).map(Entry::getKey).findAny() - .orElseGet(() -> (standardIDsHaveClassConcatenated ? "" : "class:") + verboseID); - } - public static void openLoadDialog() throws IOException { Shell fdShell = new Shell(); @@ -102,7 +68,8 @@ public class SaveLoadManager fdShell.dispose(); if (result != null) { - new Editor((DeserializedSubmodelComponent) SubmodelComponentSerializer.deserialize(new ViewModelModifiable(), result)); + new Editor((DeserializedSubmodelComponent) IndirectGUIComponentCreator.createComponent(new ViewModelModifiable(), + "file:" + result)); } } }