From 24205870dd0318136945487029c07788475d78e0 Mon Sep 17 00:00:00 2001 From: Soeren Domroes Date: Thu, 7 Mar 2024 18:24:11 +0100 Subject: [PATCH] Fixed order for serialize to get correct text. --- .../kieler/klighd/lsp/ElkGraphConstraintSerializer.xtend | 8 ++++---- .../kieler/klighd/lsp/interactive/InteractiveUtil.xtend | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/ElkGraphConstraintSerializer.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/ElkGraphConstraintSerializer.xtend index bc5a02906..1f5252df6 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/ElkGraphConstraintSerializer.xtend +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/ElkGraphConstraintSerializer.xtend @@ -45,10 +45,6 @@ class ElkGraphConstraintSerializer implements IConstraintSerializer { KGraphLanguageServerExtension ls, KGraphLanguageClient client ) { - changedNodes.forEach[c| - val ElkNode elkNode = c.KNode.getProperty(KlighdInternalProperties.MODEL_ELEMEMT) as ElkNode - elkNode.setProperty(c.property, c.value) - ] // Serialize model into given uri. val resource = ls.getResource(uri) @@ -56,6 +52,10 @@ class ElkGraphConstraintSerializer implements IConstraintSerializer { var outputStream = new ByteArrayOutputStream resource.save(outputStream, emptyMap) val codeBefore = outputStream.toString + changedNodes.forEach[c| + val ElkNode elkNode = c.KNode.getProperty(KlighdInternalProperties.MODEL_ELEMENT) as ElkNode + elkNode.setProperty(c.property, c.value) + ] val Map> changes = newHashMap // Get changed file as String outputStream = new ByteArrayOutputStream diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/interactive/InteractiveUtil.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/interactive/InteractiveUtil.xtend index 16b30a04f..24f111737 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/interactive/InteractiveUtil.xtend +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/interactive/InteractiveUtil.xtend @@ -179,9 +179,9 @@ class InteractiveUtil { ) { var serializer = false - var sourceModel = model.getProperty(KlighdInternalProperties.MODEL_ELEMEMT) - if (!model.hasProperty(KlighdInternalProperties.MODEL_ELEMEMT)) { - sourceModel = model.children.get(0).getProperty(KlighdInternalProperties.MODEL_ELEMEMT) + var sourceModel = model.getProperty(KlighdInternalProperties.MODEL_ELEMENT) + if (!model.hasProperty(KlighdInternalProperties.MODEL_ELEMENT)) { + sourceModel = model.children.get(0).getProperty(KlighdInternalProperties.MODEL_ELEMENT) } for (IConstraintSerializer cs : ServiceLoader.load(IConstraintSerializer, KlighdDataManager.getClassLoader())) {