import org.simantics.db.Resource;\r
import org.simantics.db.Statement;\r
import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.PossibleTypedParent;\r
import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.exception.ServiceException;\r
import org.simantics.diagram.synchronization.ISynchronizationContext;\r
import org.simantics.diagram.synchronization.graph.CopyAdvisorUtil;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modeling.ComponentUtils;\r
import org.simantics.modeling.mapping.ComponentCopyAdvisor;\r
-import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.utils.datastructures.BinaryFunction;\r
\r
public class SysdynComponentCopyAdvisor extends ComponentCopyAdvisor{\r
\r
@Override\r
public Boolean call(ReadGraph graph, Statement statement) {\r
+ /*\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
try {\r
if(graph.isInstanceOf(statement.getSubject(), sr.IndependentVariable)) {\r
- if(statement.getPredicate().equals(sr.HasExpressions))\r
- return true;\r
+ if(statement.getPredicate().equals(sr.HasExpressions) ||\r
+ statement.getPredicate().equals(sr.HasArrayIndexes) )\r
+ return false;\r
}\r
} catch (ServiceException e) {\r
e.printStackTrace();\r
}\r
+ */\r
return false;\r
}\r
\r
};\r
\r
- Resource copy = CopyAdvisorUtil.copy(graph, source, tester);\r
+ Resource copy;\r
+ \r
+ StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
+ SimulationResource SIMU = SimulationResource.getInstance(graph);\r
+ Resource model = graph.syncRequest(new PossibleTypedParent(targetContainer, SIMU.Model));\r
+ if(graph.isInstanceOf(source, sr2.Connection)) {\r
+ copy = CopyAdvisorUtil.copy(graph, source, tester);\r
+ } else {\r
+ copy = CopyAdvisorUtil.copy4(graph, source, model);\r
+ }\r
+\r
\r
renameComponent(context, graph, source, copy, sourceContainer, targetContainer);\r
return copy;\r