From 905b0a0bc7c85f8768833f982d2ffeb6a0cf8b90 Mon Sep 17 00:00:00 2001 From: lehtonen Date: Wed, 18 Aug 2010 20:00:30 +0000 Subject: [PATCH] Replaced os.db.Builtins contents with the contents of os.layer0.Layer0 resource file and fixed the resulting havoc (at least most of it). Much of the stuff in the previous Builtins version was already deprecated and did not exist in the database, which is why the database initialization produced the "built not found" errors it did. Also changed IProjectLifecycle.onActivated/onDeactivated to take in Session and be ran outside of a database transaction to allow the lifecycle handlers to perform arbitrary read/write requests. This should fix Arto's issues with Eco. git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17349 ac1ea38d-2e2b-0410-8846-a27921b304fc --- org.simantics.sysdyn.ontology/graph.tg | Bin 46439 -> 46418 bytes .../graph/Sysdyn.pgraph | 2 +- org.simantics.sysdyn.ui/META-INF/MANIFEST.MF | 1 + .../ui/browser/contributions/Experiment.java | 4 +- .../ExperimentLabelDecorator.java | 3 +- .../ui/browser/contributions/Model.java | 6 +- .../SimulationResultDecorator.java | 5 +- .../contributions/SimulationResultImager.java | 3 +- .../ui/browser/nodes/ModuleTypeNode.java | 5 +- .../sysdyn/ui/editor/SysdynDiagramEditor.java | 47 ++--- .../ui/handlers/NewExperimentNodeHandler.java | 15 +- .../sysdyn/ui/handlers/NewModelHandler.java | 26 +-- .../ui/handlers/ToggleResultActivation.java | 18 +- .../sysdyn/ui/handlers/UnlinkNodeHandler.java | 8 +- .../DefaultRealizationVirtualGraph.java | 3 +- .../HistoryRealizationVirtualGraph.java | 8 +- .../sysdyn/ui/project/HistoryVariable.java | 5 +- .../sysdyn/ui/project/SysdynProject.java | 6 +- .../ui/project/SysdynProjectLifeCycle.java | 171 ++++++++---------- .../ResourceSelectionProcessor.java | 3 +- .../simantics/sysdyn/ui/trend/TrendView.java | 19 +- org.simantics.sysdyn/META-INF/MANIFEST.MF | 5 +- .../sysdyn/manager/SysdynExperiment.java | 11 +- .../simantics/sysdyn/manager/SysdynModel.java | 22 ++- 24 files changed, 202 insertions(+), 194 deletions(-) diff --git a/org.simantics.sysdyn.ontology/graph.tg b/org.simantics.sysdyn.ontology/graph.tg index 36b1abecc0fa9dc75f36df7522b3f8382a0addf8..c2d53bda71f82c7fc563ad8383b45637eb87dd2b 100644 GIT binary patch delta 13002 zcmZ8n33OCdnod<(Vbtc3YL#6`u|$bd5EqceEFh4u1i~V#Ar%S<1OgR6K_%q_1s4Q! zS%h}M;EoENxS?&^R;$xGPTL)OJY$b`YmMzTcDEh1wVgRS-*^A_zjqIu^VfUd{qMj3 z_rCic`S`PF=V#I5`H@o^^Yij{b##w(i}b3>%gc*&!_OI0>zXU-no~6!8&l2GJ4&N# zBas;$Pvq}ABQmUGQqPx8i8OSadiLZ$ON#N3Y(;Bav0+*M0UzCYz;wi+U7N zRTMw@^J*%mb+q<9H$PI@@%(@(k;rP3Kk&WCRP({Wp`-e6T6g@MUfDc3RkvYdI#szg z36JbxK}~A?#)foidBtX*+0T42sCT5V8C+PnXo$*o_nFN@Il|$B%dc6NN;j-Yt=%xO zY3+t|Q{zCLtU8-#)~!i3udAz1T~2f4cdJ~xDV1(c4KUe37gV26iEgvfO{-G%8)7=p zb9%#yRQ=}q#*}aPIpv&&y!m4VI@V1F%+f(4%=*G!z2jv33w{E(2XiED4i}b3rkPw} zX~8sjG$fLjcNge%FsGT4cy&2Pp9IQBS}y}<0q~=^5_+0 z*?0mLy5hA~*BF|G{GV|B0snYUQrQ(4UkSV&*9)Pm0r$k>QR`swb2vsWQHv%wxD*!R zLv|NbLSil?sihcHX|hAC^&z!3zM~lXX`n4Rw7Ny(i$a^m_XuVXyYV#uF9EHFg|ncA zSbbiEd*X$l+2GgX`dg6lpYicQ$o&R%3G|cybTrS599CyN`wrt*1)jAHOB8B7F2+pt ztS|0~t!JjopEUt;9QB}M6znrIcY&;ZQ&GeWr0s88QCR0gfwiupu+CgQYVBdnAhy<^ zmvvqVta+&QvDop>rJeS36Qk()Snz%TX`Ojb(wwkDD*_K<=at%cS=Woyb7)~d{#3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Zz`5*1+NJeMaL7>(r=xx$MI1K7&&{MV!cK_DK9RxjMK8V|iVW(m$=<*ZD3M zho^iO13v5fC4(P7BfZb4cL)9?Fl=(jogtPYBCh<%3a4xBR z0z1nz`n5-uW4O`uaSv$EeV;srr0z0 zR}D_-T01R7@Q(zif{zP3>WYsmqQntoRTM;yTvt`*dH8|Bw63!j&UM;lagEbQUi;UB zecISZ0f2ziZ>V|d{g~I%)RD!@;VItPEo0|hm9_r zoARCFrs@cOW9c&-N;i}8)Mj;;RzzoYU)8$E++y_HEoSK98vmTQ71TIu(5%}squW77 z{Tid35%qFLw~1D|orZMos6FP+_i8kFFwg(cy72DE&bvb{k-PMcQ|9fv4^}nKhAErs z3!4s&>^?MDE&o+rZFLWJ?@bN=1sD^sc=rzfzV*FbxE_b`sg6|lz-)2#s|)kL&;Ddw z{)cbWRfY1@#Vgqd^8fwjhoOi5c%N_nS6}%?Nc`-rb@}FdAA~|tG4)>E*!g3{qHMir z%Y7t<-u`bn^1MMX+{3!ycH71@>4|U{f++*Yj^zt diff --git a/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph b/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph index ff8714b3..08298cd7 100644 --- a/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph +++ b/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph @@ -32,7 +32,7 @@ SYSDYN.SysdynProject : PROJ.Feature SYSDYN.SysdynModelManager : PROJ.Feature L0.HasLabel "Sysdyn Model Manager" L0.HasDescription "Sysdyn Model Manager." - PROJ.RequiresFeature MOD.ModelingProject + PROJ.RequiresFeature WORKBENCH.Features.SymbolManager PROJ.RequiresFeature PROJ.Features.ExperimentControl diff --git a/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF b/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF index 86b9d38b..061e9e9b 100644 --- a/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF +++ b/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF @@ -36,6 +36,7 @@ Require-Bundle: org.simantics.h2d;bundle-version="1.0.0", org.simantics.data;bundle-version="0.6.3", org.simantics.message;bundle-version="0.9.0", org.simantics.structural2;bundle-version="1.0.0", + org.simantics.layer0;bundle-version="1.0.0", org.simantics.diagram.ontology;bundle-version="1.0.0" Bundle-Activator: org.simantics.sysdyn.ui.Activator Bundle-ActivationPolicy: lazy diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java index 34bc6adc..6466de72 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java @@ -13,12 +13,14 @@ package org.simantics.sysdyn.ui.browser.contributions; import java.util.ArrayList; import java.util.Collection; + import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.ui.browser.nodes.AbstractNode; import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder; @@ -28,7 +30,7 @@ public class Experiment extends ViewpointContributor { public Collection getContribution(ReadGraph graph, ExperimentsFolder experimentsFolder) throws DatabaseException { ArrayList result = new ArrayList(); Builtins b = graph.getBuiltins(); - for(Resource r : graph.syncRequest(new ObjectsWithType(experimentsFolder.resource, b.ConsistsOf, b.Experiment))) { + for(Resource r : graph.syncRequest(new ObjectsWithType(experimentsFolder.resource, b.ConsistsOf, SimulationResource.getInstance(graph).Experiment))) { try { result.add(graph.adapt(r, AbstractNode.class)); } catch(DatabaseException e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabelDecorator.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabelDecorator.java index b38c9f68..048c5c50 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabelDecorator.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabelDecorator.java @@ -6,13 +6,14 @@ import org.simantics.browsing.ui.content.LabelDecorator; import org.simantics.browsing.ui.graph.contributor.labeler.LabelDecoratorContributor; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode; public class ExperimentLabelDecorator extends LabelDecoratorContributor { @Override public LabelDecorator getDecorator(ReadGraph graph, ExperimentNode experimentNode) throws DatabaseException { - if (graph.hasStatement(experimentNode.resource, graph.getBuiltins().IsActive)) { + if (graph.hasStatement(experimentNode.resource, SimulationResource.getInstance(graph).IsActive)) { return new LabelDecorator.Stub() { @Override public String decorateLabel(String label, String column, int itemIndex) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Model.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Model.java index eb2d5a0f..9a06d681 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Model.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Model.java @@ -2,9 +2,11 @@ package org.simantics.sysdyn.ui.browser.contributions; import java.util.ArrayList; import java.util.Collection; + import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.ui.browser.nodes.AbstractNode; import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode; import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder; @@ -20,8 +22,8 @@ public class Model extends ViewpointContributor { ArrayList result = new ArrayList(); result.add(new ConfigurationNode( graph.getSingleObject( - model.resource, - graph.getBuiltins().HasConfiguration)) + model.resource, + SimulationResource.getInstance(graph).HasConfiguration)) ); result.add(new ExperimentsFolder(model.resource)); result.add(new OperatingInterfacesFolder(model.resource)); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java index 69469628..60ea3bce 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java @@ -4,17 +4,16 @@ import org.eclipse.jface.resource.FontDescriptor; import org.eclipse.swt.SWT; import org.simantics.browsing.ui.content.LabelDecorator; import org.simantics.browsing.ui.graph.contributor.labeler.LabelDecoratorContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode; public class SimulationResultDecorator extends LabelDecoratorContributor{ @Override public LabelDecorator getDecorator(ReadGraph graph, SimulationResultNode result) throws DatabaseException { - Builtins b = graph.getBuiltins(); - if (graph.hasStatement(result.resource, b.IsActive)) { + if (graph.hasStatement(result.resource, SimulationResource.getInstance(graph).IsActive)) { return new LabelDecorator.Stub() { @SuppressWarnings("unchecked") diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultImager.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultImager.java index 1bc94307..de9b2554 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultImager.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultImager.java @@ -4,6 +4,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.simantics.browsing.ui.swt.ImagerContributor; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.ui.Activator; import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode; @@ -11,7 +12,7 @@ public class SimulationResultImager extends ImagerContributor results = graph.getObjects(experiment, SysdynResource.getInstance(graph).HasResult); if(results != null) - for(Resource result : results) + for(Resource result : results) unlinkResult(graph, result); graph.deny(experiment, b.PartOf); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultRealizationVirtualGraph.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultRealizationVirtualGraph.java index 7a07c88c..4653cd15 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultRealizationVirtualGraph.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultRealizationVirtualGraph.java @@ -7,6 +7,7 @@ import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.RealizationVirtualGraph; import org.simantics.db.layer0.adapter.ResourceData; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.SysdynResource; public class DefaultRealizationVirtualGraph extends RealizationVirtualGraph { @@ -18,7 +19,7 @@ public class DefaultRealizationVirtualGraph extends RealizationVirtualGraph { @Override public void initialize(final VirtualGraphContext context, WriteGraph graph) throws DatabaseException { - Resource configuration = graph.getPossibleObject(model, b.HasConfiguration); + Resource configuration = graph.getPossibleObject(model, SimulationResource.getInstance(graph).HasConfiguration); Resource defaultsResource = graph.newResource(); int modelNode = context.getIndex(model); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java index fa1c94ac..92ae6e25 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java @@ -19,6 +19,7 @@ import org.simantics.db.layer0.adapter.RemoverUtil; import org.simantics.db.layer0.adapter.ResourceData; import org.simantics.db.layer0.adapter.RuntimeValuations; import org.simantics.db.request.Read; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.SysdynResource; public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph { @@ -37,10 +38,11 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph { // System.out.println("Compute runs starts"); HashSet result = new HashSet(); Builtins b = graph.getBuiltins(); + SimulationResource SIMU = SimulationResource.getInstance(graph); for(Resource config : graph.getObjects(model, b.ConsistsOf)) { - if(graph.isInstanceOf(config, b.Experiment)) { + if(graph.isInstanceOf(config, SIMU.Experiment)) { for(Resource run : graph.getObjects(config, b.ConsistsOf)) { - if(graph.isInstanceOf(run, b.Run)) { + if(graph.isInstanceOf(run, SIMU.Run)) { // System.out.println("found run " + run); result.add(run); } @@ -71,7 +73,7 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph { @Override public Collection perform(ReadGraph graph) throws DatabaseException { HashSet result = new HashSet(); - Resource configuration = graph.getPossibleObject(model, b.HasConfiguration); + Resource configuration = graph.getPossibleObject(model, SimulationResource.getInstance(graph).HasConfiguration); for(Resource part : graph.getObjects(configuration, b.ConsistsOf)) { result.add(part); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java index b686274d..cd4162ad 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java @@ -11,6 +11,7 @@ import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.ResourceVariable; import org.simantics.db.layer0.variable.Variables; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.manager.SysdynDataSet; import org.simantics.sysdyn.manager.SysdynModel; import org.simantics.sysdyn.manager.SysdynModelManager; @@ -26,9 +27,9 @@ public class HistoryVariable extends ResourceVariable { public T getInterface(ReadGraph graph, Class clazz) throws DatabaseException { if(Accessor.class.equals(clazz)) { - Builtins b = graph.getBuiltins(); + SimulationResource SIMU = SimulationResource.getInstance(graph); Resource model = Variables.getModel(graph, this); - Resource configuration = graph.getPossibleObject(model, b.HasConfiguration); + Resource configuration = graph.getPossibleObject(model, SIMU.HasConfiguration); SysdynModel sm = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration); SysdynResult sr = sm.getSysdynResult(); String rvi = Variables.getRVI(graph, this); 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 f53e58c6..64057687 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 @@ -108,7 +108,7 @@ public class SysdynProject extends AbstractProjectFeature { g.claim(conf, b.InstanceOf, sr.Configuration); g.claim(conf, mr.CompositeToDiagram, diagram); - g.claim(model, b.HasConfiguration, conf); + g.claim(model, mu.SIMU.HasConfiguration, conf); Resource mapping = g.newResource(); g.claim(mapping, b.InstanceOf, null, mr.DiagramToCompositeMapping); @@ -116,7 +116,7 @@ public class SysdynProject extends AbstractProjectFeature { Resource report = GraphUtils.create2(g, mu.b.Report, mu.b.HasDocumentation, "===Report==="); - GraphUtils.create2(g, mu.b.Experiment, + GraphUtils.create2(g, mu.SIMU.Experiment, mu.b.HasName, "Experiment", mu.b.HasLabel, "Experiment", mu.b.HasReportFactory, report, @@ -136,7 +136,7 @@ public class SysdynProject extends AbstractProjectFeature { addToCollectionHint(ProjectKeys.PERSPECTIVES, DEFAULT_PERSPECTIVE); addToCollectionHint(ProjectKeys.OPEN_PERSPECTIVES, DEFAULT_PERSPECTIVE); getProjectElement().setHint(ProjectKeys.DEFAULT_PERSPECTIVE, DEFAULT_PERSPECTIVE); - + getProjectElement().setHint(IEditorNamingService.KEY_EDITOR_NAMING_SERVICE, new EditorNamingService2()); mm = new ModelManager(); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java index 8a0f7fab..58a72822 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java @@ -10,7 +10,6 @@ import org.osgi.service.prefs.BackingStoreException; import org.simantics.databoard.accessor.Accessor; import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; -import org.simantics.db.RequestProcessor; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.VirtualGraph; @@ -23,168 +22,156 @@ import org.simantics.db.layer0.adapter.ActivationManager; import org.simantics.db.layer0.adapter.RuntimeValuations; import org.simantics.db.layer0.adapter.TrendVariable; import org.simantics.db.layer0.util.Simantics; -import org.simantics.db.management.ISessionContext; import org.simantics.db.request.Read; import org.simantics.db.service.VirtualGraphSupport; import org.simantics.project.IProject; import org.simantics.project.IProjectLifeCycle; +import org.simantics.project.exception.ProjectException; import org.simantics.simulation.experiment.IExperiment; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.simulation.project.IExperimentManager; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.Activator; -import org.simantics.ui.SimanticsUI; -import org.simantics.utils.datastructures.hints.IHintContext.Key; -import org.simantics.utils.datastructures.hints.IHintContext.KeyOf; import org.simantics.utils.ui.ErrorLogger; public class SysdynProjectLifeCycle implements IProjectLifeCycle{ - public static final Key INITIALIZED = new KeyOf(Boolean.class, "SYSDYN_LIFECYCLE_INITIALIZED"); private static final String CHEATSHEET_ID = "org.simantics.sysdyn.ui.cheatsheet1"; private static final String FIRST_SYSDYN_PROJECT = "firstSysdynProject"; @Override - public void onActivated(RequestProcessor processor, final IProject project) { + public void onActivated(final Session session, final IProject project) throws ProjectException { - ISessionContext context = SimanticsUI.getSessionContext(); - if (context.getHint(INITIALIZED) == null) { - - try { - - Resource projectResource = project.get(); + try { - final Session session = context.getSession(); + Resource projectResource = project.get(); - session.registerService(RuntimeValuations.class, new RuntimeValuations() { + session.registerService(RuntimeValuations.class, new RuntimeValuations() { - @Override - public boolean supports(String valuation) { + @Override + public boolean supports(String valuation) { - IExperimentManager expMan = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); - IExperiment experiment = expMan.getExperiment(valuation); + IExperimentManager expMan = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER); + IExperiment experiment = expMan.getExperiment(valuation); - return experiment != null; + return experiment != null; - } + } - @Override - public Accessor getAccessor(String variableIdentityPrefix, String valuation, String suffix) { - return null; - } + @Override + public Accessor getAccessor(String variableIdentityPrefix, String valuation, String suffix) { + return null; + } - @Override - public TrendVariable getVariable(String variableIdentityPrefix, String valuation, String suffix) { + @Override + public TrendVariable getVariable(String variableIdentityPrefix, String valuation, String suffix) { - return null; + return null; - } + } - }); + }); - final Builtins b = session.getBuiltins(); - ActivationManager activationManager = session.getService(ActivationManager.class); - if (activationManager != null) { - activationManager.activate(processor, projectResource); - } + final Builtins b = session.getBuiltins(); + ActivationManager activationManager = session.getService(ActivationManager.class); + if (activationManager != null) { + activationManager.activate(session, projectResource); + } - VirtualGraphSupport support = session.getService(VirtualGraphSupport.class); - final VirtualGraph graph = session.getService(VirtualGraph.class); + VirtualGraphSupport support = session.getService(VirtualGraphSupport.class); + final VirtualGraph graph = session.getService(VirtualGraph.class); - processor.asyncRequest(new ObjectsWithType(projectResource, b.ConsistsOf, b.Model), new SingleSetListener() { + SimulationResource SIMU = SimulationResource.getInstance(session); + session.asyncRequest(new ObjectsWithType(projectResource, b.ConsistsOf, SIMU.Model), new SingleSetListener() { - @Override - public void add(final Resource model) { - // FIXME: - Simantics.async(new Runnable() { - - @Override - public void run() { - try { - // This creates experiment realizations - graph.register(new HistoryRealizationVirtualGraph(session, model)); - // This creates the BaseRealization - graph.register(new DefaultRealizationVirtualGraph(session, model)); - } catch (DatabaseException e) { - e.printStackTrace(); - } + @Override + public void add(final Resource model) { + // FIXME: + Simantics.async(new Runnable() { + + @Override + public void run() { + try { + // This creates experiment realizations + graph.register(new HistoryRealizationVirtualGraph(session, model)); + // This creates the BaseRealization + graph.register(new DefaultRealizationVirtualGraph(session, model)); + } catch (DatabaseException e) { + e.printStackTrace(); } + } - }); - } + }); + } - @Override - public void exception(Throwable t) { - t.printStackTrace(); - } + @Override + public void exception(Throwable t) { + t.printStackTrace(); + } - @Override - public boolean isDisposed() { - return false; - } + @Override + public boolean isDisposed() { + return false; + } - }); + }); - support.getWorkspacePersistent("experiments"); + support.getWorkspacePersistent("experiments"); - } catch (DatabaseException e) { + } catch (DatabaseException e) { - e.printStackTrace(); + throw new ProjectException(e); - } + } - cleanProjectFolder(processor, project.get()); - context.setHint(INITIALIZED, Boolean.TRUE); + cleanProjectFolder(session, project.get()); - // Open cheatsheets view on the first time the user creates a sysdyn project - // for a particular workspace. - IEclipsePreferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID); - boolean firstSysdynProject = prefs.getBoolean(FIRST_SYSDYN_PROJECT, true); - if (firstSysdynProject) { - // This should not be here + // Open cheatsheets view on the first time the user creates a sysdyn project + // for a particular workspace. + IEclipsePreferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID); + boolean firstSysdynProject = prefs.getBoolean(FIRST_SYSDYN_PROJECT, true); + if (firstSysdynProject) { + // This should not be here // Display.getDefault().asyncExec(new Runnable() { // @Override // public void run() { // new OpenCheatSheetAction(CHEATSHEET_ID).run(); // }}); - // Make a note that the user has created a sysdyn project. - try { - prefs.putBoolean(FIRST_SYSDYN_PROJECT, false); - prefs.flush(); - } catch (BackingStoreException e) { - ErrorLogger.defaultLogError(e); - } + // Make a note that the user has created a sysdyn project. + try { + prefs.putBoolean(FIRST_SYSDYN_PROJECT, false); + prefs.flush(); + } catch (BackingStoreException e) { + ErrorLogger.defaultLogError(e); } - } - } @Override - public void onDeactivated(IProject project) { + public void onDeactivated(Session session, IProject project) { } - public void cleanProjectFolder(RequestProcessor processor, final Resource projectResource) { - ISessionContext context = SimanticsUI.getSessionContext(); - final Session session = context.getSession(); + public void cleanProjectFolder(Session session, final Resource projectResource) throws ProjectException { String projectName = null; final HashMap resultPaths = new HashMap(); try { - projectName = processor.syncRequest(new Read() { + projectName = session.syncRequest(new Read() { @Override public String perform(ReadGraph graph) throws DatabaseException { Builtins b = graph.getBuiltins(); + SimulationResource SIMU = SimulationResource.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); for(Resource model : graph.getObjects(projectResource, b.ConsistsOf)) { if(graph.isInstanceOf(model, sr.SysdynModel)){ for(Resource experiment : graph.getObjects(model, b.ConsistsOf)) { - if(graph.isInstanceOf(experiment, b.Experiment)) { + if(graph.isInstanceOf(experiment, SIMU.Experiment)) { for(Resource result : graph.getObjects(experiment, sr.HasResult)) { String resultFile = (String)graph.getPossibleRelatedValue(result, sr.HasResultFile); if(result != null) resultPaths.put(resultFile, result); @@ -198,7 +185,7 @@ public class SysdynProjectLifeCycle implements IProjectLifeCycle{ } }); } catch (DatabaseException e) { - e.printStackTrace(); + throw new ProjectException(e); } if(projectName != null) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java index ae744d8d..ad7a0e3a 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java @@ -13,6 +13,7 @@ import org.simantics.db.exception.ManyObjectsForFunctionalRelationException; import org.simantics.db.exception.ServiceException; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.modeling.ModelingResources; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.utils.AdaptionUtils; @@ -71,7 +72,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor getSeriesKey(int series) { + public Comparable getSeriesKey(int series) { SysdynDataSet sds = sets[series]; if(sds.result == null) return sds.name; @@ -95,25 +96,25 @@ public class TrendView extends ViewPart { } @Override - public int getSeriesCount() { + public int getSeriesCount() { return sets.length; } } @Override - public void createPartControl(Composite parent) { + public void createPartControl(Composite parent) { final ActiveSelectionProvider selectionProvider = new ActiveSelectionProvider(); getSite().setSelectionProvider(selectionProvider); - final Composite composite = new Composite(parent, + final Composite composite = new Composite(parent, SWT.NO_BACKGROUND | SWT.EMBEDDED); frame = SWT_AWT.new_Frame(composite); SwingUtilities.invokeLater(new Runnable() { @Override - public void run() { + public void run() { XYPlot plot = new XYPlot( sysdynDatasets, new NumberAxis("time"), @@ -143,7 +144,7 @@ public class TrendView extends ViewPart { return; Resource runtime = runtimes.get(0); setSelection(ress.toArray(Resource.NONE), runtime); - } + } } }); @@ -183,7 +184,7 @@ public class TrendView extends ViewPart { SwingUtilities.invokeLater(new Runnable() { @Override - public void run() { + public void run() { sysdynDatasets.setDatasets(datasets.toArray(new SysdynDataSet[datasets.size()])); } @@ -232,7 +233,7 @@ public class TrendView extends ViewPart { @Override public void setFocus() { if(panel != null) - panel.requestFocus(); + panel.requestFocus(); } protected Collection loadAllActive(ReadGraph g, Resource element, Resource runtime) throws DatabaseException { @@ -261,7 +262,7 @@ public class TrendView extends ViewPart { System.out.println("load dataset for '" + item.getURI(g) + "'"); Resource model = Variables.getModel(g, item); - Resource configuration = g.getPossibleObject(model, b.HasConfiguration); + Resource configuration = g.getPossibleObject(model, SimulationResource.getInstance(g).HasConfiguration); SysdynModel sm = SysdynModelManager.getInstance(g.getSession()).getModel(g, configuration); Collection activeResults = sm.getActiveResults(g); diff --git a/org.simantics.sysdyn/META-INF/MANIFEST.MF b/org.simantics.sysdyn/META-INF/MANIFEST.MF index fdac2af7..ca7f9316 100644 --- a/org.simantics.sysdyn/META-INF/MANIFEST.MF +++ b/org.simantics.sysdyn/META-INF/MANIFEST.MF @@ -15,8 +15,9 @@ Require-Bundle: org.simantics.objmap;bundle-version="0.1.0", org.eclipse.jface;bundle-version="3.5.2", org.simantics.project;bundle-version="1.0.0", org.simantics.layer0.utils;bundle-version="0.8.0", - org.simantics.sysdyn.ontology;bundle-version="1.0.0", - org.simantics.structural.ontology;bundle-version="1.0.0" + org.simantics.layer0;bundle-version="1.0.0", + org.simantics.structural.ontology;bundle-version="1.0.0", + org.simantics.sysdyn.ontology;bundle-version="1.0.0" Export-Package: org.simantics.sysdyn, org.simantics.sysdyn.expressionParser, org.simantics.sysdyn.manager, diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java index 50b68e17..2862850f 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java @@ -24,6 +24,7 @@ import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.simulation.experiment.Experiment; import org.simantics.simulation.experiment.ExperimentState; import org.simantics.simulation.experiment.IDynamicExperiment; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.simulation.SimulationScheduler; @@ -174,7 +175,7 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment { @Override public void run(ReadGraph graph) throws DatabaseException { - final Resource configuration = graph.getPossibleObject(model, graph.getBuiltins().HasConfiguration); + final Resource configuration = graph.getPossibleObject(model, SimulationResource.getInstance(graph).HasConfiguration); sysdynModel = SysdynModelManager.getInstance(session).getModel(graph, configuration); toggleActivation(graph, true); @@ -225,11 +226,11 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment { @Override public void perform(WriteGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); - if(activate) - graph.claim(experiment, b.IsActive, experiment); + SimulationResource SIMU = SimulationResource.getInstance(graph); + if(activate) + graph.claim(experiment, SIMU.IsActive, experiment); else - graph.denyStatement(experiment, b.IsActive, experiment); + graph.denyStatement(experiment, SIMU.IsActive, experiment); } }); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java index fbb8df79..fe7747a0 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java @@ -40,6 +40,7 @@ import org.simantics.objmap.IMappingListener; import org.simantics.objmap.Mappings; import org.simantics.simulation.experiment.IExperiment; import org.simantics.simulation.model.IModel; +import org.simantics.simulation.ontology.SimulationResource; import org.simantics.simulation.project.IExperimentActivationListener; import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.Activator; @@ -63,7 +64,7 @@ public class SysdynModel implements IMappingListener, IModel { IMapping mapping; - Resource configurationResource; + Resource configurationResource; Configuration configuration; Set modules = new HashSet(); @@ -147,7 +148,7 @@ public class SysdynModel implements IMappingListener, IModel { simulationDir = Activator.getBundleContext().getDataFile("models/" + configName); if (!simulationDir.exists()) { simulationDir.mkdir(); - } + } } @@ -155,7 +156,7 @@ public class SysdynModel implements IMappingListener, IModel { * some dummy(?) stuff for experiments */ public SysdynModel(Resource configurationResource) { - this.configurationResource = configurationResource; + this.configurationResource = configurationResource; } public synchronized void simulate(IModelicaMonitor monitor, final IProgressMonitor progressMonitor) throws IOException { @@ -185,8 +186,8 @@ public class SysdynModel implements IMappingListener, IModel { final SimulationLocation simulationLocation = ModelicaManager.createInputFiles( simulationDir, configuration.getName(), - writer.toString(), - inits); + writer.toString(), + inits); progressMonitor.worked(20); @@ -198,7 +199,7 @@ public class SysdynModel implements IMappingListener, IModel { ModelicaManager.buildModel(simulationLocation, monitor); - } + } progressMonitor.worked(20); @@ -220,7 +221,7 @@ public class SysdynModel implements IMappingListener, IModel { result = new SimulationResult(); result.read(simulationLocation.outputFile); result.readInits(simulationLocation.initFile); - result.filter(); + result.filter(); progressMonitor.worked(20); sysdynResult.setResult(result); progressMonitor.worked(20); @@ -343,7 +344,7 @@ public class SysdynModel implements IMappingListener, IModel { listener.onFailure(e); return null; } - } + } public Collection getActiveResults(ReadGraph graph) { ArrayList results = new ArrayList(); @@ -351,12 +352,13 @@ public class SysdynModel implements IMappingListener, IModel { try { Builtins b = graph.getBuiltins(); SysdynResource sr = SysdynResource.getInstance(graph); - Resource model = graph.getSingleObject(configurationResource, b.IsConfigurationOf); + SimulationResource SIMU = SimulationResource.getInstance(graph); + Resource model = graph.getSingleObject(configurationResource, SIMU.IsConfigurationOf); Collection experiments = graph.getObjects(model, b.ConsistsOf); for(Resource experiment : experiments) { Collection experimentResults = graph.getObjects(experiment, sr.HasResult); for(Resource result : experimentResults) { - if(graph.hasStatement(result, b.IsActive)) { + if(graph.hasStatement(result, SIMU.IsActive)) { SysdynResult sysdynResult = new SysdynResult( (String) graph.getPossibleRelatedValue(result, b.HasLabel), (String) graph.getPossibleRelatedValue(result, sr.HasResultFile)); -- 2.47.1