From: Tuukka Lehtonen Date: Fri, 30 Aug 2019 07:21:40 +0000 (+0300) Subject: Fixed typical synchronization to work without template diagram desc X-Git-Tag: v1.43.0~136^2~85 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F3175%2F1;p=simantics%2Fplatform.git Fixed typical synchronization to work without template diagram desc gitlab #370 Change-Id: I243d9baa3939234c9b31e1c8f34526b2c9fe641f --- diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/PageSettingsTypicalRule.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/PageSettingsTypicalRule.java index 4ee96f75d..799579377 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/PageSettingsTypicalRule.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/rules/PageSettingsTypicalRule.java @@ -23,7 +23,14 @@ public enum PageSettingsTypicalRule implements ITypicalSynchronizationRule { @Override public boolean synchronize(WriteGraph graph, Resource template, Resource instance, TypicalInfo info) throws DatabaseException { + // Diagrams should always have some sort of diagram description. + // If the template doesn't have one, the existing description + // from the instance shall not be removed. DiagramDesc mdesc = graph.syncRequest(DiagramRequests.getDiagramDesc(template)); + if (mdesc == null) { + info.messageLog.add("\t\ttemplate doesn't have any diagram page settings, doing nothing"); + return false; + } DiagramDesc idesc = graph.syncRequest(DiagramRequests.getDiagramDesc(instance)); if (mdesc.equals(idesc)) return false;