X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fmapping%2FComponentCopyAdvisor.java;h=3e6e9c1b9527096cfa1835a50e43f6b2dfb97c7f;hp=b7ed06795788877bbdd440ec20dc8c211543d35e;hb=8daf1d98d61e83fc6450ddac8e800476a9d52ab3;hpb=3add1aeb0df739aa27287b4e0770bed7d9fbb016 diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java index b7ed06795..3e6e9c1b9 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java @@ -12,7 +12,6 @@ package org.simantics.modeling.mapping; import java.util.Map; -import java.util.Set; import org.simantics.Simantics; import org.simantics.databoard.Bindings; @@ -29,6 +28,7 @@ import org.simantics.diagram.synchronization.graph.GraphCopyAdvisor; import org.simantics.diagram.synchronization.graph.GraphSynchronizationHints; import org.simantics.layer0.Layer0; import org.simantics.modeling.ComponentUtils; +import org.simantics.modeling.ModelingUtils; import org.simantics.modeling.services.ComponentNamingUtil; import org.simantics.modeling.services.NamingException; import org.simantics.project.IProject; @@ -59,23 +59,13 @@ public class ComponentCopyAdvisor extends GraphCopyAdvisor { public Object copy(ISynchronizationContext context, WriteGraph graph, Resource source, Resource sourceContainer, Resource targetContainer, Map map) throws DatabaseException { StructuralResource2 STR = StructuralResource2.getInstance(graph); - Resource copy = null; - Set types = graph.getTypes(source); - if (types.contains(STR.Connection)) { - // Configuration connections are not named, can't use TG copy for - // them at the moment. - copy = CopyAdvisorUtil.copy2(graph, source, null, map); - } else { -// Resource model = graph.syncRequest(new PossibleModel(targetContainer)); -// copy = CopyAdvisorUtil.copy4(graph, source, model); - copy = CopyAdvisorUtil.copy2(graph, source, null, map); - } + Resource copy = CopyAdvisorUtil.copy2(graph, source, null, map); Layer0 L0 = Layer0.getInstance(graph); if (graph.hasStatement(sourceContainer, L0.ConsistsOf, source)) graph.claim(targetContainer, L0.ConsistsOf, copy); - if (types.contains(L0.TypeWithIdentifier)) + if (ModelingUtils.needsIdentifier(graph, source)) Layer0Utils.claimNewIdentifier(graph, copy, false); if (context.get(SynchronizationHints.NO_RENAME) == null) renameComponent(context, graph, source, copy, sourceContainer, targetContainer);