<graph />\r
<this />\r
</type>\r
- </target>\r \r <target\r interface="org.simantics.sysdyn.ui.browser.nodes.AbstractNode">\r <type\r uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/IndependentVariable"\r class="org.simantics.sysdyn.ui.browser.nodes.VariableNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Module"\r class="org.simantics.sysdyn.ui.browser.nodes.ModuleNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Simulation-1.0/Types/Experiment"\r class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Result"\r class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r <this />\r </type>\r \r </target>\r\r <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r <target interface="org.simantics.g2d.diagram.DiagramClass">\r <adapter uri="http://www.simantics.org/Sysdyn-1.0/ConfigurationDiagram"\r adapterClass="org.simantics.sysdyn.ui.elements2.ConfigurationDiagramClassAdapter" />\r </target>\r\r <!-- Sysdyn symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r\r <type uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r </target>\r \r <!-- Sysdyn connections -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <!-- Edges -->\r <resource uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.FlowEdgeFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.FlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.DependencyEdgeFactory" />\r <!-- : SYSDYN.Connection-->\r <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.FlowConnectionFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.DependencyConnectionFactory" />\r </target>\r \r <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r <baseType uri="http://www.simantics.org/Diagram-2.0/HasConnector" />\r <resource uri="http://www.simantics.org/Diagram-2.0/HasPlainConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>none 0</string>\r </resource>\r <resource uri="http://www.simantics.org/Diagram-2.0/HasArrowConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>fill 1</string>\r </resource>\r </target>\r \r
+ </target>\r \r <target\r interface="org.simantics.sysdyn.ui.browser.nodes.AbstractNode">\r <type\r uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/IndependentVariable"\r class="org.simantics.sysdyn.ui.browser.nodes.VariableNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Module"\r class="org.simantics.sysdyn.ui.browser.nodes.ModuleNode">\r <this />\r </type>\r \r <resource\r uri="http://www.simantics.org/Sysdyn-1.0/Module"\r class="org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode">\r <this />\r </resource>\r\r <resource\r uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r <this />\r </resource>\r\r <type\r uri="http://www.simantics.org/Simulation-1.0/Types/Experiment"\r class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-1.0/Result"\r class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r <this />\r </type>\r \r </target>\r\r <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r <target interface="org.simantics.g2d.diagram.DiagramClass">\r <adapter uri="http://www.simantics.org/Sysdyn-1.0/ConfigurationDiagram"\r adapterClass="org.simantics.sysdyn.ui.elements2.ConfigurationDiagramClassAdapter" />\r </target>\r\r <!-- Sysdyn symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r\r <type uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r </target>\r \r <!-- Sysdyn connections -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <!-- Edges -->\r <resource uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.FlowEdgeFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.FlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.DependencyEdgeFactory" />\r <!-- : SYSDYN.Connection-->\r <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.FlowConnectionFactory" />\r <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.DependencyConnectionFactory" />\r </target>\r \r <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r <baseType uri="http://www.simantics.org/Diagram-2.0/HasConnector" />\r <resource uri="http://www.simantics.org/Diagram-2.0/HasPlainConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>none 0</string>\r </resource>\r <resource uri="http://www.simantics.org/Diagram-2.0/HasArrowConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>fill 1</string>\r </resource>\r </target>\r \r
</adapters>
\ No newline at end of file
class="org.simantics.sysdyn.ui.browser.contributions.Model"\r
preference="1.0">\r
</implementation>\r
+ <implementation\r
+ class="org.simantics.sysdyn.ui.browser.contributions.Modules"\r
+ preference="1.0">\r
+ </implementation>\r
<implementation\r
class="org.simantics.sysdyn.ui.browser.contributions.ModelChildren"\r
preference="2.0">\r
class="org.simantics.sysdyn.ui.browser.contributions.Module"\r
preference="1.0">\r
</implementation>\r
+ <implementation\r
+ class="org.simantics.sysdyn.ui.browser.contributions.ModuleType"\r
+ preference="1.0">\r
+ </implementation>\r
</binding>\r
</extension>\r
<extension\r
import org.simantics.db.Resource;\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.modeling.ModelingResources;\r
import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
--- /dev/null
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
+import org.simantics.db.Builtins;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.modeling.ModelingResources;\r
+import org.simantics.structural.stubs.StructuralResource2;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
+\r
+public class ModuleType extends ViewpointContributor<ModuleTypeNode> {\r
+\r
+ @Override\r
+ public Collection<?> getContribution(ReadGraph graph, ModuleTypeNode module) throws DatabaseException {\r
+ ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ Builtins b = graph.getBuiltins();\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ StructuralResource2 str = StructuralResource2.getInstance(graph);\r
+ ModelingResources mr = ModelingResources.getInstance(graph);\r
+ Resource symbol = graph.getPossibleObject(module.resource, mr.ComponentTypeToSymbol);\r
+ result.add(graph.adapt(symbol, AbstractNode.class));\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public String getViewpointId() {\r
+ return "Standard";\r
+ }\r
+\r
+}\r
--- /dev/null
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
+import org.simantics.db.Builtins;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.structural.stubs.StructuralResource2;\r
+import org.simantics.sysdyn.ui.browser.nodes.AbstractNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\r
+\r
+public class Modules extends ViewpointContributor<ModulesNode> {\r
+\r
+ @Override\r
+ public Collection<?> getContribution(ReadGraph graph, ModulesNode project)\r
+ throws DatabaseException {\r
+\r
+ ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
+ Builtins b = graph.getBuiltins();\r
+ StructuralResource2 st = StructuralResource2.getInstance(graph);\r
+ for(Resource r : graph.syncRequest(new ObjectsWithType(project.resource, b.IsRelatedTo, st.ComponentType))) {\r
+ result.add(new ModuleTypeNode(r));\r
+ }\r
+ return result;\r
+\r
+ }\r
+\r
+ @Override\r
+ public String getViewpointId() {\r
+ return "Standard";\r
+ }\r
+ \r
+}\r
--- /dev/null
+package org.simantics.sysdyn.ui.browser.nodes;\r
+\r
+import org.simantics.browsing.ui.common.node.IDeletable;\r
+import org.simantics.db.Resource;\r
+\r
+public class ModuleTypeNode extends AbstractNode implements IDeletable {\r
+\r
+ public ModuleTypeNode(Resource resource) {\r
+ super(resource);\r
+ }\r
+}\r
--- /dev/null
+package org.simantics.sysdyn.ui.browser.nodes;\r
+\r
+import org.simantics.browsing.ui.common.node.IDeletable;\r
+import org.simantics.db.Resource;\r
+\r
+public class SymbolNode extends AbstractNode implements IDeletable {\r
+\r
+ public SymbolNode(Resource resource) {\r
+ super(resource);\r
+ }\r
+}\r
SysdynResource.getInstance(graph);\r
}\r
\r
- @Override\r
- protected void addStructureParticipants(ICanvasContext ctx) {\r
-// structuralPath = getResourceInput().getResourceArray().removeFromBeginning(1);\r
- ctx.add(new WorkbenchStructuralSelectionProvider2(swt, getSite(), ResourceArray.EMPTY));\r
- }\r
+// @Override\r
+// protected void addStructureParticipants(ICanvasContext ctx) {\r
+//// structuralPath = getResourceInput().getResourceArray().removeFromBeginning(1);\r
+// ctx.add(new WorkbenchStructuralSelectionProvider2(swt, getSite(), ResourceArray.EMPTY));\r
+// }\r
\r
@Override\r
protected void addOtherParticipants(CanvasContext ctx) {\r
\r
DiagramResource dr = DiagramResource.getInstance(g);\r
\r
-// String rvi = g.getPossibleRelatedValue(runtime, dr.HasRVI);\r
-// System.out.println("load results rvi='" + rvi + "'");\r
+ if(runtime == null) return null;\r
+ \r
String prefix = "";\r
+ Resource model = g.getResource((String)g.getPossibleRelatedValue(runtime, dr.HasModelURI));\r
+ Resource configuration = g.getPossibleObject(model, b.HasConfiguration);\r
+ String rvi = g.getPossibleRelatedValue(runtime, dr.HasRVI);\r
+ if(rvi.startsWith("/")) {\r
+ rvi = rvi.substring(1);\r
+ prefix = rvi.replace("/", ".") + ".";\r
+ } \r
+// System.out.println("load results rvi='" + rvi + "' prefix='" + prefix + "'");\r
\r
ModelingResources mr = ModelingResources.getInstance(g);\r
Resource map = g.getPossibleObject(resource, mr.ElementToComponent);\r
// module = g.getPossibleObject(module, b.PartOf);\r
// }\r
if(g.isInstanceOf(module, sr.Configuration)) {\r
- SysdynModel model = getModel(g, module);\r
+ \r
+ SysdynModel sm = getModel(g, configuration);\r
if(model == null)\r
return null;\r
\r
- IElement element = model.getElement(resource);\r
+ IElement element = sm.getElement(resource);\r
if(element instanceof Variable) {\r
Variable var = (Variable)element; \r
\r
- Collection<SysdynResult> activeResults = model.getActiveResults(g);\r
+ Collection<SysdynResult> activeResults = sm.getActiveResults(g);\r
ArrayList<SysdynDataSet> datasets = new ArrayList<SysdynDataSet>();\r
for(SysdynResult r : activeResults) {\r
SysdynDataSet sdds = r.getDataSet(prefix + var.getName());\r
public final Resource Auxiliary;\r
public final Resource AuxiliarySymbol;\r
public final Resource BasicExperiment;\r
+ public final Resource CapacityModuleConfigurationDiagram;\r
public final Resource CapacitySymbol;\r
public final Resource Cloud;\r
public final Resource CloudSymbol;\r
public static final String Auxiliary = "http://www.simantics.org/Sysdyn-1.0/Auxiliary";\r
public static final String AuxiliarySymbol = "http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol";\r
public static final String BasicExperiment = "http://www.simantics.org/Sysdyn-1.0/BasicExperiment";\r
+ public static final String CapacityModuleConfigurationDiagram = "http://www.simantics.org/Sysdyn-1.0/CapacityModuleConfigurationDiagram";\r
public static final String CapacitySymbol = "http://www.simantics.org/Sysdyn-1.0/CapacitySymbol";\r
public static final String Cloud = "http://www.simantics.org/Sysdyn-1.0/Cloud";\r
public static final String CloudSymbol = "http://www.simantics.org/Sysdyn-1.0/CloudSymbol";\r
Auxiliary = getResourceOrNull(graph, URIs.Auxiliary);\r
AuxiliarySymbol = getResourceOrNull(graph, URIs.AuxiliarySymbol);\r
BasicExperiment = getResourceOrNull(graph, URIs.BasicExperiment);\r
+ CapacityModuleConfigurationDiagram = getResourceOrNull(graph, URIs.CapacityModuleConfigurationDiagram);\r
CapacitySymbol = getResourceOrNull(graph, URIs.CapacitySymbol);\r
Cloud = getResourceOrNull(graph, URIs.Cloud);\r
CloudSymbol = getResourceOrNull(graph, URIs.CloudSymbol);\r