From 7c077ce146056b735080f97a5dd1a0a7d70f4543 Mon Sep 17 00:00:00 2001 From: Sascha Lisson Date: Thu, 25 Apr 2024 16:00:57 +0200 Subject: [PATCH] fix: sort modules/models/nodes alphabetically --- .../editor/ssr/mps/ModelixSSRServerForMPS.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/projectional-editor-ssr-mps/src/main/kotlin/org/modelix/editor/ssr/mps/ModelixSSRServerForMPS.kt b/projectional-editor-ssr-mps/src/main/kotlin/org/modelix/editor/ssr/mps/ModelixSSRServerForMPS.kt index d0f9313d..1ac04d0b 100644 --- a/projectional-editor-ssr-mps/src/main/kotlin/org/modelix/editor/ssr/mps/ModelixSSRServerForMPS.kt +++ b/projectional-editor-ssr-mps/src/main/kotlin/org/modelix/editor/ssr/mps/ModelixSSRServerForMPS.kt @@ -167,11 +167,11 @@ class ModelixSSRServerForMPS : Disposable { repository.getArea().executeRead { body { ul { - repository.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Repository.modules).forEach { + repository.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Repository.modules).sortedBy { it.name }.forEach { li { a { href = "module/${URLEncoder.encode(it.reference.serialize(), StandardCharsets.UTF_8)}/" - +(it.getPropertyValue(BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name) ?: "") + +(it.name ?: "") } } } @@ -188,11 +188,11 @@ class ModelixSSRServerForMPS : Disposable { val module = repository.getArea().resolveNode(NodeReference(moduleRef))!! body { ul { - module.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Module.models).forEach { + module.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Module.models).sortedBy { it.name }.forEach { li { a { href = "../../model/${URLEncoder.encode(it.reference.serialize(), StandardCharsets.UTF_8)}/" - +(it.getPropertyValue(BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name) ?: "") + +(it.name ?: "") } } } @@ -209,11 +209,11 @@ class ModelixSSRServerForMPS : Disposable { val model = repository.getArea().resolveNode(NodeReference(modelRef))!! body { ul { - model.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Model.rootNodes).forEach { + model.getChildren(BuiltinLanguages.MPSRepositoryConcepts.Model.rootNodes).sortedBy { it.name }.forEach { li { a { href = "../../editor/${URLEncoder.encode(it.reference.serialize(), StandardCharsets.UTF_8)}/" - +(it.getPropertyValue(BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name) ?: "") + +(it.name ?: "") } } } @@ -343,4 +343,6 @@ fun IReferenceLink?.toMPS(): SReferenceLink? = if (this is MPSReferenceLink) thi fun IProperty?.toMPS(): SProperty? = if (this is MPSProperty) this.property else null fun IConcept?.toMPS(): SAbstractConcept? = if (this is MPSConcept) this.concept else null +val INode.name get() = getPropertyValue(BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name) + class MPSConstraintViolation(val rule: Rule<*>) : IConstraintViolation