From deac55c96644fab2dfde6beb8d34a2a1b5e65c3b Mon Sep 17 00:00:00 2001 From: niemisto Date: Tue, 9 Aug 2011 15:10:25 +0000 Subject: [PATCH] fixed references to moved Document-concepts git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@21709 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/ui/handlers/NewExperimentNodeHandler.java | 6 ++++-- .../org/simantics/sysdyn/ui/project/SysdynProject.java | 8 +++++--- .../org/simantics/sysdyn/mdlImport/mdlElements/Model.java | 6 ++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewExperimentNodeHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewExperimentNodeHandler.java index ac018b1c..412a4251 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewExperimentNodeHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewExperimentNodeHandler.java @@ -21,6 +21,7 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; +import org.simantics.document.DocumentResource; import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.simulation.ontology.SimulationResource; @@ -47,7 +48,8 @@ public class NewExperimentNodeHandler extends AbstractHandler { @Override public void perform(WriteGraph g) throws DatabaseException { Layer0 l0 = Layer0.getInstance(g); - Resource report = GraphUtils.create2(g, l0.Report, l0.HasDocumentation, "===Report==="); + DocumentResource DOC = DocumentResource.getInstance(g); + Resource report = GraphUtils.create2(g, DOC.Report, DOC.HasDocumentation, "===Report==="); String name = NameUtils.findFreshName(g, "Experiment", model, l0.ConsistsOf, "%s%d"); @@ -55,7 +57,7 @@ public class NewExperimentNodeHandler extends AbstractHandler { Resource experiment = GraphUtils.create2(g, SimulationResource.getInstance(g).Experiment, l0.HasName, name, l0.HasLabel, name, - l0.HasReportFactory, report, + DOC.HasReportFactory, report, l0.PartOf, model); } }); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java index aef878b6..a5e75d86 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java @@ -39,6 +39,7 @@ import org.simantics.db.request.Read; import org.simantics.db.service.GraphChangeListenerSupport; import org.simantics.db.service.LifecycleSupport; import org.simantics.db.service.VirtualGraphSupport; +import org.simantics.document.DocumentResource; import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.modeling.ModelingResources; @@ -115,7 +116,8 @@ public class SysdynProject extends AbstractProjectFeature { SysdynResource sr = SysdynResource.getInstance(g); SpreadsheetResource SHEET = SpreadsheetResource.getInstance(g); ModelingUtils mu = new ModelingUtils(g); - + DocumentResource DOC = DocumentResource.getInstance(g); + String modelName = NameUtils.findFreshName(g, "Model", SimanticsUI.getProject().get(), l0.ConsistsOf, "%s%d"); Resource model = g.newResource(); @@ -160,12 +162,12 @@ public class SysdynProject extends AbstractProjectFeature { g.claim(mapping, l0.InstanceOf, null, sr.DiagramToCompositeMapping); g.claim(diagram, l0.HasTrigger, mapping); - Resource report = GraphUtils.create2(g, l0.Report, l0.HasDocumentation, "===Report==="); + Resource report = GraphUtils.create2(g, DOC.Report, DOC.HasDocumentation, "===Report==="); GraphUtils.create2(g, mu.SIMU.Experiment, l0.HasName, "Experiment", l0.HasLabel, "Experiment", - l0.HasReportFactory, report, + DOC.HasReportFactory, report, l0.PartOf, model); ProjectResource PROJ = ProjectResource.getInstance(g); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Model.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Model.java index d684b886..1782b213 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Model.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Model.java @@ -19,6 +19,7 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.Template; +import org.simantics.document.DocumentResource; import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.modeling.ModelingResources; @@ -217,6 +218,7 @@ public class Model implements IWriteableMDLObject { SysdynResource sr = SysdynResource.getInstance(graph); Layer0 l0 = Layer0.getInstance(graph); SimulationResource simu = SimulationResource.getInstance(graph); + DocumentResource DOC = DocumentResource.getInstance(graph); // Diagram creation copied from SysdynProject. // Could the same code be reused? @@ -265,12 +267,12 @@ public class Model implements IWriteableMDLObject { graph.claim(model, simu.HasConfiguration, conf); graph.claim(model, l0.HasBaseRealization, conf); - Resource report = GraphUtils.create2(graph, l0.Report, l0.HasDocumentation, "===Report==="); + Resource report = GraphUtils.create2(graph, DOC.Report, DOC.HasDocumentation, "===Report==="); GraphUtils.create2(graph, simu.Experiment, l0.HasName, "Experiment", l0.HasLabel, "Experiment", - l0.HasReportFactory, report, + DOC.HasReportFactory, report, l0.PartOf, model); for(Subscript s : subscripts) { -- 2.47.1