]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Adding a workbook for configuration.
authorvillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 7 Jul 2011 12:55:42 +0000 (12:55 +0000)
committervillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 7 Jul 2011 12:55:42 +0000 (12:55 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@21424 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/Sysdyn_ModelBrowser_Viewpoint.pgraph
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/META-INF/MANIFEST.MF
org.simantics.sysdyn.ui/adapters.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/OpenWorkbookAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ConfigurationVariable.java

index 6c7f849321afab0020354b0483cfb9386f94dad4..b633d258ad179412f8208215847fb2d1527fdadd 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index 015bb200b15621ee4d11907ebc1cdb8ba774605d..18248d92a0a0b6678ef6efb3da3b59a6b9d51f0d 100644 (file)
@@ -81,11 +81,19 @@ ACTIONS.NewEnumeration : ACT.Action
 ACTIONS.NewFunction : ACT.Action\r
 ACTIONS.NewFunctionLibrary : ACT.Action\r
 ACTIONS.NewSharedFunctionLibrary : ACT.Action\r
+ACTIONS.OpenWorkbook : ACT.Action\r
 \r
     \r
-MAC    \r
+MAC\r
     @VP.actionContribution "Module" SBC.ModulesFolder MBC.Images.Composite VP.NewActionCategory ACTIONS.NewModuleType\r
+    VP.BrowseContext.HasActionContribution _ : VP.ActionContribution\r
+      L0.HasLabel "Open Workbook"\r
+      VP.ActionContribution.HasImage MBC.Images.Component\r
+      VP.ActionContribution.HasNodeType MBC.Configuration\r
+      VP.ActionContribution.HasAction ACTIONS.OpenWorkbook\r
+    \r
     @VP.actionContribution "Enumeration" MBC.Configuration MBC.Images.Component VP.NewActionCategory ACTIONS.NewEnumeration\r
+    //@VP.actionContribution "Open Workbook" MBC.Configuration MBC.Images.Component VP.NewActionCategory ACTIONS.OpenWorkbook\r
     @VP.actionContribution "Enumeration" SBC.ModuleSymbol MBC.Images.Component VP.NewActionCategory ACTIONS.NewEnumeration\r
     @VP.actionContribution "Function" SBC.FunctionsFolder MBC.Images.Component VP.NewActionCategory ACTIONS.NewFunction\r
     @VP.actionContribution "Function" SYSDYN.SysdynModelicaFunctionLibrary MBC.Images.Component VP.NewActionCategory ACTIONS.NewFunction\r
index 74c7015d7142ff83cbf90a450ad2fe458540903e..5308d589877b3fcd47d14ad7c085713e7371c995 100644 (file)
@@ -145,6 +145,7 @@ public class SysdynResource {
     public final Resource ProjectActionContext_Actions_NewFunctionLibrary;\r
     public final Resource ProjectActionContext_Actions_NewModuleType;\r
     public final Resource ProjectActionContext_Actions_NewSharedFunctionLibrary;\r
+    public final Resource ProjectActionContext_Actions_OpenWorkbook;\r
     public final Resource ProjectBrowseContext;\r
     public final Resource ProjectBrowseContext_BuiltinFunctions;\r
     public final Resource ProjectBrowseContext_FunctionsFolder;\r
@@ -324,6 +325,7 @@ public class SysdynResource {
         public static final String ProjectActionContext_Actions_NewFunctionLibrary = "http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunctionLibrary";\r
         public static final String ProjectActionContext_Actions_NewModuleType = "http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewModuleType";\r
         public static final String ProjectActionContext_Actions_NewSharedFunctionLibrary = "http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewSharedFunctionLibrary";\r
+        public static final String ProjectActionContext_Actions_OpenWorkbook = "http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/OpenWorkbook";\r
         public static final String ProjectBrowseContext = "http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext";\r
         public static final String ProjectBrowseContext_BuiltinFunctions = "http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/BuiltinFunctions";\r
         public static final String ProjectBrowseContext_FunctionsFolder = "http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/FunctionsFolder";\r
@@ -513,6 +515,7 @@ public class SysdynResource {
         ProjectActionContext_Actions_NewFunctionLibrary = getResourceOrNull(graph, URIs.ProjectActionContext_Actions_NewFunctionLibrary);\r
         ProjectActionContext_Actions_NewModuleType = getResourceOrNull(graph, URIs.ProjectActionContext_Actions_NewModuleType);\r
         ProjectActionContext_Actions_NewSharedFunctionLibrary = getResourceOrNull(graph, URIs.ProjectActionContext_Actions_NewSharedFunctionLibrary);\r
+        ProjectActionContext_Actions_OpenWorkbook = getResourceOrNull(graph, URIs.ProjectActionContext_Actions_OpenWorkbook);\r
         ProjectBrowseContext = getResourceOrNull(graph, URIs.ProjectBrowseContext);\r
         ProjectBrowseContext_BuiltinFunctions = getResourceOrNull(graph, URIs.ProjectBrowseContext_BuiltinFunctions);\r
         ProjectBrowseContext_FunctionsFolder = getResourceOrNull(graph, URIs.ProjectBrowseContext_FunctionsFolder);\r
index ed95e0589697864d6724a3a00c5f4c1e32a66fc7..54792ffeb164519657f06da46071edbcb60401b6 100644 (file)
@@ -40,7 +40,8 @@ Require-Bundle: org.simantics.layer0.utils;bundle-version="0.6.2",
  org.simantics.graph;bundle-version="1.0.2",
  org.simantics.graph.db;bundle-version="1.0.0",
  org.simantics.structural.ui;bundle-version="1.1.1",
- org.simantics.browsing.ui.model;bundle-version="1.0.0"
+ org.simantics.browsing.ui.model;bundle-version="1.0.0",
+ org.simantics.spreadsheet.ui;bundle-version="1.1.0"
 Bundle-Activator: org.simantics.sysdyn.ui.Activator
 Bundle-ActivationPolicy: lazy
 Export-Package: org.simantics.sysdyn.ui.browser.nodes
index bb6ba6dd53da4a8223daa5c7cb0cbf01bbe534f7..f15dc9e0aaebfe852a8976eb99352f5d809ca4a8 100644 (file)
@@ -10,5 +10,5 @@
         VTT Technical Research Centre of Finland - initial API and implementation\r
  -->\r
 
-<adapters>\r\r   <target interface="org.simantics.db.layer0.adapter.Realization">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r<!-- \r       <target interface="org.simantics.db.layer0.variable.Variable">\r         <type uri="http://www.simantics.org/Sysdyn-1.0/HistoryRealization"\r                     class="org.simantics.sysdyn.ui.project.HistoryVariable" >\r                      <this />\r               </type>\r                <type uri="http://www.simantics.org/Sysdyn-1.0/DefaultRealization"\r                     class="org.simantics.sysdyn.ui.project.DefaultVariable" >\r                      <this />\r               </type>\r        </target>\r -->\r\r        <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-1.0/DiagramToCompositeMapping"\r          class = "org.simantics.sysdyn.ui.editor.DiagramToCompositeMapping3">\r         <graph/>\r           <this />\r       </type>\r        </target>\r      \r       <target interface="org.simantics.structural.ui.modelBrowser.nodes.AbstractNode">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r                    class="org.simantics.structural.ui.modelBrowser.nodes.ModelNode">\r                      <this />\r               </type>\r        </target>               \r               \r\r      <target\r                interface="org.simantics.browsing.ui.common.node.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               <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/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              <resource uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\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              <type uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.InputFactory" />                       \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.connections.FlowEdgeFactory" />\r               <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <!-- : SYSDYN.Connection-->\r            <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowConnectionFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.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       <!-- ModelBrowser2 -->\r \r       <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>            \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>              \r    \r     \r
+<adapters>\r\r   <target interface="org.simantics.db.layer0.adapter.Realization">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r<!-- \r       <target interface="org.simantics.db.layer0.variable.Variable">\r         <type uri="http://www.simantics.org/Sysdyn-1.0/HistoryRealization"\r                     class="org.simantics.sysdyn.ui.project.HistoryVariable" >\r                      <this />\r               </type>\r                <type uri="http://www.simantics.org/Sysdyn-1.0/DefaultRealization"\r                     class="org.simantics.sysdyn.ui.project.DefaultVariable" >\r                      <this />\r               </type>\r        </target>\r -->\r\r        <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-1.0/DiagramToCompositeMapping"\r          class = "org.simantics.sysdyn.ui.editor.DiagramToCompositeMapping3">\r         <graph/>\r           <this />\r       </type>\r        </target>\r      \r       <target interface="org.simantics.structural.ui.modelBrowser.nodes.AbstractNode">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r                    class="org.simantics.structural.ui.modelBrowser.nodes.ModelNode">\r                      <this />\r               </type>\r        </target>               \r               \r\r      <target\r                interface="org.simantics.browsing.ui.common.node.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               <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/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              <resource uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\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              <type uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.InputFactory" />                       \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.connections.FlowEdgeFactory" />\r               <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <!-- : SYSDYN.Connection-->\r            <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowConnectionFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.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       <!-- ModelBrowser2 -->\r \r       <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>            \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/OpenWorkbook"\r            class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>              \r    \r     \r
 </adapters>
\ No newline at end of file
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/OpenWorkbookAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/OpenWorkbookAction.java
new file mode 100644 (file)
index 0000000..f233f3a
--- /dev/null
@@ -0,0 +1,82 @@
+package org.simantics.sysdyn.ui.browser.actions;\r
+\r
+import org.eclipse.ui.PartInitException;\r
+import org.eclipse.ui.PlatformUI;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.request.PossibleObjectWithType;\r
+import org.simantics.db.common.request.ReadRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.ActionFactory;\r
+import org.simantics.db.layer0.util.Simantics;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ui.diagramEditor.OpenSheetAdapter;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.workbench.ResourceEditorInput2;\r
+import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
+\r
+public class OpenWorkbookAction implements ActionFactory{\r
+\r
+    @Override\r
+    public Runnable create(Object target) {\r
+       \r
+        if(!(target instanceof Resource))\r
+            return null;\r
+        \r
+        final Resource resource = (Resource)target;\r
+        \r
+        return new Runnable() {\r
+\r
+                       @Override\r
+                       public void run() {\r
+                       \r
+                       try {\r
+                               \r
+                           SimanticsUI.getSession().asyncRequest(new ReadRequest() {\r
+                               @Override\r
+                               public void run(ReadGraph graph) throws DatabaseException {\r
+\r
+                                   Layer0 L0 = Layer0.getInstance(graph);\r
+                                   SpreadsheetResource sr = SpreadsheetResource.getInstance(graph);\r
+                                   \r
+                                   Resource book = graph.syncRequest(new PossibleObjectWithType(resource, L0.ConsistsOf, sr.Book));\r
+                                   final Resource sheet = graph.syncRequest(new PossibleObjectWithType(book, L0.ConsistsOf, sr.Spreadsheet));\r
+                                   \r
+                                   SimulationResource SIMU = SimulationResource.getInstance(graph);\r
+                                   Variable variable = graph.adapt(sheet, Variable.class);\r
+                                   Resource model = Variables.getModel(graph, variable);\r
+                                   final String modelURI = graph.getURI(model);\r
+                                   final String RVI = Variables.getRVI(graph, variable);\r
+\r
+                                   PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {\r
+                                       \r
+                                       private static final String EDITOR_ID = "org.simantics.spreadsheet.ui.editor2";\r
+                                       \r
+                                       @Override\r
+                                       public void run() {\r
+                                           try {\r
+                                               System.out.println("Activating sheet: model=" + modelURI + " rvi=" + RVI);\r
+                                               WorkbenchUtils.openEditor(EDITOR_ID, new ResourceEditorInput2(EDITOR_ID, sheet, modelURI, RVI));\r
+                                           } catch (PartInitException e) {\r
+                                               // TODO Auto-generated catch block\r
+                                               e.printStackTrace();\r
+                                           }\r
+                                       }\r
+                                   });\r
+                               }\r
+                           });\r
+                               } catch (Exception e) {\r
+                                       e.printStackTrace();\r
+                               }\r
+                               \r
+                       }\r
+               \r
+        };\r
+        \r
+    }\r
+\r
+}\r
index 0147a2f2cef58dabb9e211b602f06de603915baf..366e0038daa3d9613217c6e8ebfdb36a9835fcbf 100644 (file)
@@ -13,6 +13,7 @@ package org.simantics.sysdyn.ui.project;
 \r
 import java.io.File;\r
 import java.util.HashMap;\r
+import java.util.UUID;\r
 \r
 import org.eclipse.core.runtime.Platform;\r
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;\r
@@ -54,6 +55,7 @@ import org.simantics.project.ontology.ProjectResource;
 import org.simantics.simulation.experiment.IExperiment;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.simulation.project.IExperimentManager;\r
+import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.Activator;\r
 import org.simantics.sysdyn.ui.editor.SysdynEditorNamingService;\r
@@ -104,11 +106,63 @@ public class SysdynProject extends AbstractProjectFeature {
     }\r
 \r
     private final WriteRunnable CREATE_MODEL = new WriteRunnable() {\r
+       \r
+        Resource createSheet(WriteGraph graph, Resource book, String name, String[] colNames, int[] colWidths) throws DatabaseException {\r
+\r
+               Layer0 L0 = Layer0.getInstance(graph);\r
+               SpreadsheetResource sr = SpreadsheetResource.getInstance(graph);\r
+\r
+               Resource result = graph.newResource();\r
+               graph.claim(result, L0.InstanceOf, null, sr.Spreadsheet);\r
+\r
+               if(name == null) {\r
+                       name = NameUtils.findFreshEscapedName(graph, "Sheet", book, sr.HasSheet);\r
+               }\r
+               graph.claimLiteral(result, L0.HasName, L0.NameOf, L0.String, name, Bindings.STRING);\r
+               graph.claim(book, L0.ConsistsOf, L0.PartOf, result);\r
+\r
+               {\r
+                       Resource newCell = graph.newResource();\r
+                       graph.claim(newCell, L0.InstanceOf, null, sr.DimensionsCell);\r
+               graph.claimLiteral(newCell, L0.HasName, L0.NameOf, L0.String, "Dimensions", Bindings.STRING);\r
+                graph.addLiteral(newCell, sr.FitColumns, sr.FitColumnsOf, L0.Boolean, true, Bindings.BOOLEAN);\r
+                graph.addLiteral(newCell, sr.FitRows, sr.FitRowsOf, L0.Boolean, true, Bindings.BOOLEAN);\r
+                       graph.claim(result, L0.ConsistsOf, L0.PartOf, newCell);\r
+               }\r
+\r
+               {\r
+                       Resource newCell = graph.newResource();\r
+               graph.claimLiteral(newCell, L0.HasName, L0.NameOf, L0.String, "Headers", Bindings.STRING);\r
+                       graph.claim(newCell, L0.InstanceOf, null, sr.HeadersCell);\r
+                       graph.addLiteral(newCell, sr.ColumnLabels, sr.ColumnLabelsOf, L0.StringArray, colNames, Bindings.getBindingUnchecked(String[].class));\r
+                       graph.addLiteral(newCell, sr.ColumnWidths, sr.ColumnWidthsOf, L0.IntegerArray, colWidths, Bindings.INT_ARRAY);\r
+                       graph.claim(result, L0.ConsistsOf, L0.PartOf, newCell);\r
+               }\r
+\r
+               {\r
+                       \r
+                       double[] doubles = new double[10*10];\r
+                       for(int i=0;i<10*10;i++) doubles[i] = i;\r
+                       \r
+                       Resource newCell = graph.newResource();\r
+                       graph.claim(newCell, L0.InstanceOf, null, sr.DoubleArrayCell);\r
+                       graph.addLiteral(newCell, sr.DoubleArrayCell_HasWidth, sr.DoubleArrayCell_HasWidth_Inverse, L0.Integer, 10, Bindings.INTEGER);\r
+                       graph.addLiteral(newCell, sr.HasLocation, sr.HasLocation_Inverse, L0.String, "A1", Bindings.STRING);\r
+                       graph.addLiteral(newCell, sr.DoubleArrayCell_HasDoubleArray, sr.DoubleArrayCell_HasDoubleArray_Inverse, L0.DoubleArray, doubles, Bindings.DOUBLE_ARRAY);\r
+                       graph.claim(result, L0.HasChildVariables, L0.HasChildVariables_Inverse, newCell);\r
+                       \r
+               }\r
+               \r
+               return result;\r
+\r
+        }\r
+       \r
         @Override\r
         public void run(WriteGraph g, Resource library, Callback<Resource> callback, Callback<Throwable> errorCallback) {\r
             try {\r
                 Layer0 l0 = Layer0.getInstance(g);\r
                 SysdynResource sr = SysdynResource.getInstance(g);\r
+                SpreadsheetResource SHEET = SpreadsheetResource.getInstance(g);\r
                 ModelingUtils mu = new ModelingUtils(g);\r
 \r
                 String modelName = NameUtils.findFreshName(g, "Model", SimanticsUI.getProject().get(), l0.ConsistsOf, "%s%d");\r
@@ -135,6 +189,15 @@ public class SysdynProject extends AbstractProjectFeature {
 \r
                 g.claim(model, mu.SIMU.HasConfiguration, conf);\r
 \r
+                       Resource book = g.newResource();\r
+                       g.claim(book, l0.InstanceOf, null, SHEET.Book);\r
+                       g.addLiteral(book, l0.HasName, l0.NameOf, l0.String, "Book" + UUID.randomUUID().toString(), Bindings.STRING);\r
+                       g.claim(conf, l0.ConsistsOf, l0.PartOf, book);\r
+                       \r
+                       createSheet(g, book, "Sheet1", new String[] { "ARG" }, new int[] { 50 });\r
+                \r
+                \r
+                \r
                 ModelingResources mr = ModelingResources.getInstance(g);\r
                 // Remove default mapping and add sysdyn mapping\r
                 for(Resource trigger : g.getObjects(diagram, l0.HasTrigger)) {\r
index 1402f225b609a6c103891bc224437f2401639ba5..859e5d7f99127f854e3bd8fc688e1e4dc81007bf 100644 (file)
@@ -29,15 +29,15 @@ public class ConfigurationVariable extends StandardGraphChildVariable {
                super(resource);\r
        }\r
 \r
-       @Override\r
-       public Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException {\r
-               Map<String, Resource> children = graph.syncRequest(new UnescapedChildMapOfResource(resource));\r
-               Resource child = children.get(name);\r
-               if(child == null) {\r
-                       return getPossibleSpecialChild(graph, name);\r
-               }\r
-               else return graph.adaptContextual(child, this, Variable.class, Variable.class);\r
-       }\r
+//     @Override\r
+//     public Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException {\r
+//             Map<String, Resource> children = graph.syncRequest(new UnescapedChildMapOfResource(resource));\r
+//             Resource child = children.get(name);\r
+//             if(child == null) {\r
+//                     return getPossibleSpecialChild(graph, name);\r
+//             }\r
+//             else return graph.adaptContextual(child, this, Variable.class, Variable.class);\r
+//     }\r
 \r
 \r
        @Override\r