Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-07-15 22:29:34 +0000
committerChristian W. Damus2016-07-16 12:37:06 +0000
commit86cfd7f722ea4f8f45a683024f50af247b8373af (patch)
tree633d0998f807cfcbb6c6ec0a262252bae108957c /extraplugins
parent2fb82a8d63e5d5954e77c74f765731bc61ce0eb8 (diff)
downloadorg.eclipse.papyrus-86cfd7f722ea4f8f45a683024f50af247b8373af.tar.gz
org.eclipse.papyrus-86cfd7f722ea4f8f45a683024f50af247b8373af.tar.xz
org.eclipse.papyrus-86cfd7f722ea4f8f45a683024f50af247b8373af.zip
Bug 461980: [Model Import] Structure diagram has wrong size
https://bugs.eclipse.org/bugs/show_bug.cgi?id=461980 Add a hook in the diagram transformation to set the default size of the frame, if any, if it has any defaults. Implement this hook for composite structure diagrams. (cherry-picked from streams/2.0-maintenance) Change-Id: I4ba9d3932468f6b19361ba77907452d230481d23
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF2
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAStructureDiagram.qvto17
-rw-r--r--extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAToPapyrus.qvto35
3 files changed, 42 insertions, 12 deletions
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF
index d9a9a5cad5f..ab0e1b412b3 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/META-INF/MANIFEST.MF
@@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.ecore.xmi;bundle-version="2.10.1",
org.eclipse.uml2.types;visibility:=reexport,
org.eclipse.uml2.uml.resources;bundle-version="5.0.0",
- org.eclipse.papyrus.m2m.qvto;bundle-version="[1.2.1,2.0.0)",
+ org.eclipse.papyrus.m2m.qvto;bundle-version="[1.3.0,2.0.0)",
org.eclipse.gmf.runtime.notation;bundle-version="1.7.0",
org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.2.0",
org.eclipse.papyrus.dsml.validation;bundle-version="1.2.0",
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAStructureDiagram.qvto b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAStructureDiagram.qvto
index 8e1fed4abb7..ac4d0b1e768 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAStructureDiagram.qvto
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAStructureDiagram.qvto
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013, 2014 CEA LIST.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 461980
*****************************************************************************/
import RSAToPapyrus;
@@ -83,6 +84,20 @@ mapping UMLShapeCompartment::toStructureCompartment() : DecorationNode inherits
}
+query Diagram::getDiagramFrame() : Node {
+ // 2073 is the old style Class_Shape used as the structure frame
+ return self.children->any(type = '2073').oclAsType(notation::Node);
+}
+
+mapping inout Node::defaultFrameSize() {
+ var size : Size = self.layoutConstraint.oclAsType(notation::Size);
+ if (size.width = -1) then {
+ size.width := 600;
+ } endif;
+ if (size.height = -1) then {
+ size.height := 400;
+ } endif;
+}
/***** Nodes **********/
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAToPapyrus.qvto b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAToPapyrus.qvto
index ce565ddbe42..1d96292acc1 100644
--- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAToPapyrus.qvto
+++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/transform/RSAToPapyrus.qvto
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013, 2014 CEA LIST.
+ * Copyright (c) 2013, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 461980
*****************************************************************************/
import org.eclipse.papyrus.m2m.qvto.UI;
import org.eclipse.papyrus.m2m.qvto.NotationTypes;
@@ -145,6 +146,11 @@ abstract mapping Diagram::toPapyrusDiagram() : notation::Diagram inherits notati
// log(result.element.toString());
var targetEdges := self.edges.map toEdge();
result.edges += targetEdges;
+
+ // And tweak some details
+ if (result.hasDiagramFrame()) then {
+ result.getDiagramFrame().map defaultFrameSize();
+ } endif;
}
end {
@@ -393,18 +399,27 @@ abstract query View::getEdgeType(element : Element) : String;
abstract query View::getDecorationType(element : Element) : String;
-/** Main diagram mapping */
-abstract mapping notation::Diagram::generateDiagram() : notation::Diagram;
-
-
-
-
-
-
-
+/** Queries whether the imported diagram has a frame (as in behaviour or structure diagrams). */
+query Diagram::hasDiagramFrame() : Boolean {
+ return not self.getDiagramFrame().oclIsUndefined();
+}
+/** Overridden by specializing transformations to get the diagram frame, if any. */
+query Diagram::getDiagramFrame() : Node {
+ return null;
+}
+/** Tweaks for specific diagrams */
+/** Overridden by specializing transformations to set the default dimensions of the diagram frame. */
+mapping inout Node::defaultFrameSize()
+ when { self.layoutConstraint.oclIsKindOf(notation::Size) and let size = self.layoutConstraint.oclAsType(notation::Size) in
+ size.width = -1 or size.height = -1 }
+{
+ // Pass
+}
+/** Main diagram mapping */
+abstract mapping notation::Diagram::generateDiagram() : notation::Diagram;

Back to the top