]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Don't abort typical sync on blocked template to instance connections 48/3048/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 30 Jul 2019 07:01:10 +0000 (10:01 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 30 Jul 2019 07:01:10 +0000 (10:01 +0300)
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

bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/SyncTypicalTemplatesToInstances.java
bundles/org.simantics.modeling/src/org/simantics/modeling/typicals/TypicalInfo.java

index 8a0b1ddbca77e0f81fd283d8445c715e8c2e5adb..09545ada8b473a45c49a2a54a1d5fc4a13b0cb6c 100644 (file)
@@ -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;
             }
             
index d7620d1336c95cc3fe99889f427e323040233cbd..e491a1b11529c780d33a141d869ae491426613dc 100644 (file)
@@ -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<String> messageLog;
+       public List<String> messageLog;
        
 }