From 90ca627d2cfabb2b9a1ceac5e1a6205180405855 Mon Sep 17 00:00:00 2001 From: Phillipus Date: Thu, 10 Oct 2024 10:12:23 +0100 Subject: [PATCH] [Possible] DiagramModelReferenceProxy#getType() should return the type of the DiagramModelReference object - It should return "diagram-model-reference" not the type of the referenced diagram model - This aligns it with "diagram-model-note", "diagram-model-group" and "diagram-model-connection" - But see https://github.com/archimatetool/archi-scripting-plugin/issues/95 --- .../dom/model/DiagramModelReferenceProxyTests.java | 13 +++++++++++++ .../dom/model/DiagramModelReferenceProxy.java | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/com.archimatetool.script.tests/src/com/archimatetool/script/dom/model/DiagramModelReferenceProxyTests.java b/com.archimatetool.script.tests/src/com/archimatetool/script/dom/model/DiagramModelReferenceProxyTests.java index c2709aa9..428e304f 100644 --- a/com.archimatetool.script.tests/src/com/archimatetool/script/dom/model/DiagramModelReferenceProxyTests.java +++ b/com.archimatetool.script.tests/src/com/archimatetool/script/dom/model/DiagramModelReferenceProxyTests.java @@ -37,6 +37,19 @@ public void runOnceBeforeEachTest() { actualTestProxy = (DiagramModelReferenceProxy)testProxy; } + @Override + @Test + public void getType() { + // The type should be the IDiagramModelReference, not the referenced diagram model + assertEquals(ModelUtil.getKebabCase(testProxy.getEObject().eClass().getName()), testProxy.getType()); + } + + @Override + public void attr_Type() { + // The type should be the IDiagramModelReference, not the referenced diagram model + assertEquals(ModelUtil.getKebabCase(testProxy.getEObject().eClass().getName()), testProxy.getType()); + } + @Override @Test public void get_ReturnsCorrectProxy() { diff --git a/com.archimatetool.script/src/com/archimatetool/script/dom/model/DiagramModelReferenceProxy.java b/com.archimatetool.script/src/com/archimatetool/script/dom/model/DiagramModelReferenceProxy.java index e599037d..4f88766c 100644 --- a/com.archimatetool.script/src/com/archimatetool/script/dom/model/DiagramModelReferenceProxy.java +++ b/com.archimatetool.script/src/com/archimatetool/script/dom/model/DiagramModelReferenceProxy.java @@ -34,4 +34,9 @@ protected EObject getReferencedEObject() { return getEObject().getReferencedModel(); } + @Override + public String getType() { + // The type should be the IDiagramModelReference, not the referenced diagram model + return ModelUtil.getKebabCase(getEObject().eClass().getName()); + } }