Skip to content

Commit

Permalink
Fixed order for serialize to get correct text.
Browse files Browse the repository at this point in the history
  • Loading branch information
soerendomroes committed Mar 7, 2024
1 parent 5c1d02b commit 2420587
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ 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)

// Get previous file content as String
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<String, List<TextEdit>> changes = newHashMap
// Get changed file as String
outputStream = new ByteArrayOutputStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down

0 comments on commit 2420587

Please sign in to comment.