Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaged Elaasar2018-04-17 07:00:36 -0400
committerPatrick Tessier2018-05-04 05:39:21 -0400
commit4459589b1b8c10ff365482233900b175d792aa78 (patch)
tree816e700006e02f11299871fb9dfc46d450347060 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org
parent7b41679a6519d9f1726426766b3e43f7ecad57e2 (diff)
downloadorg.eclipse.papyrus-4459589b1b8c10ff365482233900b175d792aa78.tar.gz
org.eclipse.papyrus-4459589b1b8c10ff365482233900b175d792aa78.tar.xz
org.eclipse.papyrus-4459589b1b8c10ff365482233900b175d792aa78.zip
Bug 528441 [AFViewpoints][Palettes] Setting diagram prototype
programmatically does not refresh palettes of open diagrams - Added a listener in the diagram editor to the diagram's representationkind changes to refresh the editor. - The DiagramUtils.setPrototype() API now checks that the new prototype applies to the type of diagram, and throws an exception otherwise Change-Id: I9b4d34a7e051aaec77170c061f4ac932a04b14ba Signed-off-by: Maged Elaasar <melaasar@gmail.com>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org')
-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