Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java
index f918e830dbc..8a26c8cdb2d 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/utils/DiagramUtils.java
@@ -252,13 +252,16 @@ public class DiagramUtils {
* The new diagram's prototype
*/
public static void setPrototype(Diagram diagram, DiagramPrototype prototype) {
- PapyrusDiagramStyle pvs = getPapyrusDiagramStyle(diagram);
- if (pvs != null) {
- pvs.setDiagramKindId(prototype.getRepresentationKind().getId());
- } else {
- pvs = (PapyrusDiagramStyle) diagram.createStyle(StylePackage.Literals.PAPYRUS_DIAGRAM_STYLE);
- pvs.setDiagramKindId(prototype.getRepresentationKind().getId());
- }
+ if (diagram.getType() == null || diagram.getType().equals(prototype.getRepresentationKind().getImplementationID())) {
+ PapyrusDiagramStyle pvs = getPapyrusDiagramStyle(diagram);
+ if (pvs != null) {
+ pvs.setDiagramKindId(prototype.getRepresentationKind().getId());
+ } else {
+ pvs = (PapyrusDiagramStyle) diagram.createStyle(StylePackage.Literals.PAPYRUS_DIAGRAM_STYLE);
+ pvs.setDiagramKindId(prototype.getRepresentationKind().getId());
+ }
+ } else
+ throw new IllegalArgumentException("The diagram's type differs from the prototype's implementation id");
}

Back to the top