From: Tuukka Lehtonen Date: Tue, 30 Jul 2019 07:01:10 +0000 (+0300) Subject: Don't abort typical sync on blocked template to instance connections X-Git-Tag: v1.43.0~136^2~130 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=bd27aa4cd3ca0ce7d6e7d28bc3d86c381478ef63;p=simantics%2Fplatform.git Don't abort typical sync on blocked template to instance connections Currently typical synchronization has a validation step that aborts the whole diagram synchronization if there is even a single connection missing from the instance diagram that cannot be copied from the typical template because another instance-specific connection has been made to the same functional terminal where the template connection is supposed to be connected. This changes the synchronization to simply report these cases as WARNINGS in the verbose synchronization log and continue the synchronization. gitlab #323 Change-Id: I7661f6f069666fb0e6f724e6d0006e6632f93567 --- diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/SyncTypicalTemplatesToInstances.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/SyncTypicalTemplatesToInstances.java index 8a0b1ddbc..09545ada8 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/SyncTypicalTemplatesToInstances.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/SyncTypicalTemplatesToInstances.java @@ -554,8 +554,9 @@ public class SyncTypicalTemplatesToInstances extends WriteRequest { if(stm != null) { if(graph.isInstanceOf(connectionPoint, L0.FunctionalRelation)) { if(!isSynchronizedConnector(graph, templateElement, stm.getObject())) { - messageLog.add("\t\tABORTED: tried to connect to an already connected terminal " + NameUtils.getSafeName(graph, counterPartElement) + " " + NameUtils.getSafeName(graph, connectionPoint)); - return; + messageLog.add("\t\tWARNING: skipping addition of template connection " + NameUtils.getSafeName(graph, templateElement, true) + " into instance."); + messageLog.add("\t\t\ttried to connect to an already connected terminal " + NameUtils.getSafeName(graph, counterPartElement, true) + " " + NameUtils.getSafeName(graph, connectionPoint)); + templateElementsAddedToTemplate.remove(templateElement); } } } @@ -825,7 +826,7 @@ public class SyncTypicalTemplatesToInstances extends WriteRequest { Resource instanceElement = typicalInfo.bean.templateToInstance.get(changedTemplateElement); if (instanceElement == null) { // There's an earlier problem in the sync process if this happens. - typicalInfo.messageLog.add("SKIPPING SYNC OF CHANGED TEMPLATE ELEMENT DUE TO MISSING INSTANCE: " + safeNameAndType(graph, getElementNameResource(graph, changedTemplateElement))); + typicalInfo.messageLog.add("\t\tSKIPPING SYNC OF CHANGED TEMPLATE ELEMENT DUE TO MISSING INSTANCE: " + safeNameAndType(graph, getElementNameResource(graph, changedTemplateElement))); continue; } diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalInfo.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalInfo.java index d7620d133..e491a1b11 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalInfo.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalInfo.java @@ -1,6 +1,6 @@ package org.simantics.modeling.typicals; -import java.util.Collection; +import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; @@ -8,6 +8,6 @@ public class TypicalInfo { public TypicalInfoBean bean; public IProgressMonitor monitor; - public Collection messageLog; + public List messageLog; }