From: villberg Date: Fri, 9 Jul 2010 10:47:34 +0000 (+0000) Subject: Sysdyn dev X-Git-Tag: simantics-1.2.0~180 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=d7844c1bb99b07847aa81b445b0a5775acd69318;p=simantics%2Fsysdyn.git Sysdyn dev git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16569 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/adapters.xml b/org.simantics.sysdyn.ui/adapters.xml index 07396da1..dba8c8fc 100644 --- a/org.simantics.sysdyn.ui/adapters.xml +++ b/org.simantics.sysdyn.ui/adapters.xml @@ -25,5 +25,5 @@ - none 0 fill 1 + none 0 fill 1 \ No newline at end of file diff --git a/org.simantics.sysdyn.ui/plugin.xml b/org.simantics.sysdyn.ui/plugin.xml index 5b5c4cfd..602cf206 100644 --- a/org.simantics.sysdyn.ui/plugin.xml +++ b/org.simantics.sysdyn.ui/plugin.xml @@ -557,6 +557,10 @@ class="org.simantics.sysdyn.ui.browser.contributions.Model" preference="1.0"> + + @@ -573,6 +577,10 @@ class="org.simantics.sysdyn.ui.browser.contributions.Module" preference="1.0"> + + { + + @Override + public Collection getContribution(ReadGraph graph, ModuleTypeNode module) throws DatabaseException { + ArrayList result = new ArrayList(); + Builtins b = graph.getBuiltins(); + SysdynResource sr = SysdynResource.getInstance(graph); + StructuralResource2 str = StructuralResource2.getInstance(graph); + ModelingResources mr = ModelingResources.getInstance(graph); + Resource symbol = graph.getPossibleObject(module.resource, mr.ComponentTypeToSymbol); + result.add(graph.adapt(symbol, AbstractNode.class)); + return result; + } + + @Override + public String getViewpointId() { + return "Standard"; + } + +} diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Modules.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Modules.java new file mode 100644 index 00000000..8b6111fc --- /dev/null +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Modules.java @@ -0,0 +1,38 @@ +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.structural.stubs.StructuralResource2; +import org.simantics.sysdyn.ui.browser.nodes.AbstractNode; +import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode; +import org.simantics.sysdyn.ui.browser.nodes.ModulesNode; + +public class Modules extends ViewpointContributor { + + @Override + public Collection getContribution(ReadGraph graph, ModulesNode project) + throws DatabaseException { + + ArrayList result = new ArrayList(); + Builtins b = graph.getBuiltins(); + StructuralResource2 st = StructuralResource2.getInstance(graph); + for(Resource r : graph.syncRequest(new ObjectsWithType(project.resource, b.IsRelatedTo, st.ComponentType))) { + result.add(new ModuleTypeNode(r)); + } + return result; + + } + + @Override + public String getViewpointId() { + return "Standard"; + } + +} diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleTypeNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleTypeNode.java new file mode 100644 index 00000000..fdbad703 --- /dev/null +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleTypeNode.java @@ -0,0 +1,11 @@ +package org.simantics.sysdyn.ui.browser.nodes; + +import org.simantics.browsing.ui.common.node.IDeletable; +import org.simantics.db.Resource; + +public class ModuleTypeNode extends AbstractNode implements IDeletable { + + public ModuleTypeNode(Resource resource) { + super(resource); + } +} diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SymbolNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SymbolNode.java new file mode 100644 index 00000000..90fb5337 --- /dev/null +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SymbolNode.java @@ -0,0 +1,11 @@ +package org.simantics.sysdyn.ui.browser.nodes; + +import org.simantics.browsing.ui.common.node.IDeletable; +import org.simantics.db.Resource; + +public class SymbolNode extends AbstractNode implements IDeletable { + + public SymbolNode(Resource resource) { + super(resource); + } +} diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/DiagramViewer.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/DiagramViewer.java index 1b023211..d9c2d89b 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/DiagramViewer.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/DiagramViewer.java @@ -82,11 +82,11 @@ public class DiagramViewer extends org.simantics.modeling.ui.diagramEditor.Diagr SysdynResource.getInstance(graph); } - @Override - protected void addStructureParticipants(ICanvasContext ctx) { -// structuralPath = getResourceInput().getResourceArray().removeFromBeginning(1); - ctx.add(new WorkbenchStructuralSelectionProvider2(swt, getSite(), ResourceArray.EMPTY)); - } +// @Override +// protected void addStructureParticipants(ICanvasContext ctx) { +//// structuralPath = getResourceInput().getResourceArray().removeFromBeginning(1); +// ctx.add(new WorkbenchStructuralSelectionProvider2(swt, getSite(), ResourceArray.EMPTY)); +// } @Override protected void addOtherParticipants(CanvasContext ctx) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java index 707d83a8..32e6ed57 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java @@ -230,9 +230,17 @@ public class TrendView extends ViewPart { DiagramResource dr = DiagramResource.getInstance(g); -// String rvi = g.getPossibleRelatedValue(runtime, dr.HasRVI); -// System.out.println("load results rvi='" + rvi + "'"); + if(runtime == null) return null; + String prefix = ""; + Resource model = g.getResource((String)g.getPossibleRelatedValue(runtime, dr.HasModelURI)); + Resource configuration = g.getPossibleObject(model, b.HasConfiguration); + String rvi = g.getPossibleRelatedValue(runtime, dr.HasRVI); + if(rvi.startsWith("/")) { + rvi = rvi.substring(1); + prefix = rvi.replace("/", ".") + "."; + } +// System.out.println("load results rvi='" + rvi + "' prefix='" + prefix + "'"); ModelingResources mr = ModelingResources.getInstance(g); Resource map = g.getPossibleObject(resource, mr.ElementToComponent); @@ -244,15 +252,16 @@ public class TrendView extends ViewPart { // module = g.getPossibleObject(module, b.PartOf); // } if(g.isInstanceOf(module, sr.Configuration)) { - SysdynModel model = getModel(g, module); + + SysdynModel sm = getModel(g, configuration); if(model == null) return null; - IElement element = model.getElement(resource); + IElement element = sm.getElement(resource); if(element instanceof Variable) { Variable var = (Variable)element; - Collection activeResults = model.getActiveResults(g); + Collection activeResults = sm.getActiveResults(g); ArrayList datasets = new ArrayList(); for(SysdynResult r : activeResults) { SysdynDataSet sdds = r.getDataSet(prefix + var.getName()); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java index d6c844b2..1135604b 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java @@ -26,6 +26,7 @@ public class SysdynResource { public final Resource Auxiliary; public final Resource AuxiliarySymbol; public final Resource BasicExperiment; + public final Resource CapacityModuleConfigurationDiagram; public final Resource CapacitySymbol; public final Resource Cloud; public final Resource CloudSymbol; @@ -106,6 +107,7 @@ public class SysdynResource { public static final String Auxiliary = "http://www.simantics.org/Sysdyn-1.0/Auxiliary"; public static final String AuxiliarySymbol = "http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"; public static final String BasicExperiment = "http://www.simantics.org/Sysdyn-1.0/BasicExperiment"; + public static final String CapacityModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/CapacityModuleConfigurationDiagram"; public static final String CapacitySymbol = "http://www.simantics.org/Sysdyn-1.0/CapacitySymbol"; public static final String Cloud = "http://www.simantics.org/Sysdyn-1.0/Cloud"; public static final String CloudSymbol = "http://www.simantics.org/Sysdyn-1.0/CloudSymbol"; @@ -196,6 +198,7 @@ public class SysdynResource { Auxiliary = getResourceOrNull(graph, URIs.Auxiliary); AuxiliarySymbol = getResourceOrNull(graph, URIs.AuxiliarySymbol); BasicExperiment = getResourceOrNull(graph, URIs.BasicExperiment); + CapacityModuleConfigurationDiagram = getResourceOrNull(graph, URIs.CapacityModuleConfigurationDiagram); CapacitySymbol = getResourceOrNull(graph, URIs.CapacitySymbol); Cloud = getResourceOrNull(graph, URIs.Cloud); CloudSymbol = getResourceOrNull(graph, URIs.CloudSymbol);