]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Almost completely functional model browser defined in sysdynmodelbrowserviewpoint...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 27 Mar 2012 06:23:36 +0000 (06:23 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 27 Mar 2012 06:23:36 +0000 (06:23 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@24540 ac1ea38d-2e2b-0410-8846-a27921b304fc

47 files changed:
org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph
org.simantics.sysdyn.ontology/graph/SysdynModelingViewpoint.pgraph [new file with mode: 0644]
org.simantics.sysdyn.ontology/graph/Sysdyn_ModelBrowser_Viewpoint.pgraph [deleted file]
org.simantics.sysdyn.ontology/graph/WorkModel.pgraph
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ontology/testGraph.tg [new file with mode: 0644]
org.simantics.sysdyn.ui/adapters.xml
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/SysdynModelBrowser.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/ActivateResultDatasetAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewSharedFunctionLibraryAction.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/OpenSheetAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/OpenWorkbookAction.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/FunctionDropAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewBarChartAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewEnumerationAction.java [moved from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewEnumerationAction.java with 69% similarity]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewExperimentAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewFunctionAction.java [moved from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewFunctionAction.java with 68% similarity]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewFunctionLibraryAction.java [moved from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewFunctionLibraryAction.java with 77% similarity]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewHistoryDataAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewLineChartAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewModuleTypeAction.java [moved from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewModuleTypeAction.java with 70% similarity]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewPieChartAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSharedFunctionLibraryAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSheetAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSimulationPlaybackExperimentAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/remove/ModuleTypeRemover.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/ModuleContentChildRule.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/ModuleTypeChildRule.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/VariableChildRule.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/ChartImageRule.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/ResultImageRule.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/VariableImageRule.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/labelrules/VariableNameLabelRule.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodeTypes/ModuleSymbolNodeType.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynEditorNamingService.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/modules/ParameterChildRule.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ValidationUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/HistoryDatasetResult.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/IndependentVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variability.java

index 958e4d0a6dfaaed8d9b53331928b481d2c81d4a0..6dc2005bc56701b57c036f1afdbc3f409ac6465d 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index 74f88326d5b6e8b2a88b65bfdc06ec540592fd55..aa7e10bc8638490e18badf42f5db956f7b20c2a0 100644 (file)
@@ -67,6 +67,7 @@ SYSDYN.SymbolReferences : DIA.SymbolReferenceLibrary
 BasicSymbols = SYSDYN.SymbolReferences.BasicSymbols : DIA.SymbolReferenceLibrary
 
 SYSDYN.Configuration <T STR.Composite <T L0X.Realization
+    @L0.assert L0.HasLabel "Confiugration"
     // TODO [L0.ConsistsOf all (Variable or Dependency or Module)]
 
 SYSDYN.HistoryRealization <T L0X.Realization
@@ -331,9 +332,9 @@ SYSDYN.Center <T SYSDYN.Location
 
 SYSDYN.ValveSymbol <T DIA.FontProvider <T DIA.ColorProvider
     @MOD.defSymbol "Valve" SYSDYN.Valve
-    >-- SYSDYN.ValveSymbol.orientation --> SYSDYN.Orientation <R L0.HasProperty : L0.FunctionalRelation
+    >-- SYSDYN.ValveSymbol.orientation --> SYSDYN.Orientation <R L0.IsWeaklyRelatedTo : L0.FunctionalRelation
     @L0.assert SYSDYN.ValveSymbol.orientation SYSDYN.Horizontal
-    >-- SYSDYN.ValveSymbol.textLocation --> SYSDYN.Location <R L0.HasProperty : L0.FunctionalRelation
+    >-- SYSDYN.ValveSymbol.textLocation --> SYSDYN.Location <R L0.IsWeaklyRelatedTo : L0.FunctionalRelation
     L0.IsDependencyOf BasicSymbols
     STR.IsDefinedBy _ : DIA.Composite <R L0.HasNext 
         @L0.orderedSet 
diff --git a/org.simantics.sysdyn.ontology/graph/SysdynModelingViewpoint.pgraph b/org.simantics.sysdyn.ontology/graph/SysdynModelingViewpoint.pgraph
new file mode 100644 (file)
index 0000000..cc60fd3
--- /dev/null
@@ -0,0 +1,246 @@
+L0 = <http://www.simantics.org/Layer0-1.0>\r
+VP = <http://www.simantics.org/Viewpoint-1.1>\r
+SIMU = <http://www.simantics.org/Simulation-1.0>\r
+PROJECT = <http://www.simantics.org/Project-1.1>\r
+IMAGE = <http://www.simantics.org/Image2-1.1>\r
+ACT = <http://www.simantics.org/Action-1.0>\r
+MOD = <http://www.simantics.org/Modeling-1.1>\r
+STR = <http://www.simantics.org/Structural-1.0>\r
+SYSDYN = <http://www.simantics.org/Sysdyn-1.1>\r
+SILK = <http://www.simantics.org/Silk-1.0>\r
+SHEET = <http://www.simantics.org/Spreadsheet-1.1>\r
+JFREE = <http://www.simantics.org/JFreeChart-1.0>\r
+\r
+\r
+SBC = SYSDYN.ModelingBrowseContext : VP.BrowseContext\r
+SAC = SYSDYN.ModelingActionContext : VP.BrowseContext\r
+    VP.BrowseContext.IsIncludedIn PROJECT.ProjectActionContext\r
+\r
+SBC.VariableNodeType <T VP.NodeType\r
+    @L0.assert VP.HasContentType "Variable"\r
+    \r
+\r
+////////////////////////////////\r
+// From Project Viewpoint\r
+////////////////////////////////\r
+SBC\r
+    @VP.relationChildRule           PROJECT.Project     L0.ConsistsOf   SIMU.Model\r
+\r
+SBC\r
+    VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
+        VP.VisualsContribution.HasNodeType L0.Entity\r
+        VP.VisualsContribution.HasRule VP.ResourceLabelLabelRule\r
+        VP.VisualsContribution.HasRule VP.ResourceNameModifierRule\r
+\r
+SBC\r
+    @VP.constantImageRule           SIMU.Model                      SILK.chart_organisation\r
+\r
+\r
+////////////////////////////////\r
+// From Modeling Viewpoint\r
+////////////////////////////////\r
+MBC = MOD.ModelingBrowseContext\r
+\r
+SBC\r
+    @VP.relationChildRule           MOD.StructuralModel     SIMU.HasConfiguration   MBC.Configuration\r
+\r
+SBC\r
+    @VP.constantLabelRule           MBC.Configuration       "Configuration"\r
+    \r
+SBC\r
+    @VP.constantImageRule           MBC.Configuration       SILK.bricks\r
+    @VP.constantImageRule           STR.Component           SILK.brick\r
+    @VP.constantImageRule           STR.Composite           SILK.bricks\r
+\r
+\r
+////////////////////////////////\r
+// Sysdyn-specific Viewpoint\r
+////////////////////////////////\r
+\r
+SBC.ModuleSymbolNodeType <T VP.NodeType\r
+SBC.ModuleSymbol : SBC.ModuleSymbolNodeType\r
+\r
+BuiltinFunctions = <http://www.simantics.org/Sysdyn-1.1/Built-in Functions>\r
+SBC.BuiltinFunctions : VP.ResourceNodeType\r
+SBC.ModuleTypeChildRule : VP.ChildRule\r
+SBC.ModuleContentChildRule : VP.ChildRule\r
+SBC.VariableChildRule : VP.ChildRule\r
+\r
+SBC\r
+    @VP.relationChildRuleWithFolder SIMU.Model          L0.ConsistsOf   SYSDYN.Experiment\r
+        SBC.ExperimentsFolder : VP.ResourceNodeType\r
+    \r
+    @VP.relationChildRule      SYSDYN.Experiment      SYSDYN.Experiment.result      SYSDYN.Result            \r
+        \r
+    @VP.customChildRule     MBC.Configuration SBC.VariableChildRule\r
+        SBC.Variable : SBC.VariableNodeType\r
+\r
+    @VP.customChildRule     SBC.Variable SBC.VariableChildRule\r
+        SBC.Variable\r
+        \r
+    @VP.relationChildRule    MBC.Configuration    L0.ConsistsOf   SHEET.Book\r
+    @VP.relationChildRule    SHEET.Book           L0.ConsistsOf   SHEET.Spreadsheet    \r
+            \r
+        \r
+    // Function libraries  \r
+    // Functions folder  \r
+    @VP.relationChildRuleWithFolder MOD.StructuralModel L0.ConsistsOf   SYSDYN.SysdynModelicaFunction\r
+        SBC.FunctionsFolder : VP.ResourceNodeType \r
+    @VP.relationChildRule      SBC.FunctionsFolder      L0.ConsistsOf    SYSDYN.SysdynModelicaFunctionLibrary\r
+    \r
+    // Function libraries\r
+    @VP.relationChildRule      SYSDYN.SysdynModelicaFunctionLibrary      L0.ConsistsOf      SYSDYN.SysdynModelicaFunctionLibrary    \r
+    @VP.relationChildRule      SYSDYN.SysdynModelicaFunctionLibrary      L0.ConsistsOf      SYSDYN.SysdynModelicaFunction\r
+    @VP.relationChildRule      SYSDYN.SharedFunctionOntology      L0.ConsistsOf      SYSDYN.SysdynModelicaFunctionLibrary    \r
+    @VP.relationChildRule      SYSDYN.SharedFunctionOntology      L0.ConsistsOf      SYSDYN.SysdynModelicaFunction    \r
+    \r
+    // Built-in functions\r
+    VP.BrowseContext.HasChildContribution _ : VP.ChildContribution\r
+        VP.ChildContribution.HasParentNodeType SBC.FunctionsFolder\r
+        VP.ChildContribution.HasChildNodeType SBC.BuiltinFunctions\r
+        VP.ChildContribution.HasRule _ : VP.ConstantChildRule\r
+            VP.ConstantChildRule.HasChild BuiltinFunctions    \r
+    @VP.relationChildRule      SBC.BuiltinFunctions      L0.ConsistsOf      SYSDYN.SysdynModelicaFunctionLibrary    \r
+    @VP.relationChildRule      SBC.BuiltinFunctions      L0.ConsistsOf      SYSDYN.SysdynModelicaFunction           \r
+     \r
+    // Shared functions linked to a model    \r
+    @VP.relationChildRuleWithFolder SBC.FunctionsFolder   L0.IsLinkedTo  SYSDYN.SharedFunctionOntology \r
+        SBC.SharedFunctionsFolder : VP.ResourceNodeType\r
+        \r
+        \r
+    // Modules  \r
+    @VP.equalContentChildRule  MOD.StructuralModel\r
+        SBC.ModulesFolder : VP.ResourceNodeType \r
+    @VP.customChildRule SBC.ModulesFolder SBC.ModuleTypeChildRule\r
+        SBC.ModuleSymbol\r
+    @VP.customChildRule SBC.ModuleSymbol SBC.ModuleContentChildRule STR.Component     \r
+    \r
+    // Charts\r
+    @VP.relationChildRuleWithFolder MOD.StructuralModel L0.ConsistsOf JFREE.Chart\r
+        SBC.ChartsFolder : VP.ResourceNodeType        \r
+       \r
+// Labels  \r
+SBC.VariableNameLabelRule : VP.LabelRule\r
+SBC.ModuleTypeLabelRule : VP.LabelRule\r
+      \r
+SBC\r
+    @VP.constantLabelRule           SBC.ExperimentsFolder         "Experiments"\r
+    @VP.constantLabelRule           SBC.FunctionsFolder           "Functions"\r
+    @VP.constantLabelRule           SBC.ChartsFolder              "Charts"\r
+    @VP.constantLabelRule           SBC.ModulesFolder             "Modules"\r
+    @VP.constantLabelRule           SBC.SharedFunctionsFolder     "Shared Functions"    \r
+    @VP.constantLabelRule           SHEET.Book                    "Spreadsheets"\r
+    \r
+    @VP.customLabelRule             SIMU.Run                      PROJECT.ProjectBrowseContext.RunLabelRule\r
+    @VP.customLabelRule             SBC.BuiltinFunctions          VP.ResourceNameLabelRule\r
+    @VP.customLabelRule             SBC.ModuleSymbol              SBC.ModuleTypeLabelRule\r
+    @VP.customLabelRule             SBC.Variable                  SBC.VariableNameLabelRule\r
+    @VP.customLabelRule             SHEET.Spreadsheet             VP.ResourceNameLabelRule    \r
+    @VP.customLabelRule             SYSDYN.HistoryDataset         VP.ResourceLabelLabelRule    \r
+    @VP.customLabelRule             JFREE.Chart                   VP.ResourceLabelLabelRule        \r
+    \r
+// Modifiers\r
+SBC\r
+    @VP.customLabelRule             SYSDYN.SysdynModelicaFunction   VP.ResourceNameModifierRule     \r
+    @VP.customLabelRule             SYSDYN.HistoryDataset           VP.ResourceLabelModifierRule   \r
+    @VP.customLabelRule             JFREE.Chart                     VP.ResourceLabelModifierRule  \r
+    @VP.customLabelRule             SBC.FunctionsFolder             VP.NoModifierRule   \r
+    \r
+        \r
+// Decorations\r
+SBC.ActiveLabelDecorationRule : VP.ConstantLabelDecorationRule\r
+    VP.ConstantLabelDecorationRule.HasFormat "%s [ACTIVE]"\r
+    VP.ConstantLabelDecorationRule.HasStyle "B"    \r
+    \r
+        \r
+// Images\r
+SBC.VariableImageRule   : VP.ImageRule\r
+SBC.ChartImageRule      : VP.ImageRule\r
+SBC.ResultImageRule     : VP.ImageRule\r
+\r
+SBC\r
+    @VP.customImageRule             SBC.Variable                    SBC.VariableImageRule\r
+    @VP.customImageRule             JFREE.Chart                     SBC.ChartImageRule\r
+    @VP.customImageRule             SYSDYN.Result                   SBC.ResultImageRule \r
+    \r
+\r
+    @VP.constantImageRule           SBC.ExperimentsFolder           SILK.folder\r
+    @VP.constantImageRule           SBC.FunctionsFolder             SILK.folder\r
+    @VP.constantImageRule           SBC.SharedFunctionsFolder       SILK.folder_link   \r
+    @VP.constantImageRule           SYSDYN.SysdynModelicaFunctionLibrary SILK.folder   \r
+    @VP.constantImageRule           SYSDYN.SysdynModelicaFunction   SILK.brick\r
+    @VP.constantImageRule           SBC.ModulesFolder               SILK.folder   \r
+    @VP.constantImageRule           SBC.ModuleSymbol                SILK.bricks\r
+    @VP.constantImageRule           SBC.BuiltinFunctions            SILK.folder_link\r
+    @VP.constantImageRule           SYSDYN.SharedFunctionOntology   SILK.folder_link\r
+    @VP.constantImageRule           SHEET.Book                      SILK.table_multiple\r
+    @VP.constantImageRule           SHEET.Spreadsheet               SILK.table    \r
+    @VP.constantImageRule           SYSDYN.BasicExperiment          SILK.time    \r
+    @VP.constantImageRule           SYSDYN.PlaybackExperiment       SILK.timeline_marker    \r
+    @VP.constantImageRule           SBC.ChartsFolder                SILK.folder   \r
+    @VP.constantImageRule           SYSDYN.HistoryDataset           SILK.table \r
+\r
+SBC \r
+    // Active experiment \r
+    VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
+        VP.VisualsContribution.HasNodeType SYSDYN.Experiment\r
+        VP.VisualsContribution.HasCondition _ : VP.HasStatementTest\r
+            VP.HasStatementTest.HasRelation SIMU.IsActive\r
+        VP.VisualsContribution.HasRule SBC.ActiveLabelDecorationRule    \r
+     \r
+    // Show result in charts   \r
+    VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
+        VP.VisualsContribution.HasNodeType SYSDYN.Result\r
+        VP.VisualsContribution.HasCondition _ : VP.HasStatementTest\r
+            VP.HasStatementTest.HasRelation SYSDYN.Result.showResult\r
+        VP.VisualsContribution.HasRule SBC.ActiveLabelDecorationRule            \r
+    \r
+    \r
+// Actions \r
+ACTIONS = SAC.Actions : L0.Library   \r
+    \r
+// NEW -Actions    \r
+ACTIONS.NewModuleType                   : ACT.Action\r
+ACTIONS.NewEnumeration                  : ACT.Action\r
+ACTIONS.NewFunction                     : ACT.Action\r
+ACTIONS.NewFunctionLibrary              : ACT.Action\r
+ACTIONS.NewSharedFunctionLibrary        : ACT.Action\r
+ACTIONS.NewExperiment                   : ACT.Action\r
+ACTIONS.NewSimulationPlaybackExperiment : ACT.Action\r
+ACTIONS.NewLineChart                    : ACT.Action\r
+ACTIONS.NewBarChart                     : ACT.Action\r
+ACTIONS.NewPieChart                     : ACT.Action\r
+ACTIONS.NewSheet                        : ACT.Action\r
+ACTIONS.NewHistoryData                  : ACT.Action\r
+    \r
+SAC\r
+    @VP.actionContribution "Module" SBC.ModulesFolder SILK.bricks VP.NewActionCategory ACTIONS.NewModuleType\r
+    @VP.actionContribution "Enumeration" MBC.Configuration SILK.brick VP.NewActionCategory ACTIONS.NewEnumeration\r
+    @VP.actionContribution "Enumeration" SBC.ModuleSymbol SILK.brick VP.NewActionCategory ACTIONS.NewEnumeration\r
+    @VP.actionContribution "Function" SBC.FunctionsFolder SILK.brick VP.NewActionCategory ACTIONS.NewFunction\r
+    @VP.actionContribution "Function" SYSDYN.SysdynModelicaFunctionLibrary SILK.brick VP.NewActionCategory ACTIONS.NewFunction\r
+    @VP.actionContribution "Function" SYSDYN.SharedFunctionOntology SILK.brick VP.NewActionCategory ACTIONS.NewFunction\r
+    @VP.actionContribution "Function Library" SBC.FunctionsFolder SILK.folder VP.NewActionCategory ACTIONS.NewFunctionLibrary\r
+    @VP.actionContribution "Function Library" SYSDYN.SysdynModelicaFunctionLibrary SILK.folder VP.NewActionCategory ACTIONS.NewFunctionLibrary\r
+    @VP.actionContribution "Function Library" SYSDYN.SharedFunctionOntology SILK.folder VP.NewActionCategory ACTIONS.NewFunctionLibrary    \r
+    @VP.actionContribution "Shared Function Library" SBC.SharedFunctionsFolder SILK.folder VP.NewActionCategory ACTIONS.NewSharedFunctionLibrary \r
+    @VP.actionContribution "Experiment" SBC.ExperimentsFolder SILK.time VP.NewActionCategory ACTIONS.NewExperiment\r
+    @VP.actionContribution "Simulation Playback Experiment" SBC.ExperimentsFolder SILK.timeline_marker VP.NewActionCategory ACTIONS.NewSimulationPlaybackExperiment\r
+    @VP.actionContribution "Line Chart" SBC.ChartsFolder SILK.chart_line VP.NewActionCategory ACTIONS.NewLineChart\r
+    @VP.actionContribution "Pie Chart" SBC.ChartsFolder SILK.chart_pie VP.NewActionCategory ACTIONS.NewPieChart\r
+    @VP.actionContribution "Bar Chart" SBC.ChartsFolder SILK.chart_bar VP.NewActionCategory ACTIONS.NewBarChart\r
+    @VP.actionContribution "Sheet" SHEET.Book SILK.table VP.NewActionCategory ACTIONS.NewSheet    \r
+    @VP.actionContribution "History Data" SYSDYN.Experiment SILK.table VP.NewActionCategory ACTIONS.NewHistoryData        \r
+\r
+\r
+// Drop actions\r
+ACTIONS.FunctionDropAction : ACT.DropAction\r
+ACTIONS.ChartDropAction : ACT.DropAction\r
+\r
+SBC\r
+    @VP.dropActionContribution SBC.FunctionsFolder ACTIONS.FunctionDropAction 1.0\r
+    @VP.dropActionContribution SYSDYN.SysdynModelicaFunction ACTIONS.FunctionDropAction 1.0\r
+    @VP.dropActionContribution SYSDYN.SysdynModelicaFunctionLibrary ACTIONS.FunctionDropAction 1.0\r
+    @VP.dropActionContribution SYSDYN.SharedFunctionOntology ACTIONS.FunctionDropAction 1.0    \r
+    @VP.dropActionContribution JFREE.Chart ACTIONS.ChartDropAction 1.0        \r
+\r
diff --git a/org.simantics.sysdyn.ontology/graph/Sysdyn_ModelBrowser_Viewpoint.pgraph b/org.simantics.sysdyn.ontology/graph/Sysdyn_ModelBrowser_Viewpoint.pgraph
deleted file mode 100644 (file)
index 29442e8..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-L0 = <http://www.simantics.org/Layer0-1.0>\r
-VP = <http://www.simantics.org/Viewpoint-1.1>\r
-SIMU = <http://www.simantics.org/Simulation-1.0>\r
-PROJECT = <http://www.simantics.org/Project-1.1>\r
-IMAGE = <http://www.simantics.org/Image2-1.1>\r
-ACT = <http://www.simantics.org/Action-1.0>\r
-MOD = <http://www.simantics.org/Modeling-1.1>\r
-STR = <http://www.simantics.org/Structural-1.0>\r
-SYSDYN = <http://www.simantics.org/Sysdyn-1.1>\r
-SILK = <http://www.simantics.org/Silk-1.0>\r
-\r
-SBC = SYSDYN.ProjectBrowseContext : VP.BrowseContext\r
-SAC = SYSDYN.ProjectActionContext : VP.BrowseContext\r
-\r
-MBC = MOD.ModelingBrowseContext : VP.BrowseContext\r
-    VP.BrowseContext.IsIncludedIn PROJECT.ProjectBrowseContext\r
-MAC = MOD.ModelingActionContext : VP.BrowseContext\r
-    VP.BrowseContext.IsIncludedIn PROJECT.ProjectActionContext\r
-\r
-BuiltinFunctions = <http://www.simantics.org/Sysdyn-1.1/Built-in Functions>\r
-SBC.BuiltinFunctions : VP.ResourceNodeType\r
-SBC.ModuleTypeChildRule : VP.ChildRule\r
-SBC.ModuleContentChildRule : VP.ChildRule\r
-SBC.ModuleTypeLabelRule : VP.LabelRule\r
-\r
-MBC\r
-    @VP.relationChildRuleWithFolder SIMU.Model          L0.ConsistsOf   SIMU.Experiment\r
-        SBC.ExperimentsFolder : VP.ResourceNodeType\r
-    //@VP.relationChildRule           SIMU.Experiment     L0.ConsistsOf   SIMU.Run\r
-    // Function libraries  \r
-    // Functions folder  \r
-    @VP.relationChildRuleWithFolder MOD.StructuralModel L0.ConsistsOf   SYSDYN.SysdynModelicaFunction\r
-        SBC.FunctionsFolder : VP.ResourceNodeType \r
-    @VP.relationChildRule      SBC.FunctionsFolder      L0.ConsistsOf    SYSDYN.SysdynModelicaFunctionLibrary\r
-    // Function libraries\r
-    @VP.relationChildRule      SYSDYN.SysdynModelicaFunctionLibrary      L0.ConsistsOf      SYSDYN.SysdynModelicaFunctionLibrary    \r
-    @VP.relationChildRule      SYSDYN.SysdynModelicaFunctionLibrary      L0.ConsistsOf      SYSDYN.SysdynModelicaFunction\r
-    // Built-in functions\r
-    VP.BrowseContext.HasChildContribution _ : VP.ChildContribution\r
-        VP.ChildContribution.HasParentNodeType SBC.FunctionsFolder\r
-        VP.ChildContribution.HasChildNodeType SBC.BuiltinFunctions\r
-        VP.ChildContribution.HasRule _ : VP.ConstantChildRule\r
-            VP.ConstantChildRule.HasChild BuiltinFunctions    \r
-    @VP.relationChildRule      SBC.BuiltinFunctions      L0.ConsistsOf      SYSDYN.SysdynModelicaFunctionLibrary    \r
-    @VP.relationChildRule      SBC.BuiltinFunctions      L0.ConsistsOf      SYSDYN.SysdynModelicaFunction            \r
-    // Shared functions linked to a model    \r
-    @VP.relationChildRuleWithFolder SBC.FunctionsFolder   L0.IsLinkedTo  SYSDYN.SharedFunctionOntology \r
-        SBC.SharedFunctionsFolder : VP.ResourceNodeType\r
-        \r
-        \r
-    //Modules  \r
-    @VP.equalContentChildRule  MOD.StructuralModel\r
-        SBC.ModulesFolder : VP.ResourceNodeType \r
-    @VP.customChildRule SBC.ModulesFolder SBC.ModuleTypeChildRule\r
-        SBC.ModuleSymbol : VP.ResourceNodeType\r
-    @VP.customChildRule SBC.ModuleSymbol SBC.ModuleContentChildRule STR.Component     \r
-       \r
-       \r
-// Labels        \r
-MBC\r
-    @VP.constantLabelRule           SBC.ExperimentsFolder         "Experiments"\r
-    @VP.customLabelRule             SIMU.Run                      PROJECT.ProjectBrowseContext.RunLabelRule\r
-    @VP.constantLabelRule           SBC.FunctionsFolder           "Functions"\r
-    @VP.constantLabelRule           SBC.SharedFunctionsFolder     "Shared Functions"    \r
-    @VP.constantLabelRule           SBC.ModulesFolder             "Modules"\r
-    @VP.customLabelRule             SBC.BuiltinFunctions          VP.ResourceNameLabelRule\r
-    @VP.customLabelRule             SBC.ModuleSymbol              SBC.ModuleTypeLabelRule\r
-    \r
-    \r
-// Images\r
-MBC\r
-    @VP.constantImageRule           SBC.ExperimentsFolder           PROJECT.ProjectBrowseContext.Images.Folder\r
-    @VP.constantImageRule           SBC.FunctionsFolder             SILK.folder\r
-    @VP.constantImageRule           SBC.SharedFunctionsFolder       SILK.folder    \r
-    @VP.constantImageRule           SYSDYN.SysdynModelicaFunction   SILK.brick\r
-    @VP.constantImageRule           SBC.ModulesFolder               SILK.folder   \r
-    @VP.constantImageRule           SBC.ModuleSymbol                SILK.bricks\r
-    @VP.constantImageRule           SBC.BuiltinFunctions            SILK.folder\r
-    \r
-// Modifiers\r
-MBC\r
-    @VP.customLabelRule             SYSDYN.SysdynModelicaFunction   VP.ResourceNameModifierRule           \r
-    \r
-    \r
-// Actions \r
-ACTIONS = SAC.Actions : L0.Library   \r
-    \r
-// NEW -Actions    \r
-ACTIONS.NewModuleType : ACT.Action\r
-ACTIONS.NewEnumeration : ACT.Action\r
-ACTIONS.NewFunction : ACT.Action\r
-ACTIONS.NewFunctionLibrary : ACT.Action\r
-ACTIONS.NewSharedFunctionLibrary : ACT.Action\r
-ACTIONS.OpenWorkbook : ACT.Action\r
-\r
-    \r
-MAC\r
-    @VP.actionContribution "Module" SBC.ModulesFolder SILK.bricks VP.NewActionCategory ACTIONS.NewModuleType\r
-    VP.BrowseContext.HasActionContribution _ : VP.ActionContribution\r
-      L0.HasLabel "Open Workbook"\r
-      VP.ActionContribution.HasImage SILK.brick\r
-      VP.ActionContribution.HasNodeType MBC.Configuration\r
-      VP.ActionContribution.HasAction ACTIONS.OpenWorkbook\r
-    \r
-    @VP.actionContribution "Enumeration" MBC.Configuration SILK.brick VP.NewActionCategory ACTIONS.NewEnumeration\r
-    //@VP.actionContribution "Open Workbook" MBC.Configuration SILK.brick VP.NewActionCategory ACTIONS.OpenWorkbook\r
-    @VP.actionContribution "Enumeration" SBC.ModuleSymbol SILK.brick VP.NewActionCategory ACTIONS.NewEnumeration\r
-    @VP.actionContribution "Function" SBC.FunctionsFolder SILK.brick VP.NewActionCategory ACTIONS.NewFunction\r
-    @VP.actionContribution "Function" SYSDYN.SysdynModelicaFunctionLibrary SILK.brick VP.NewActionCategory ACTIONS.NewFunction\r
-    @VP.actionContribution "Function" SYSDYN.SharedFunctionOntology SILK.brick VP.NewActionCategory ACTIONS.NewFunction\r
-    @VP.actionContribution "Function Library" SBC.FunctionsFolder SILK.folder VP.NewActionCategory ACTIONS.NewFunctionLibrary\r
-    @VP.actionContribution "Function Library" SYSDYN.SysdynModelicaFunctionLibrary SILK.folder VP.NewActionCategory ACTIONS.NewFunctionLibrary\r
-    @VP.actionContribution "Function Library" SYSDYN.SharedFunctionOntology SILK.folder VP.NewActionCategory ACTIONS.NewFunctionLibrary    \r
-    @VP.actionContribution "Shared Function Library" SBC.SharedFunctionsFolder SILK.folder VP.NewActionCategory ACTIONS.NewSharedFunctionLibrary  
\ No newline at end of file
index aa22c01875bcfbc0217f47242312565a870b55fa..6205b84791a352c0f963994d6aaa78c7ca6cd184 100644 (file)
@@ -17,6 +17,7 @@ WM = <http://Projects/Development Project> : PROJ.Project
     @L0.new\r
 */\r
     \r
+/*    \r
 WM = <http://Projects/Work Model Project> : PROJ.Project\r
     @L0.new\r
 \r
@@ -463,12 +464,7 @@ WMC.f41  : SYSDYN.Flow
 WorkModuleConfigurationDiagram : SYSDYN.ConfigurationDiagram <R L0.HasNext\r
     MOD.DiagramToComposite WMC\r
     DIA.HasLayer WM.Admin\r
-/*\r
-    DIA.HasLayer _ : DIA.Layer\r
-        DIA.IsActive true \r
-        DIA.HasFocusableTag TAGS.AdminIsFocusable\r
-        DIA.HasVisibleTag TAGS.AdminIsVisible\r
-*/\r
+\r
     L0X.HasTrigger _ : SYSDYN.DiagramToCompositeMapping\r
     @L0.orderedSet\r
         WorkCompletionTimeInputElement : SYSDYN.InputSymbol\r
@@ -697,12 +693,7 @@ WFC.f22  : SYSDYN.Flow
 WorkforceModuleConfigurationDiagram : SYSDYN.ConfigurationDiagram <R L0.HasNext\r
     MOD.DiagramToComposite WFC\r
     DIA.HasLayer WM.Admin \r
-/*\r
-  DIA.HasLayer _ : DIA.Layer\r
-//    DIA.IsActive true\r
-    DIA.HasFocusableTag TAGS.AdminIsFocusable\r
-    DIA.HasVisibleTag TAGS.AdminIsVisible\r
-*/\r
+\r
     L0X.HasTrigger _ : SYSDYN.DiagramToCompositeMapping\r
   \r
     @L0.orderedSet\r
@@ -757,3 +748,4 @@ WorkforceModuleConfigurationDiagram : SYSDYN.ConfigurationDiagram <R L0.HasNext
         _ : SYSDYN.FlowConnection\r
             MOD.DiagramConnectionToConnection WFC.f22\r
             @WM.flow c21Element NetResourcesElement        \r
+*/\r
index f24d25d825eeedac0e2f0df6b59fe13ec3e44cc8..f0606538163f824c6c84008268e5d24cbc41122a 100644 (file)
@@ -179,6 +179,42 @@ public class SysdynResource {
     public final Resource LookupExpression_lookup;\r
     public final Resource LookupExpression_lookup_Inverse;\r
     public final Resource ModelBrowser;\r
+    public final Resource ModelingActionContext;\r
+    public final Resource ModelingActionContext_Actions;\r
+    public final Resource ModelingActionContext_Actions_ChartDropAction;\r
+    public final Resource ModelingActionContext_Actions_FunctionDropAction;\r
+    public final Resource ModelingActionContext_Actions_NewBarChart;\r
+    public final Resource ModelingActionContext_Actions_NewEnumeration;\r
+    public final Resource ModelingActionContext_Actions_NewExperiment;\r
+    public final Resource ModelingActionContext_Actions_NewFunction;\r
+    public final Resource ModelingActionContext_Actions_NewFunctionLibrary;\r
+    public final Resource ModelingActionContext_Actions_NewHistoryData;\r
+    public final Resource ModelingActionContext_Actions_NewLineChart;\r
+    public final Resource ModelingActionContext_Actions_NewModuleType;\r
+    public final Resource ModelingActionContext_Actions_NewPieChart;\r
+    public final Resource ModelingActionContext_Actions_NewSharedFunctionLibrary;\r
+    public final Resource ModelingActionContext_Actions_NewSheet;\r
+    public final Resource ModelingActionContext_Actions_NewSimulationPlaybackExperiment;\r
+    public final Resource ModelingBrowseContext;\r
+    public final Resource ModelingBrowseContext_ActiveLabelDecorationRule;\r
+    public final Resource ModelingBrowseContext_BuiltinFunctions;\r
+    public final Resource ModelingBrowseContext_ChartImageRule;\r
+    public final Resource ModelingBrowseContext_ChartsFolder;\r
+    public final Resource ModelingBrowseContext_ExperimentsFolder;\r
+    public final Resource ModelingBrowseContext_FunctionsFolder;\r
+    public final Resource ModelingBrowseContext_ModuleContentChildRule;\r
+    public final Resource ModelingBrowseContext_ModuleSymbol;\r
+    public final Resource ModelingBrowseContext_ModuleSymbolNodeType;\r
+    public final Resource ModelingBrowseContext_ModuleTypeChildRule;\r
+    public final Resource ModelingBrowseContext_ModuleTypeLabelRule;\r
+    public final Resource ModelingBrowseContext_ModulesFolder;\r
+    public final Resource ModelingBrowseContext_ResultImageRule;\r
+    public final Resource ModelingBrowseContext_SharedFunctionsFolder;\r
+    public final Resource ModelingBrowseContext_Variable;\r
+    public final Resource ModelingBrowseContext_VariableChildRule;\r
+    public final Resource ModelingBrowseContext_VariableImageRule;\r
+    public final Resource ModelingBrowseContext_VariableNameLabelRule;\r
+    public final Resource ModelingBrowseContext_VariableNodeType;\r
     public final Resource Module;\r
     public final Resource ModuleSymbol;\r
     public final Resource Module_ParameterOverride;\r
@@ -211,24 +247,6 @@ public class SysdynResource {
     public final Resource Profiles;\r
     public final Resource Profiles_IssueWarnings;\r
     public final Resource Profiles_SimulationPlaybackColours;\r
-    public final Resource ProjectActionContext;\r
-    public final Resource ProjectActionContext_Actions;\r
-    public final Resource ProjectActionContext_Actions_NewEnumeration;\r
-    public final Resource ProjectActionContext_Actions_NewFunction;\r
-    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_ExperimentsFolder;\r
-    public final Resource ProjectBrowseContext_FunctionsFolder;\r
-    public final Resource ProjectBrowseContext_ModuleContentChildRule;\r
-    public final Resource ProjectBrowseContext_ModuleSymbol;\r
-    public final Resource ProjectBrowseContext_ModuleTypeChildRule;\r
-    public final Resource ProjectBrowseContext_ModuleTypeLabelRule;\r
-    public final Resource ProjectBrowseContext_ModulesFolder;\r
-    public final Resource ProjectBrowseContext_SharedFunctionsFolder;\r
     public final Resource Redeclaration;\r
     public final Resource Redeclaration_replacedEnumeration;\r
     public final Resource Redeclaration_replacedEnumeration_Inverse;\r
@@ -311,9 +329,7 @@ public class SysdynResource {
     public final Resource Valve;\r
     public final Resource ValveSymbol;\r
     public final Resource ValveSymbol_orientation;\r
-    public final Resource ValveSymbol_orientation_Inverse;\r
     public final Resource ValveSymbol_textLocation;\r
-    public final Resource ValveSymbol_textLocation_Inverse;\r
     public final Resource Variable;\r
     public final Resource Variable_arrayIndexes;\r
     public final Resource Variable_arrayIndexes_Inverse;\r
@@ -509,6 +525,42 @@ public class SysdynResource {
         public static final String LookupExpression_lookup = "http://www.simantics.org/Sysdyn-1.1/LookupExpression/lookup";\r
         public static final String LookupExpression_lookup_Inverse = "http://www.simantics.org/Sysdyn-1.1/LookupExpression/lookup/Inverse";\r
         public static final String ModelBrowser = "http://www.simantics.org/Sysdyn-1.1/ModelBrowser";\r
+        public static final String ModelingActionContext = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext";\r
+        public static final String ModelingActionContext_Actions = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions";\r
+        public static final String ModelingActionContext_Actions_ChartDropAction = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/ChartDropAction";\r
+        public static final String ModelingActionContext_Actions_FunctionDropAction = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/FunctionDropAction";\r
+        public static final String ModelingActionContext_Actions_NewBarChart = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewBarChart";\r
+        public static final String ModelingActionContext_Actions_NewEnumeration = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewEnumeration";\r
+        public static final String ModelingActionContext_Actions_NewExperiment = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewExperiment";\r
+        public static final String ModelingActionContext_Actions_NewFunction = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewFunction";\r
+        public static final String ModelingActionContext_Actions_NewFunctionLibrary = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewFunctionLibrary";\r
+        public static final String ModelingActionContext_Actions_NewHistoryData = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewHistoryData";\r
+        public static final String ModelingActionContext_Actions_NewLineChart = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewLineChart";\r
+        public static final String ModelingActionContext_Actions_NewModuleType = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewModuleType";\r
+        public static final String ModelingActionContext_Actions_NewPieChart = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewPieChart";\r
+        public static final String ModelingActionContext_Actions_NewSharedFunctionLibrary = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewSharedFunctionLibrary";\r
+        public static final String ModelingActionContext_Actions_NewSheet = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewSheet";\r
+        public static final String ModelingActionContext_Actions_NewSimulationPlaybackExperiment = "http://www.simantics.org/Sysdyn-1.1/ModelingActionContext/Actions/NewSimulationPlaybackExperiment";\r
+        public static final String ModelingBrowseContext = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext";\r
+        public static final String ModelingBrowseContext_ActiveLabelDecorationRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ActiveLabelDecorationRule";\r
+        public static final String ModelingBrowseContext_BuiltinFunctions = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/BuiltinFunctions";\r
+        public static final String ModelingBrowseContext_ChartImageRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ChartImageRule";\r
+        public static final String ModelingBrowseContext_ChartsFolder = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ChartsFolder";\r
+        public static final String ModelingBrowseContext_ExperimentsFolder = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ExperimentsFolder";\r
+        public static final String ModelingBrowseContext_FunctionsFolder = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/FunctionsFolder";\r
+        public static final String ModelingBrowseContext_ModuleContentChildRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ModuleContentChildRule";\r
+        public static final String ModelingBrowseContext_ModuleSymbol = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ModuleSymbol";\r
+        public static final String ModelingBrowseContext_ModuleSymbolNodeType = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ModuleSymbolNodeType";\r
+        public static final String ModelingBrowseContext_ModuleTypeChildRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ModuleTypeChildRule";\r
+        public static final String ModelingBrowseContext_ModuleTypeLabelRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ModuleTypeLabelRule";\r
+        public static final String ModelingBrowseContext_ModulesFolder = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ModulesFolder";\r
+        public static final String ModelingBrowseContext_ResultImageRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/ResultImageRule";\r
+        public static final String ModelingBrowseContext_SharedFunctionsFolder = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/SharedFunctionsFolder";\r
+        public static final String ModelingBrowseContext_Variable = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/Variable";\r
+        public static final String ModelingBrowseContext_VariableChildRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/VariableChildRule";\r
+        public static final String ModelingBrowseContext_VariableImageRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/VariableImageRule";\r
+        public static final String ModelingBrowseContext_VariableNameLabelRule = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/VariableNameLabelRule";\r
+        public static final String ModelingBrowseContext_VariableNodeType = "http://www.simantics.org/Sysdyn-1.1/ModelingBrowseContext/VariableNodeType";\r
         public static final String Module = "http://www.simantics.org/Sysdyn-1.1/Module";\r
         public static final String ModuleSymbol = "http://www.simantics.org/Sysdyn-1.1/ModuleSymbol";\r
         public static final String Module_ParameterOverride = "http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverride";\r
@@ -541,24 +593,6 @@ public class SysdynResource {
         public static final String Profiles = "http://www.simantics.org/Sysdyn-1.1/Profiles";\r
         public static final String Profiles_IssueWarnings = "http://www.simantics.org/Sysdyn-1.1/Profiles/IssueWarnings";\r
         public static final String Profiles_SimulationPlaybackColours = "http://www.simantics.org/Sysdyn-1.1/Profiles/SimulationPlaybackColours";\r
-        public static final String ProjectActionContext = "http://www.simantics.org/Sysdyn-1.1/ProjectActionContext";\r
-        public static final String ProjectActionContext_Actions = "http://www.simantics.org/Sysdyn-1.1/ProjectActionContext/Actions";\r
-        public static final String ProjectActionContext_Actions_NewEnumeration = "http://www.simantics.org/Sysdyn-1.1/ProjectActionContext/Actions/NewEnumeration";\r
-        public static final String ProjectActionContext_Actions_NewFunction = "http://www.simantics.org/Sysdyn-1.1/ProjectActionContext/Actions/NewFunction";\r
-        public static final String ProjectActionContext_Actions_NewFunctionLibrary = "http://www.simantics.org/Sysdyn-1.1/ProjectActionContext/Actions/NewFunctionLibrary";\r
-        public static final String ProjectActionContext_Actions_NewModuleType = "http://www.simantics.org/Sysdyn-1.1/ProjectActionContext/Actions/NewModuleType";\r
-        public static final String ProjectActionContext_Actions_NewSharedFunctionLibrary = "http://www.simantics.org/Sysdyn-1.1/ProjectActionContext/Actions/NewSharedFunctionLibrary";\r
-        public static final String ProjectActionContext_Actions_OpenWorkbook = "http://www.simantics.org/Sysdyn-1.1/ProjectActionContext/Actions/OpenWorkbook";\r
-        public static final String ProjectBrowseContext = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext";\r
-        public static final String ProjectBrowseContext_BuiltinFunctions = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/BuiltinFunctions";\r
-        public static final String ProjectBrowseContext_ExperimentsFolder = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/ExperimentsFolder";\r
-        public static final String ProjectBrowseContext_FunctionsFolder = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/FunctionsFolder";\r
-        public static final String ProjectBrowseContext_ModuleContentChildRule = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/ModuleContentChildRule";\r
-        public static final String ProjectBrowseContext_ModuleSymbol = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/ModuleSymbol";\r
-        public static final String ProjectBrowseContext_ModuleTypeChildRule = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/ModuleTypeChildRule";\r
-        public static final String ProjectBrowseContext_ModuleTypeLabelRule = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/ModuleTypeLabelRule";\r
-        public static final String ProjectBrowseContext_ModulesFolder = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/ModulesFolder";\r
-        public static final String ProjectBrowseContext_SharedFunctionsFolder = "http://www.simantics.org/Sysdyn-1.1/ProjectBrowseContext/SharedFunctionsFolder";\r
         public static final String Redeclaration = "http://www.simantics.org/Sysdyn-1.1/Redeclaration";\r
         public static final String Redeclaration_replacedEnumeration = "http://www.simantics.org/Sysdyn-1.1/Redeclaration/replacedEnumeration";\r
         public static final String Redeclaration_replacedEnumeration_Inverse = "http://www.simantics.org/Sysdyn-1.1/Redeclaration/replacedEnumeration/Inverse";\r
@@ -641,9 +675,7 @@ public class SysdynResource {
         public static final String Valve = "http://www.simantics.org/Sysdyn-1.1/Valve";\r
         public static final String ValveSymbol = "http://www.simantics.org/Sysdyn-1.1/ValveSymbol";\r
         public static final String ValveSymbol_orientation = "http://www.simantics.org/Sysdyn-1.1/ValveSymbol/orientation";\r
-        public static final String ValveSymbol_orientation_Inverse = "http://www.simantics.org/Sysdyn-1.1/ValveSymbol/orientation/Inverse";\r
         public static final String ValveSymbol_textLocation = "http://www.simantics.org/Sysdyn-1.1/ValveSymbol/textLocation";\r
-        public static final String ValveSymbol_textLocation_Inverse = "http://www.simantics.org/Sysdyn-1.1/ValveSymbol/textLocation/Inverse";\r
         public static final String Variable = "http://www.simantics.org/Sysdyn-1.1/Variable";\r
         public static final String Variable_arrayIndexes = "http://www.simantics.org/Sysdyn-1.1/Variable/arrayIndexes";\r
         public static final String Variable_arrayIndexes_Inverse = "http://www.simantics.org/Sysdyn-1.1/Variable/arrayIndexes/Inverse";\r
@@ -849,6 +881,42 @@ public class SysdynResource {
         LookupExpression_lookup = getResourceOrNull(graph, URIs.LookupExpression_lookup);\r
         LookupExpression_lookup_Inverse = getResourceOrNull(graph, URIs.LookupExpression_lookup_Inverse);\r
         ModelBrowser = getResourceOrNull(graph, URIs.ModelBrowser);\r
+        ModelingActionContext = getResourceOrNull(graph, URIs.ModelingActionContext);\r
+        ModelingActionContext_Actions = getResourceOrNull(graph, URIs.ModelingActionContext_Actions);\r
+        ModelingActionContext_Actions_ChartDropAction = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_ChartDropAction);\r
+        ModelingActionContext_Actions_FunctionDropAction = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_FunctionDropAction);\r
+        ModelingActionContext_Actions_NewBarChart = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewBarChart);\r
+        ModelingActionContext_Actions_NewEnumeration = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewEnumeration);\r
+        ModelingActionContext_Actions_NewExperiment = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewExperiment);\r
+        ModelingActionContext_Actions_NewFunction = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewFunction);\r
+        ModelingActionContext_Actions_NewFunctionLibrary = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewFunctionLibrary);\r
+        ModelingActionContext_Actions_NewHistoryData = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewHistoryData);\r
+        ModelingActionContext_Actions_NewLineChart = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewLineChart);\r
+        ModelingActionContext_Actions_NewModuleType = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewModuleType);\r
+        ModelingActionContext_Actions_NewPieChart = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewPieChart);\r
+        ModelingActionContext_Actions_NewSharedFunctionLibrary = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewSharedFunctionLibrary);\r
+        ModelingActionContext_Actions_NewSheet = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewSheet);\r
+        ModelingActionContext_Actions_NewSimulationPlaybackExperiment = getResourceOrNull(graph, URIs.ModelingActionContext_Actions_NewSimulationPlaybackExperiment);\r
+        ModelingBrowseContext = getResourceOrNull(graph, URIs.ModelingBrowseContext);\r
+        ModelingBrowseContext_ActiveLabelDecorationRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_ActiveLabelDecorationRule);\r
+        ModelingBrowseContext_BuiltinFunctions = getResourceOrNull(graph, URIs.ModelingBrowseContext_BuiltinFunctions);\r
+        ModelingBrowseContext_ChartImageRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_ChartImageRule);\r
+        ModelingBrowseContext_ChartsFolder = getResourceOrNull(graph, URIs.ModelingBrowseContext_ChartsFolder);\r
+        ModelingBrowseContext_ExperimentsFolder = getResourceOrNull(graph, URIs.ModelingBrowseContext_ExperimentsFolder);\r
+        ModelingBrowseContext_FunctionsFolder = getResourceOrNull(graph, URIs.ModelingBrowseContext_FunctionsFolder);\r
+        ModelingBrowseContext_ModuleContentChildRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_ModuleContentChildRule);\r
+        ModelingBrowseContext_ModuleSymbol = getResourceOrNull(graph, URIs.ModelingBrowseContext_ModuleSymbol);\r
+        ModelingBrowseContext_ModuleSymbolNodeType = getResourceOrNull(graph, URIs.ModelingBrowseContext_ModuleSymbolNodeType);\r
+        ModelingBrowseContext_ModuleTypeChildRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_ModuleTypeChildRule);\r
+        ModelingBrowseContext_ModuleTypeLabelRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_ModuleTypeLabelRule);\r
+        ModelingBrowseContext_ModulesFolder = getResourceOrNull(graph, URIs.ModelingBrowseContext_ModulesFolder);\r
+        ModelingBrowseContext_ResultImageRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_ResultImageRule);\r
+        ModelingBrowseContext_SharedFunctionsFolder = getResourceOrNull(graph, URIs.ModelingBrowseContext_SharedFunctionsFolder);\r
+        ModelingBrowseContext_Variable = getResourceOrNull(graph, URIs.ModelingBrowseContext_Variable);\r
+        ModelingBrowseContext_VariableChildRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_VariableChildRule);\r
+        ModelingBrowseContext_VariableImageRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_VariableImageRule);\r
+        ModelingBrowseContext_VariableNameLabelRule = getResourceOrNull(graph, URIs.ModelingBrowseContext_VariableNameLabelRule);\r
+        ModelingBrowseContext_VariableNodeType = getResourceOrNull(graph, URIs.ModelingBrowseContext_VariableNodeType);\r
         Module = getResourceOrNull(graph, URIs.Module);\r
         ModuleSymbol = getResourceOrNull(graph, URIs.ModuleSymbol);\r
         Module_ParameterOverride = getResourceOrNull(graph, URIs.Module_ParameterOverride);\r
@@ -881,24 +949,6 @@ public class SysdynResource {
         Profiles = getResourceOrNull(graph, URIs.Profiles);\r
         Profiles_IssueWarnings = getResourceOrNull(graph, URIs.Profiles_IssueWarnings);\r
         Profiles_SimulationPlaybackColours = getResourceOrNull(graph, URIs.Profiles_SimulationPlaybackColours);\r
-        ProjectActionContext = getResourceOrNull(graph, URIs.ProjectActionContext);\r
-        ProjectActionContext_Actions = getResourceOrNull(graph, URIs.ProjectActionContext_Actions);\r
-        ProjectActionContext_Actions_NewEnumeration = getResourceOrNull(graph, URIs.ProjectActionContext_Actions_NewEnumeration);\r
-        ProjectActionContext_Actions_NewFunction = getResourceOrNull(graph, URIs.ProjectActionContext_Actions_NewFunction);\r
-        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_ExperimentsFolder = getResourceOrNull(graph, URIs.ProjectBrowseContext_ExperimentsFolder);\r
-        ProjectBrowseContext_FunctionsFolder = getResourceOrNull(graph, URIs.ProjectBrowseContext_FunctionsFolder);\r
-        ProjectBrowseContext_ModuleContentChildRule = getResourceOrNull(graph, URIs.ProjectBrowseContext_ModuleContentChildRule);\r
-        ProjectBrowseContext_ModuleSymbol = getResourceOrNull(graph, URIs.ProjectBrowseContext_ModuleSymbol);\r
-        ProjectBrowseContext_ModuleTypeChildRule = getResourceOrNull(graph, URIs.ProjectBrowseContext_ModuleTypeChildRule);\r
-        ProjectBrowseContext_ModuleTypeLabelRule = getResourceOrNull(graph, URIs.ProjectBrowseContext_ModuleTypeLabelRule);\r
-        ProjectBrowseContext_ModulesFolder = getResourceOrNull(graph, URIs.ProjectBrowseContext_ModulesFolder);\r
-        ProjectBrowseContext_SharedFunctionsFolder = getResourceOrNull(graph, URIs.ProjectBrowseContext_SharedFunctionsFolder);\r
         Redeclaration = getResourceOrNull(graph, URIs.Redeclaration);\r
         Redeclaration_replacedEnumeration = getResourceOrNull(graph, URIs.Redeclaration_replacedEnumeration);\r
         Redeclaration_replacedEnumeration_Inverse = getResourceOrNull(graph, URIs.Redeclaration_replacedEnumeration_Inverse);\r
@@ -981,9 +1031,7 @@ public class SysdynResource {
         Valve = getResourceOrNull(graph, URIs.Valve);\r
         ValveSymbol = getResourceOrNull(graph, URIs.ValveSymbol);\r
         ValveSymbol_orientation = getResourceOrNull(graph, URIs.ValveSymbol_orientation);\r
-        ValveSymbol_orientation_Inverse = getResourceOrNull(graph, URIs.ValveSymbol_orientation_Inverse);\r
         ValveSymbol_textLocation = getResourceOrNull(graph, URIs.ValveSymbol_textLocation);\r
-        ValveSymbol_textLocation_Inverse = getResourceOrNull(graph, URIs.ValveSymbol_textLocation_Inverse);\r
         Variable = getResourceOrNull(graph, URIs.Variable);\r
         Variable_arrayIndexes = getResourceOrNull(graph, URIs.Variable_arrayIndexes);\r
         Variable_arrayIndexes_Inverse = getResourceOrNull(graph, URIs.Variable_arrayIndexes_Inverse);\r
diff --git a/org.simantics.sysdyn.ontology/testGraph.tg b/org.simantics.sysdyn.ontology/testGraph.tg
new file mode 100644 (file)
index 0000000..f419f04
Binary files /dev/null and b/org.simantics.sysdyn.ontology/testGraph.tg differ
index 1ab6edbfce64a7eebd859e4ace160b631e690a85..5ddb9220afee4760e222ff27f50b133c389851da 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-0.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r     <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-0.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-0.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-0.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-0.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-0.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-0.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-0.0/StockSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r                       class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r                    class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r             <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r                   class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r                        class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.InputFactory" />                       \r       </target>\r      \r       <!-- Additional symbols -->\r    <target interface="org.simantics.diagram.adapter.ElementFactory">\r          <resource uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r            class="org.simantics.sysdyn.ui.elements2.MultilineTextElementFactory" />\r        <type uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r            class="org.simantics.sysdyn.ui.elements2.MultilineTextElementFactory" />         \r    </target>                  \r     \r       <!-- Sysdyn connections -->\r    <target interface="org.simantics.diagram.adapter.ElementFactory">\r              <!-- Edges -->       \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />\r        <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />            \r        <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowConnectionFactory">\r            <graph/>\r        </type>                       \r                       \r               <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-0.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-0.0/HasConnector" />\r   <resource uri="http://www.simantics.org/Diagram-0.0/HasPlainConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>none 0</string>\r       </resource>\r    <resource uri="http://www.simantics.org/Diagram-0.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-0.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisChildRule"/>     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/VariableChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.VariableChildRule"/>  \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesChildRule"/>           \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesChildRule"/>    \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableChildRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableChildRule"/>     \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterChildRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterChildRule"/>               \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/>         \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisLabelRule"/> \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/>         \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/>   \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableLabelRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableLabelRule"/>                \r                \r                     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelDecorationRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/>   \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesLabelDecorationRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/>         \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesLabelDecorationRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/>     \r            \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterLabelRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelRule"/>    \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterLabelDecorationRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelDecorationRule"/>               \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterModifierRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterModifierRule"/>    \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterSorterRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterSorterRule"/>                                      \r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/OpenWorkbook"\r            class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>         \r    \r   <target interface="org.simantics.db.layer0.adapter.DropActionFactory">\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/SeriesDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/AxisDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisDropAction" />            \r            \r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesActionContext/Actions/SeriesDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesActionContext/Actions/SeriesDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />                        \r    </target>     \r  \r  <!-- PROFILES -->\r    <target interface="org.simantics.scenegraph.profile.Style">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/SimulationPlaybackStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.SimulationPlaybackStyle">\r        </resource>\r                <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.IssueDecorationStyle">\r        </resource>\r    </target>\r    \r  <!-- Charts -->\r    <target interface="org.simantics.diagram.adapter.ElementFactory">\r        <resource uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r            class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementFactory" />\r            \r        <type uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r            class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementFactory" />\r    </target>\r                \r    <target interface="org.simantics.diagram.synchronization.graph.ElementWriter">\r        <resource uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r            class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementWriter" />\r    </target>\r                    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IJFreeChart">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/Chart"\r            class="org.simantics.sysdyn.ui.trend.chart.JFreeChart">\r            <graph />\r            <this />\r        </type>\r    </target>  \r    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IDataset">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYDataset"\r            class="org.simantics.sysdyn.ui.trend.chart.XYDataset">\r            <graph />\r            <this />\r        </type>\r        <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryDataset"\r            class="org.simantics.sysdyn.ui.trend.chart.CategoryDataset">\r            <graph />\r            <this />\r        </type>        \r        <type uri="http://www.simantics.org/JFreeChart-1.0/PieDataset"\r            class="org.simantics.sysdyn.ui.trend.chart.PieDataset">\r            <graph />\r            <this />\r        </type>          \r    </target>\r    \r     <target interface="org.simantics.sysdyn.ui.trend.chart.ITitle">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/TextTitle"\r            class="org.simantics.sysdyn.ui.trend.chart.TextTitle">\r            <graph />\r            <this />\r        </type>\r    </target>\r    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IAxis">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r            class="org.simantics.sysdyn.ui.trend.chart.NumberAxis">\r            <graph />\r            <this />\r        </type>\r        <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryAxis"\r            class="org.simantics.sysdyn.ui.trend.chart.CategoryAxis">\r            <graph />\r            <this />\r        </type>        \r    </target>\r       \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IPlot">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYPlot"\r            class="org.simantics.sysdyn.ui.trend.chart.XYPlot">\r            <graph />\r            <this />\r        </type>\r        <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryPlot"\r            class="org.simantics.sysdyn.ui.trend.chart.CategoryPlot">\r            <graph />\r            <this />\r        </type>      \r        <type uri="http://www.simantics.org/JFreeChart-1.0/PiePlot"\r            class="org.simantics.sysdyn.ui.trend.chart.PiePlot">\r            <graph />\r            <this />\r        </type>               \r    </target>\r    \r     <target interface="org.simantics.sysdyn.ui.trend.chart.IRenderer">\r     \r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYLineRenderer"\r            class="org.simantics.sysdyn.ui.trend.chart.XYLineRenderer">\r            <graph />\r            <this />\r        </type>  \r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYAreaRenderer"\r            class="org.simantics.sysdyn.ui.trend.chart.XYAreaRenderer">\r            <graph />\r            <this />\r        </type>        \r                \r        <type uri="http://www.simantics.org/JFreeChart-1.0/BarRenderer"\r            class="org.simantics.sysdyn.ui.trend.chart.BarRenderer">\r            <graph />\r            <this />\r        </type>\r        <type uri="http://www.simantics.org/JFreeChart-1.0/StackedBarRenderer"\r            class="org.simantics.sysdyn.ui.trend.chart.StackedBarRenderer">\r            <graph />\r            <this />\r        </type>        \r    </target>    \r       \r
+<adapters>\r\r   <target interface="org.simantics.db.layer0.adapter.Realization">\r               <type uri="http://www.simantics.org/Sysdyn-0.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r     <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-0.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-0.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-0.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-0.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-0.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-0.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-0.0/StockSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r                       class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r                    class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r             <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r                   class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r                        class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.InputFactory" />                       \r       </target>\r      \r       <!-- Additional symbols -->\r    <target interface="org.simantics.diagram.adapter.ElementFactory">\r          <resource uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r            class="org.simantics.sysdyn.ui.elements2.MultilineTextElementFactory" />\r        <type uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r            class="org.simantics.sysdyn.ui.elements2.MultilineTextElementFactory" />         \r    </target>                  \r     \r       <!-- Sysdyn connections -->\r    <target interface="org.simantics.diagram.adapter.ElementFactory">\r              <!-- Edges -->       \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />\r        <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />            \r        <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowConnectionFactory">\r            <graph/>\r        </type>                       \r                       \r               <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-0.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-0.0/HasConnector" />\r   <resource uri="http://www.simantics.org/Diagram-0.0/HasPlainConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>none 0</string>\r       </resource>\r    <resource uri="http://www.simantics.org/Diagram-0.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-0.0/ModelingBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>              \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.VariableChildRule"/>                  \r              \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisChildRule"/>     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/VariableChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.VariableChildRule"/>  \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesChildRule"/>           \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesChildRule"/>    \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableChildRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableChildRule"/>     \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterChildRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterChildRule"/>               \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableNameLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.VariableNameLabelRule"/>\r\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/VariableImageRule"\r            class="org.simantics.sysdyn.ui.browser.imagerules.VariableImageRule"/>   \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ChartImageRule"\r            class="org.simantics.sysdyn.ui.browser.imagerules.ChartImageRule"/>      \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ResultImageRule"\r            class="org.simantics.sysdyn.ui.browser.imagerules.ResultImageRule"/>                        \r            \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/>         \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisLabelRule"/> \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/>         \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/>   \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableLabelRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableLabelRule"/>                \r                \r                     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelDecorationRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/>   \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesLabelDecorationRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/>         \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesLabelDecorationRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/>     \r            \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterLabelRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelRule"/>    \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterLabelDecorationRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelDecorationRule"/>               \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterModifierRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterModifierRule"/>    \r        <resource uri=" http://www.simantics.org/Sysdyn-1.1/Module/ParameterOverrideBrowseContext/ParameterSorterRule"\r            class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterSorterRule"/>                                      \r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSharedFunctionLibraryAction" />   \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewExperiment"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewExperimentAction" />   \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSimulationPlaybackExperiment"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSimulationPlaybackExperimentAction" />    \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewLineChart"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewLineChartAction" /> \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewBarChart"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewBarChartAction" /> \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewPieChart"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewPieChartAction" />        \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewSheet"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewSheetAction" />       \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/NewHistoryData"\r            class="org.simantics.sysdyn.ui.browser.actions.newActions.NewHistoryDataAction" />                                                                                              \r    </target>         \r    \r   <target interface="org.simantics.db.layer0.adapter.DropActionFactory">\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/FunctionDropAction"\r            class="org.simantics.sysdyn.ui.browser.actions.drop.FunctionDropAction" />\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ModelingActionContext/Actions/ChartDropAction"\r            class="org.simantics.sysdyn.ui.browser.actions.drop.ChartDropAction" />            \r   \r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/SeriesDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/AxisDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisDropAction" />            \r            \r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesActionContext/Actions/SeriesDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesActionContext/Actions/SeriesDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />                        \r    </target>     \r  \r    <target interface="org.simantics.db.layer0.adapter.Remover">\r        <type uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleSymbol"\r            class="org.simantics.sysdyn.ui.browser.actions.remove.ModuleTypeRemover">\r            <graph />\r            <this />\r        </type>\r    </target>\r    \r    \r    <target interface="org.simantics.browsing.ui.model.nodetypes.NodeType">\r        <baseType uri="http://www.simantics.org/Layer0-1.0/Entity" />\r        <type\r            uri="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext/ModuleSymbolNodeType"\r            class="org.simantics.sysdyn.ui.browser.nodeTypes.ModuleSymbolNodeType"\r            constructor="create">\r            <this/>\r        </type>        \r     </target>\r    \r  <!-- PROFILES -->\r    <target interface="org.simantics.scenegraph.profile.Style">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/SimulationPlaybackStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.SimulationPlaybackStyle">\r        </resource>\r                <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.IssueDecorationStyle">\r        </resource>\r    </target>\r    \r  <!-- Charts -->\r    <target interface="org.simantics.diagram.adapter.ElementFactory">\r        <resource uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r            class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementFactory" />\r            \r        <type uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r            class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementFactory" />\r    </target>\r                \r    <target interface="org.simantics.diagram.synchronization.graph.ElementWriter">\r        <resource uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r            class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementWriter" />\r    </target>\r                    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IJFreeChart">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/Chart"\r            class="org.simantics.sysdyn.ui.trend.chart.JFreeChart">\r            <graph />\r            <this />\r        </type>\r    </target>  \r    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IDataset">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYDataset"\r            class="org.simantics.sysdyn.ui.trend.chart.XYDataset">\r            <graph />\r            <this />\r        </type>\r        <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryDataset"\r            class="org.simantics.sysdyn.ui.trend.chart.CategoryDataset">\r            <graph />\r            <this />\r        </type>        \r        <type uri="http://www.simantics.org/JFreeChart-1.0/PieDataset"\r            class="org.simantics.sysdyn.ui.trend.chart.PieDataset">\r            <graph />\r            <this />\r        </type>          \r    </target>\r    \r     <target interface="org.simantics.sysdyn.ui.trend.chart.ITitle">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/TextTitle"\r            class="org.simantics.sysdyn.ui.trend.chart.TextTitle">\r            <graph />\r            <this />\r        </type>\r    </target>\r    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IAxis">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r            class="org.simantics.sysdyn.ui.trend.chart.NumberAxis">\r            <graph />\r            <this />\r        </type>\r        <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryAxis"\r            class="org.simantics.sysdyn.ui.trend.chart.CategoryAxis">\r            <graph />\r            <this />\r        </type>        \r    </target>\r       \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IPlot">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYPlot"\r            class="org.simantics.sysdyn.ui.trend.chart.XYPlot">\r            <graph />\r            <this />\r        </type>\r        <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryPlot"\r            class="org.simantics.sysdyn.ui.trend.chart.CategoryPlot">\r            <graph />\r            <this />\r        </type>      \r        <type uri="http://www.simantics.org/JFreeChart-1.0/PiePlot"\r            class="org.simantics.sysdyn.ui.trend.chart.PiePlot">\r            <graph />\r            <this />\r        </type>               \r    </target>\r    \r     <target interface="org.simantics.sysdyn.ui.trend.chart.IRenderer">\r     \r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYLineRenderer"\r            class="org.simantics.sysdyn.ui.trend.chart.XYLineRenderer">\r            <graph />\r            <this />\r        </type>  \r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYAreaRenderer"\r            class="org.simantics.sysdyn.ui.trend.chart.XYAreaRenderer">\r            <graph />\r            <this />\r        </type>        \r                \r        <type uri="http://www.simantics.org/JFreeChart-1.0/BarRenderer"\r            class="org.simantics.sysdyn.ui.trend.chart.BarRenderer">\r            <graph />\r            <this />\r        </type>\r        <type uri="http://www.simantics.org/JFreeChart-1.0/StackedBarRenderer"\r            class="org.simantics.sysdyn.ui.trend.chart.StackedBarRenderer">\r            <graph />\r            <this />\r        </type>        \r    </target>    \r       \r
 </adapters>
\ No newline at end of file
index 05cd9c9c24d6be3b779ed6df86039f063f6825c6..6a90ec0ea83568fe76f67e2f7619190c3901bff1 100644 (file)
                relationship="left"\r
                relative="org.eclipse.ui.editorss">\r
          </view>\r
-         <view\r
-               id="org.simantics.structural.ui.modelBrowser2"\r
-               minimized="false"\r
-               relationship="stack"\r
-               relative="org.simantics.sysdyn.ui.browser">\r
-         </view>\r
          <view\r
                id="org.simantics.diagram.symbollibrary"\r
                minimized="false"\r
             name="Activate Sysdyn Experiment"\r
             priority="300.0">\r
       </doubleClickAction>\r
+      <doubleClickAction\r
+            class="org.simantics.sysdyn.ui.browser.actions.ActivateResultDatasetAction"\r
+            name="Activate result in charts"\r
+            priority="250.0">\r
+      </doubleClickAction>  \r
+      <doubleClickAction\r
+            class="org.simantics.sysdyn.ui.browser.actions.OpenSheetAction"\r
+            name="Open Spreadsheet"\r
+            priority="220.0">\r
+      </doubleClickAction>\r
       <doubleClickAction\r
             class="org.simantics.sysdyn.ui.actions.ConsumeUnnecessaryEntersAction"\r
             name="Consume unnecessary enters"\r
                class="org.simantics.sysdyn.ui.properties.ResourceSelectionProcessor">\r
          </implementation>\r
       </binding>\r
+      <binding\r
+            browseContext="http://www.simantics.org/Sysdyn-0.0/ModelingBrowseContext">\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.properties.ResourceSelectionProcessor">\r
+         </implementation>\r
+      </binding>\r
    </extension>\r
    <extension\r
          id="product"\r
index 9816a2424d4d877a839fd597a405f940e6d296e6..944fdacd130ac6f64b9ba7038c8f9eb3471ea522 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
  * Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
@@ -29,11 +29,17 @@ import org.simantics.sysdyn.ui.browser.nodes.ModuleNode;
 import org.simantics.sysdyn.ui.editor.SysdynEditorInput;\r
 import org.simantics.ui.DoubleClickEvent;\r
 import org.simantics.ui.IDoubleClickAction;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
 import org.simantics.ui.workbench.ResourceEditorInput2;\r
 import org.simantics.utils.ui.ISelectionUtils;\r
 import org.simantics.utils.ui.action.PriorityAction;\r
 import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
 \r
+/**\r
+ * Open an editor for a module instance. \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
 public class ShowInstantiatedModuleAction implements IDoubleClickAction {\r
 \r
     private static final String EDITOR_ID = "org.simantics.sysdyn.ui.diagramViewer";\r
@@ -42,21 +48,38 @@ public class ShowInstantiatedModuleAction implements IDoubleClickAction {
        public void doubleClickEvent(DoubleClickEvent e) throws DatabaseException {\r
                \r
         ReadGraph g = e.getGraph();\r
+        Layer0 l0 = Layer0.getInstance(g);\r
+        StructuralResource2 sr2 = StructuralResource2.getInstance(g);\r
+\r
+        // Open instance for a module instance, if the resource is adaptable to variable\r
+        Variable variable = AdaptionUtils.adaptToSingle(e.getResource(), Variable.class);\r
+        if(variable != null) {\r
+            String rvi = Variables.getRVI(g, variable);\r
+            if(!rvi.isEmpty())\r
+                rvi = rvi.substring(1);\r
+            Resource model = Variables.getModel(g, variable);\r
+            Resource represents = (Resource)variable.getPropertyValue(g, Variables.REPRESENTS);\r
+            Resource instanceOf = g.getPossibleObject(represents, l0.InstanceOf);\r
+            Resource configuration = g.getPossibleObject(instanceOf, sr2.IsDefinedBy);\r
+            if(configuration != null) {\r
+                addShowModuleAction(e, getResourceEditorInput(g, model, configuration, rvi));\r
+                return;\r
+            }\r
+        }\r
         \r
         if(e.getResource() instanceof IStructuredSelection) {\r
                        Set<BrowserSelection> bss = ISelectionUtils.filterSetSelection(e.getResource(), BrowserSelection.class);\r
                        \r
                        if(!bss.isEmpty()) {\r
-                               Layer0 l0 = Layer0.getInstance(g);\r
+                        // Find varaible from BrowserSelection. (Will be replaced with the Variable adaption above)\r
                                for(BrowserSelection bs : bss) {\r
                                        Resource configuration = (Resource)bs.getAdapter(Resource.class);\r
                                        Resource instanceOf = g.getSingleObject(configuration, l0.InstanceOf);\r
                                        \r
                                        SysdynResource sr = SysdynResource.getInstance(g);\r
-                                       StructuralResource2 sr2 = StructuralResource2.getInstance(g);\r
                                        if(g.isInheritedFrom(instanceOf, sr.Module)) {\r
                                                configuration = g.getSingleObject(instanceOf, sr2.IsDefinedBy);\r
-                                               Variable variable = (Variable) bs.getAdapter(Variable.class);\r
+                                               variable = (Variable) bs.getAdapter(Variable.class);\r
                                                String rvi = Variables.getRVI(g, variable).substring(1);\r
                                                Resource model = Variables.getModel(g, variable);\r
                                                addShowModuleAction(e, getResourceEditorInput(g, model, configuration, rvi));\r
@@ -65,8 +88,6 @@ public class ShowInstantiatedModuleAction implements IDoubleClickAction {
                        } else {\r
                                ModuleNode moduleNode = ISelectionUtils.filterSingleSelection(e.getResource(), ModuleNode.class);\r
                                if(moduleNode != null) {\r
-                                       Layer0 l0 = Layer0.getInstance(g);\r
-                                       StructuralResource2 sr2 = StructuralResource2.getInstance(g);\r
                                        Resource model;\r
                                        String rvi;\r
                                        if(moduleNode.getVariable() != null) {\r
index bf28f1062aea6df786455acae453e81eb74444a7..001158265e80fae42392236b26508d56c69f200a 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.ui.browser;\r
 \r
 import java.util.Arrays;\r
@@ -5,18 +16,23 @@ import java.util.Collections;
 import java.util.HashSet;\r
 import java.util.Set;\r
 \r
-import org.simantics.structural.ui.modelBrowser.ModelBrowser;\r
+import org.simantics.structural.ui.modelBrowser.ModelBrowser2;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.properties.SysdynPropertyPage;\r
 import org.simantics.ui.workbench.IPropertyPage;\r
 \r
-public class SysdynModelBrowser extends ModelBrowser {\r
+/**\r
+ * Model browser for sysdyn models. Content configured in SysdynModelingViewpoint.pgraph\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class SysdynModelBrowser extends ModelBrowser2 {\r
 \r
-    final private Set<String> browseContexts  = new HashSet<String>(Arrays.asList(SysdynResource.URIs.ProjectBrowseContext, "http://www.simantics.org/Operating-1.1/Browser", "http://www.simantics.org/Image-1.0/Browser"));\r
+    final private Set<String> browseContexts  = new HashSet<String>(Arrays.asList(SysdynResource.URIs.ModelingBrowseContext, "http://www.simantics.org/Operating-1.1/Browser", "http://www.simantics.org/Image-1.0/Browser"));\r
 \r
     @Override\r
     protected IPropertyPage getPropertyPage() {\r
-        return new SysdynPropertyPage(getSite(), Collections.singleton(SysdynResource.URIs.ModelBrowser));\r
+        return new SysdynPropertyPage(getSite(), Collections.singleton(SysdynResource.URIs.ModelingBrowseContext));\r
     }\r
 \r
     @Override\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/ActivateResultDatasetAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/ActivateResultDatasetAction.java
new file mode 100644 (file)
index 0000000..8c7e6fb
--- /dev/null
@@ -0,0 +1,60 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.ui.DoubleClickEvent;\r
+import org.simantics.ui.IDoubleClickAction;\r
+import org.simantics.ui.utils.ResourceAdaptionUtils;\r
+\r
+/**\r
+ * Activates a result dataset to be shown in charts and other result visualizations\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class ActivateResultDatasetAction implements IDoubleClickAction {\r
+\r
+    @Override\r
+    public void doubleClickEvent(DoubleClickEvent e) throws DatabaseException {\r
+        final Resource result = ResourceAdaptionUtils.toSingleResource(e.getResource());\r
+        if (result == null)\r
+            return;\r
+\r
+        ReadGraph graph = e.getGraph();\r
+\r
+        if(graph.isInstanceOf(result, SysdynResource.getInstance(graph).Result)) {\r
+\r
+            graph.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                @Override\r
+                public void perform(WriteGraph graph) throws DatabaseException {\r
+                    SysdynResource sr = SysdynResource.getInstance(graph);\r
+                    if(graph.isInstanceOf(result, sr.Result)) {\r
+                        if (graph.hasStatement(result, sr.Result_showResult)) {\r
+                            graph.denyStatement(result, sr.Result_showResult, result);\r
+                        } else {\r
+                            graph.claim(result, sr.Result_showResult, result);\r
+                        }\r
+                    }                \r
+                }\r
+            });\r
+        }\r
+\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewSharedFunctionLibraryAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewSharedFunctionLibraryAction.java
deleted file mode 100644 (file)
index c5bdeba..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.simantics.sysdyn.ui.browser.actions;\r
-\r
-import org.simantics.db.Resource;\r
-\r
-public class NewSharedFunctionLibraryAction extends NewFunctionLibraryAction {\r
-    \r
-    \r
-    @Override\r
-    public Runnable create(Object target) {\r
-        if(!(target instanceof Resource))\r
-            return null;\r
-        final Resource resource = (Resource)target;\r
-\r
-        return new Runnable() {\r
-            @Override\r
-            public void run() {\r
-                createLibrary(resource, true);\r
-            }\r
-        };\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/OpenSheetAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/OpenSheetAction.java
new file mode 100644 (file)
index 0000000..17e37c0
--- /dev/null
@@ -0,0 +1,68 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+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.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
+import org.simantics.ui.DoubleClickEvent;\r
+import org.simantics.ui.IDoubleClickAction;\r
+import org.simantics.ui.utils.ResourceAdaptionUtils;\r
+import org.simantics.ui.workbench.ResourceEditorInput2;\r
+import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
+\r
+/**\r
+ * Opens the selected spreadsheet in a spreadsheet editor \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class OpenSheetAction implements IDoubleClickAction {\r
+\r
+    @Override\r
+    public void doubleClickEvent(DoubleClickEvent e) throws DatabaseException {\r
+        Resource result = ResourceAdaptionUtils.toSingleResource(e.getResource());\r
+        if (result == null)\r
+            return;\r
+        \r
+        ReadGraph graph = e.getGraph();\r
+        SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);\r
+\r
+        final Resource sheet = result;\r
+\r
+        if(graph.isInstanceOf(sheet, SHEET.Spreadsheet)) {\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
+                        WorkbenchUtils.openEditor(EDITOR_ID, new ResourceEditorInput2(EDITOR_ID, sheet, modelURI, RVI));\r
+                    } catch (PartInitException e) {\r
+                        e.printStackTrace();\r
+                    }\r
+                }\r
+            });\r
+\r
+        }\r
+    }\r
+}
\ 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
deleted file mode 100644 (file)
index f233f3a..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-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
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/ChartDropAction.java
new file mode 100644 (file)
index 0000000..19ec974
--- /dev/null
@@ -0,0 +1,180 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.drop;\r
+\r
+import java.util.Iterator;\r
+\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.PossibleObjectWithType;\r
+import org.simantics.db.common.request.SingleObjectWithType;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.utils.ListUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.DropActionFactory;\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.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.trend.chart.ChartUtils;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+/**\r
+ * Action for droppin variables to charts\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class ChartDropAction implements DropActionFactory {\r
+\r
+    @Override\r
+    public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException {\r
+\r
+        final Resource targetChart = AdaptionUtils.adaptToSingle(target, Resource.class);\r
+        if(targetChart == null || source == null || !(source instanceof IStructuredSelection))\r
+            return null;\r
+        \r
+        final IStructuredSelection selection = (IStructuredSelection) source;\r
+\r
+        return new Runnable() {\r
+\r
+            @Override\r
+            public void run() {\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        SysdynResource sr = SysdynResource.getInstance(graph);\r
+                        Layer0 L0 = Layer0.getInstance(graph);\r
+                        JFreeChartResource JFREE = JFreeChartResource.getInstance(graph);\r
+\r
+                        Iterator<?> iterator = selection.iterator();\r
+                        \r
+                        // Run through all selections and add all IndependentVariables and Inputs to the target chart\r
+                        while(iterator.hasNext()) {\r
+\r
+                            Variable variable = AdaptionUtils.adaptToSingle(iterator.next(), Variable.class);\r
+                            if(variable == null)\r
+                                continue;\r
+\r
+                            Resource represents = (Resource)variable.getPropertyValue(graph, Variables.REPRESENTS);\r
+                            if(represents == null || \r
+                                    !(graph.isInstanceOf(represents, sr.IndependentVariable) || \r
+                                            graph.isInstanceOf(represents, sr.Input)))\r
+                                continue;\r
+\r
+                            Resource plot = graph.syncRequest(new PossibleObjectWithType(targetChart, L0.ConsistsOf, JFREE.Plot));\r
+                            if(plot != null) {\r
+                                if(graph.isInstanceOf(plot, JFREE.XYPlot)) {\r
+                                    dropToLineChart(graph, targetChart, variable);\r
+                                } else if(graph.isInstanceOf(plot, JFREE.CategoryPlot)) {\r
+                                    dropToBarChart(graph, targetChart, variable);\r
+                                } else if(graph.isInstanceOf(plot, JFREE.PiePlot)) {\r
+                                    dropToPieChart(graph, targetChart, variable);\r
+                                }\r
+                            }\r
+                        }\r
+\r
+                    }\r
+                });\r
+            }\r
+        };\r
+    }\r
+\r
+\r
+    /**\r
+     * Drop variable to a pie chart\r
+     * @param graph ReadGraph\r
+     * @param pieChart Pie chart resource\r
+     * @param variable Dropped variable\r
+     * @throws DatabaseException\r
+     */\r
+    private void dropToPieChart(WriteGraph graph, Resource pieChart, Variable variable) throws DatabaseException {\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
+        JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+        Resource plot = graph.syncRequest(new SingleObjectWithType(pieChart, l0.ConsistsOf, jfree.Plot));\r
+        if(plot == null)\r
+            return;\r
+\r
+        Resource dataset = graph.syncRequest(new PossibleObjectWithType(plot, l0.ConsistsOf, jfree.Dataset));\r
+\r
+        if(dataset == null)\r
+            return;\r
+\r
+        // Create the series and attach it to the dataset\r
+        String rvi = Variables.getRVI(graph, variable);\r
+        Resource series = ChartUtils.createSeries(graph, dataset, rvi);\r
+        graph.claimLiteral(series, jfree.Series_exploded, false); \r
+    }\r
+\r
+    /**\r
+     * Drop variable to a bar chart\r
+     * @param graph ReadGraph\r
+     * @param barChart Bar chart resource\r
+     * @param variable Dropped variable\r
+     * @throws DatabaseException\r
+     */\r
+    private void dropToBarChart(WriteGraph graph, Resource barChart, Variable variable) throws DatabaseException {\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
+        JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+        Resource plot = graph.syncRequest(new SingleObjectWithType(barChart, l0.ConsistsOf, jfree.Plot));\r
+        if(plot == null)\r
+            return;\r
+\r
+        Resource dataset = graph.syncRequest(new PossibleObjectWithType(plot, l0.ConsistsOf, jfree.Dataset));\r
+\r
+        if(dataset == null)\r
+            return;\r
+\r
+        // Create the series and attach it to the dataset\r
+        String rvi = Variables.getRVI(graph, variable);\r
+        ChartUtils.createSeries(graph, dataset, rvi);\r
+    }\r
+\r
+    /**\r
+     * Drop variable to a line chart\r
+     * @param graph ReadGraph\r
+     * @param lineChart Line chart resource\r
+     * @param variable Dropped variable\r
+     * @throws DatabaseException\r
+     */\r
+    private void dropToLineChart(WriteGraph graph, Resource lineChart, Variable variable) throws DatabaseException {\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
+        JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+        Resource plot = graph.syncRequest(new SingleObjectWithType(lineChart, l0.ConsistsOf, jfree.Plot));\r
+        if(plot == null)\r
+            return;\r
+\r
+        Resource rangeAxis = null;\r
+        Resource dataset = null;\r
+        Resource rangeAxisList = graph.getPossibleObject(plot, jfree.Plot_rangeAxisList);\r
+        if(rangeAxisList == null ||  ListUtils.toList(graph, rangeAxisList).isEmpty()) {\r
+            // No range axis -> Create a new one\r
+            rangeAxis = ChartUtils.createNumberRangeAxis(graph, plot);\r
+            Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
+            dataset = ChartUtils.createXYDataset(graph, plot, domainAxis, rangeAxis);\r
+        } else {\r
+            rangeAxis = ListUtils.toList(graph, rangeAxisList).get(0);\r
+            dataset = graph.getPossibleObject(rangeAxis, jfree.Dataset_mapToRangeAxis_Inverse);\r
+        }\r
+\r
+        // Create the series and attach it to the dataset\r
+        String rvi = Variables.getRVI(graph, variable);\r
+        ChartUtils.createSeries(graph, dataset, rvi);\r
+    }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/FunctionDropAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/drop/FunctionDropAction.java
new file mode 100644 (file)
index 0000000..588ac87
--- /dev/null
@@ -0,0 +1,86 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.drop;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.DropActionFactory;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.manager.FunctionUtils;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+/**\r
+ * Action for moving functions and function libraries in model browser \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class FunctionDropAction implements DropActionFactory {\r
+\r
+    @Override\r
+    public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException {\r
+        Resource t = AdaptionUtils.adaptToSingle(target, Resource.class);\r
+        Resource s = AdaptionUtils.adaptToSingle(source, Resource.class);\r
+\r
+        if(t == null || s == null)\r
+            return null;\r
+\r
+        SysdynResource sr = SysdynResource.getInstance(g);\r
+        Layer0 L0 = Layer0.getInstance(g);\r
+\r
+        // If target is a function, find functions parent to be the drop target\r
+        if(g.isInstanceOf(t, sr.SysdynModelicaFunction))\r
+            t = g.getSingleObject(t, L0.PartOf);\r
+\r
+        final Resource library = t;\r
+        final Resource tobemoved = s;\r
+\r
+        // Libraries and model accept drops\r
+        if(!(g.isInstanceOf(library, sr.SysdynModelicaFunctionLibrary) || \r
+                g.isInstanceOf(library, sr.SysdynModel) ||\r
+                g.isInstanceOf(library, sr.SharedFunctionOntology)))\r
+            return null;\r
+\r
+        // Functions and function libraries can be dropped\r
+        if(!(g.isInstanceOf(tobemoved, sr.SysdynModelicaFunction) || \r
+                g.isInstanceOf(tobemoved, sr.SysdynModelicaFunctionLibrary)))\r
+            return null;\r
+\r
+\r
+        return new Runnable() {\r
+\r
+            @Override\r
+            public void run() {\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        Layer0 L0 = Layer0.getInstance(graph);\r
+                        Resource oldLib = graph.getSingleObject(tobemoved, L0.PartOf);\r
+\r
+                        // Remove dragged entity from its parent and add it to the new parent\r
+                        graph.claim(tobemoved, L0.PartOf, library);\r
+                        graph.deny(tobemoved, L0.PartOf, oldLib);\r
+                        FunctionUtils.updateFunctionFileForLibrary(graph, oldLib);\r
+                        FunctionUtils.updateFunctionFileForLibrary(graph, library);  \r
+                    }\r
+\r
+                });\r
+            }\r
+        };\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewBarChartAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewBarChartAction.java
new file mode 100644 (file)
index 0000000..2e16bce
--- /dev/null
@@ -0,0 +1,111 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
+\r
+import java.util.Collections;\r
+import java.util.UUID;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.utils.ListUtils;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.ActionFactory;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Creates a new bar chart to a model\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewBarChartAction implements ActionFactory{\r
+\r
+    @Override\r
+    public Runnable create(Object target) {\r
+        if(!(target instanceof Resource))\r
+            return null;\r
+        final Resource model = (Resource)target;\r
+\r
+        return new Runnable() {\r
+            @Override\r
+            public void run() {\r
+\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
+                        JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+                        G2DResource g2d = G2DResource.getInstance(graph);\r
+\r
+                        // Chart\r
+                        Resource jfreechart = GraphUtils.create2(graph, jfree.Chart,\r
+                                l0.HasName, "BarChart" + UUID.randomUUID().toString(),\r
+                                l0.HasLabel, NameUtils.findFreshLabel(graph, "Bar Chart", model),\r
+                                l0.PartOf, model,\r
+                                jfree.Chart_visibleBorder, true,\r
+                                jfree.Chart_borderWidth, 3,\r
+                                jfree.Chart_visibleLegend, false\r
+                                );\r
+                        \r
+                        // Border color\r
+                        graph.claimLiteral(jfreechart, jfree.Chart_borderColor, g2d.Color, new float[] {0,0,0,1});\r
+\r
+                        // Title\r
+                        GraphUtils.create2(graph, jfree.TextTitle,\r
+                                l0.HasName, "TextTitle" + UUID.randomUUID().toString(),\r
+                                l0.HasLabel, "Bar Chart Title",\r
+                                jfree.Title_position, jfree.Top,\r
+                                l0.PartOf, jfreechart);\r
+                        \r
+                        // X-axis\r
+                        Resource domainAxis = GraphUtils.create2(graph, jfree.CategoryAxis,\r
+                                l0.HasName, "CategoryAxis" + UUID.randomUUID().toString());\r
+                        \r
+                        // Y-axis\r
+                        Resource rangeAxis = GraphUtils.create2(graph, jfree.NumberAxis,\r
+                                l0.HasName, "NumberAxis" + UUID.randomUUID().toString());\r
+\r
+                        // Renderer\r
+                        Resource renderer = GraphUtils.create2(graph, jfree.BarRenderer);\r
+                        \r
+                        // Dataset \r
+                        Resource dataset = GraphUtils.create2(graph, jfree.CategoryDataset,\r
+                                l0.HasName, "CategoryDataset" + UUID.randomUUID().toString(),\r
+                                jfree.Dataset_mapToDomainAxis, domainAxis,\r
+                                jfree.Dataset_mapToRangeAxis, rangeAxis,\r
+                                jfree.Dataset_seriesList, ListUtils.create(graph, Collections.<Resource>emptyList()),\r
+                                jfree.Dataset_renderer, renderer);\r
+\r
+                        // Plot\r
+                        GraphUtils.create2(graph, jfree.CategoryPlot,\r
+                                l0.HasName, "Category plot" + UUID.randomUUID().toString(),\r
+                                l0.PartOf, jfreechart,\r
+                                jfree.Plot_domainAxis, domainAxis,\r
+                                jfree.Plot_rangeAxis, rangeAxis,\r
+                                jfree.Plot_rangeAxisList, ListUtils.create(graph, Collections.singletonList(rangeAxis)),\r
+                                l0.ConsistsOf, dataset,\r
+                                l0.ConsistsOf, domainAxis,\r
+                                l0.ConsistsOf, rangeAxis);\r
+                    }\r
+\r
+                });\r
+            }\r
+        };\r
+    }\r
+\r
+}\r
similarity index 69%
rename from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewEnumerationAction.java
rename to org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewEnumerationAction.java
index 8984a09bf8e7080c01be5db9d08be2ef779949b2..dc3d4d0d692a8da70d2f0f1b8e7def4824674d31 100644 (file)
@@ -1,4 +1,15 @@
-package org.simantics.sysdyn.ui.browser.actions;\r
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
 \r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -14,6 +25,11 @@ import org.simantics.structural.stubs.StructuralResource2;
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
+/**\r
+ * Creates a new enumeration to a model or module\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
 public class NewEnumerationAction implements ActionFactory{\r
 \r
     @Override\r
@@ -34,13 +50,16 @@ public class NewEnumerationAction implements ActionFactory{
                         SysdynResource sr = SysdynResource.getInstance(g);\r
                         Layer0 l0 = Layer0.getInstance(g);\r
 \r
+                        // Find the configuration from...\r
                         Resource configuration = null;\r
                         if(g.isInstanceOf(resource, sr.Configuration)) {\r
                             configuration = resource;\r
                         } else if(g.isInheritedFrom(resource, sr.ModuleSymbol)) {\r
+                            // Module symbol\r
                             Resource module = g.getPossibleObject(resource,ModelingResources.getInstance(g).SymbolToComponentType);\r
                             configuration = g.getPossibleObject(module, StructuralResource2.getInstance(g).IsDefinedBy);\r
                         } else {\r
+                            // Module instance\r
                             Resource instanceOf = g.getSingleObject(resource, l0.InstanceOf);\r
                             if(g.isInheritedFrom(instanceOf, sr.Module)) {\r
                                 configuration = g.getPossibleObject(instanceOf, StructuralResource2.getInstance(g).IsDefinedBy);\r
@@ -49,14 +68,14 @@ public class NewEnumerationAction implements ActionFactory{
                             }\r
                         }\r
 \r
-                        Resource enumerationIndexes = OrderedSetUtils.create(g, sr.EnumerationIndexes);\r
-\r
+                        // Find unique name\r
                         String name = NameUtils.findFreshName(g, "Enum", configuration, l0.ConsistsOf, "%s%d");\r
-\r
+                        \r
+                        // Create enumeration\r
                         GraphUtils.create2(g, \r
                                 sr.Enumeration,\r
                                 l0.HasName, name,\r
-                                sr.Enumeration_enumerationIndexes, enumerationIndexes,\r
+                                sr.Enumeration_enumerationIndexes, OrderedSetUtils.create(g, sr.EnumerationIndexes),\r
                                 l0.PartOf, configuration);\r
                     }\r
                 });\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewExperimentAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewExperimentAction.java
new file mode 100644 (file)
index 0000000..05f7914
--- /dev/null
@@ -0,0 +1,89 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.ActionFactory;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Creates a new basic experiment\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewExperimentAction implements ActionFactory{\r
+\r
+    @Override\r
+    public Runnable create(Object target) {\r
+        if(!(target instanceof Resource))\r
+            return null;\r
+        final Resource model = (Resource)target;\r
+\r
+        return new Runnable() {\r
+            @Override\r
+            public void run() {\r
+\r
+\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
+                        String name = NameUtils.findFreshName(graph, getNameSuggestion(), model, l0.ConsistsOf, "%s%d");\r
+\r
+                        Resource experiment = GraphUtils.create2(graph, getExperimentType(graph),\r
+                                l0.HasName, name,\r
+                                l0.HasLabel, name,\r
+                                l0.PartOf, model);\r
+                        \r
+                        configureExperiment(graph, experiment);\r
+                    }\r
+                });\r
+            }\r
+        };\r
+    }\r
+\r
+    /**\r
+     * Override to do experiment-specific alterations\r
+     */\r
+    protected void configureExperiment(WriteGraph graph, Resource experiment) throws DatabaseException {\r
+        \r
+    }\r
+    \r
+    /**\r
+     * Get the type of this experiment.\r
+     * \r
+     * @param g ReadGraph\r
+     * @return The type resource of this experiment\r
+     */\r
+    protected Resource getExperimentType(ReadGraph g) {\r
+        return SysdynResource.getInstance(g).BasicExperiment;\r
+    }\r
+    \r
+    /**\r
+     * Returns the suggested name for this experiment.\r
+     * If the name has already been taken, appropriate prefix needs to be added. \r
+     *  \r
+     * @return Suggested name for this experiment. \r
+     */\r
+    protected String getNameSuggestion() {\r
+        return "Experiment";\r
+    }\r
+}\r
similarity index 68%
rename from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewFunctionAction.java
rename to org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewFunctionAction.java
index 506f7bccc9a1e8b82e58512dc3175d83a394ec2d..c4e0b3dc03fd8679206b58bb598fb4c790eadb9c 100644 (file)
@@ -1,4 +1,15 @@
-package org.simantics.sysdyn.ui.browser.actions;\r
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
 \r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -12,6 +23,11 @@ import org.simantics.sysdyn.SysdynResource;
 import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
+/**\r
+ * Creates a new modelica function to a model, function library or shared function library.\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
 public class NewFunctionAction implements ActionFactory{\r
 \r
     @Override\r
@@ -49,7 +65,7 @@ public class NewFunctionAction implements ActionFactory{
                                 sr.SysdynModelicaFunction_modelicaFunctionCode, "",\r
                                 l0.PartOf, library);\r
 \r
-                        FunctionUtils.updateFunctionFileForLibrary(g, library);\r
+                         FunctionUtils.updateFunctionFileForLibrary(g, library);\r
                     }\r
                 });\r
 \r
similarity index 77%
rename from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewFunctionLibraryAction.java
rename to org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewFunctionLibraryAction.java
index 1064e0190807beec3eaa5a355c0a12a07015b711..38670b8c4cca7512f88967793b9f5033f920663d 100644 (file)
@@ -1,4 +1,15 @@
-package org.simantics.sysdyn.ui.browser.actions;\r
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
 \r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -13,6 +24,11 @@ import org.simantics.sysdyn.SysdynResource;
 import org.simantics.sysdyn.manager.FunctionUtils;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
+/**\r
+ * Creates a new function library\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
 public class NewFunctionLibraryAction implements ActionFactory{\r
 \r
     @Override\r
@@ -44,6 +60,7 @@ public class NewFunctionLibraryAction implements ActionFactory{
                 Layer0 l0 = Layer0.getInstance(g);\r
                 SysdynResource sr = SysdynResource.getInstance(g);\r
 \r
+                // Libraries can be created to model, function library and shared function library\r
                 if(!(g.isInstanceOf(libraryLocation, sr.SysdynModel) ||\r
                         g.isInstanceOf(libraryLocation, sr.SysdynModelicaFunctionLibrary) ||\r
                                 g.isInstanceOf(libraryLocation, sr.SharedFunctionOntology)))\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewHistoryDataAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewHistoryDataAction.java
new file mode 100644 (file)
index 0000000..43f0ffa
--- /dev/null
@@ -0,0 +1,69 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
+\r
+import java.util.UUID;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.ActionFactory;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Create a new history data\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewHistoryDataAction implements ActionFactory{\r
+\r
+    @Override\r
+    public Runnable create(Object target) {\r
+        if(!(target instanceof Resource))\r
+            return null;\r
+        final Resource experiment = (Resource)target;\r
+\r
+        return new Runnable() {\r
+            @Override\r
+            public void run() {\r
+\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        SysdynResource sr = SysdynResource.getInstance(graph);\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
+                        if(!graph.isInstanceOf(experiment, sr.Experiment))\r
+                            return; // Not called from an experiment\r
+\r
+                        Resource model = graph.getPossibleObject(experiment, l0.PartOf);\r
+                        // Create the history dataset\r
+                        GraphUtils.create2(graph, \r
+                                sr.HistoryDataset,\r
+                                l0.HasName, "HistoryDataset" + UUID.randomUUID().toString(),\r
+                                l0.HasLabel, NameUtils.findFreshLabel(graph, "History Dataset", experiment),\r
+                                sr.Experiment_result_Inverse, experiment, \r
+                                sr.HistoryDataset_columns, Boolean.TRUE,\r
+                                l0.PartOf, model);\r
+                    }\r
+                });\r
+            }\r
+        };\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewLineChartAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewLineChartAction.java
new file mode 100644 (file)
index 0000000..b21e7fc
--- /dev/null
@@ -0,0 +1,110 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.UUID;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.utils.ListUtils;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.ActionFactory;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Creates a new line chart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewLineChartAction implements ActionFactory{\r
+\r
+    @Override\r
+    public Runnable create(Object target) {\r
+        if(!(target instanceof Resource))\r
+            return null;\r
+        final Resource model = (Resource)target;\r
+\r
+        return new Runnable() {\r
+            @Override\r
+            public void run() {\r
+\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
+                        JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+                        G2DResource g2d = G2DResource.getInstance(graph);\r
+\r
+                        // Chart\r
+                        Resource jfreechart = GraphUtils.create2(graph, jfree.Chart,\r
+                                l0.HasName, "Chart" + UUID.randomUUID().toString(),\r
+                                l0.HasLabel, NameUtils.findFreshLabel(graph, "Chart", model),\r
+                                l0.PartOf, model,\r
+                                jfree.Chart_visibleBorder, true,\r
+                                jfree.Chart_borderWidth, 3);\r
+                        graph.claimLiteral(jfreechart, jfree.Chart_borderColor, g2d.Color, new float[] {0,0,0,1});\r
+\r
+                        // Title\r
+                        GraphUtils.create2(graph, jfree.TextTitle,\r
+                                l0.HasName, "TextTitle" + UUID.randomUUID().toString(),\r
+                                l0.HasLabel, "Chart Title",\r
+                                jfree.Title_position, jfree.Top,\r
+                                l0.PartOf, jfreechart);\r
+\r
+                        // X-axis\r
+                        Resource domainAxis = GraphUtils.create2(graph, jfree.NumberAxis,\r
+                                l0.HasName, "NumberAxis" + UUID.randomUUID().toString());\r
+                        \r
+                        // Y-axis\r
+                        Resource rangeAxis = GraphUtils.create2(graph, jfree.NumberAxis,\r
+                                l0.HasName, "NumberAxis" + UUID.randomUUID().toString(),\r
+                                l0.HasLabel, "Y-axis");\r
+                        \r
+                        // Renderer\r
+                        Resource renderer = GraphUtils.create2(graph, jfree.XYLineRenderer);\r
+\r
+                        // Dataset\r
+                        Resource dataset = GraphUtils.create2(graph, jfree.XYDataset,\r
+                                l0.HasName, "XYDataset" + UUID.randomUUID().toString(),\r
+                                jfree.Dataset_mapToDomainAxis, domainAxis,\r
+                                jfree.Dataset_mapToRangeAxis, rangeAxis,\r
+                                jfree.Dataset_seriesList, ListUtils.create(graph, new ArrayList<Resource>()),\r
+                                jfree.Dataset_renderer, renderer);\r
+\r
+                        // Plot\r
+                        GraphUtils.create2(graph, jfree.XYPlot,\r
+                                l0.HasName, "XYPlot" + UUID.randomUUID().toString(),\r
+                                l0.PartOf, jfreechart,\r
+                                jfree.Plot_domainAxis, domainAxis,\r
+                                jfree.Plot_rangeAxis, rangeAxis,\r
+                                jfree.Plot_rangeAxisList, ListUtils.create(graph, Collections.singletonList(rangeAxis)),\r
+                                l0.ConsistsOf, dataset,\r
+                                l0.ConsistsOf, domainAxis,\r
+                                l0.ConsistsOf, rangeAxis);\r
+                    }\r
+\r
+                });\r
+            }\r
+        };\r
+    }\r
+\r
+\r
+}\r
similarity index 70%
rename from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewModuleTypeAction.java
rename to org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewModuleTypeAction.java
index 0f8234e25cf7f9e1a4651d26bd7f8e05a3d9b7fb..8b400bdeb4603eaa1a523b150de82aa470743f54 100644 (file)
@@ -1,4 +1,15 @@
-package org.simantics.sysdyn.ui.browser.actions;\r
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
 \r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -8,7 +19,6 @@ import org.simantics.db.common.utils.OrderedSetUtils;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.adapter.ActionFactory;\r
 import org.simantics.db.layer0.adapter.Template;\r
-import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.diagram.synchronization.graph.DiagramGraphUtil;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
@@ -19,6 +29,11 @@ import org.simantics.sysdyn.SysdynResource;
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.utils.datastructures.ArrayMap;\r
 \r
+/**\r
+ * Creates a new module type\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
 public class NewModuleTypeAction implements ActionFactory{\r
 \r
     @Override\r
@@ -34,13 +49,11 @@ public class NewModuleTypeAction implements ActionFactory{
                     \r
                     @Override\r
                     public void perform(WriteGraph g) throws DatabaseException {\r
-                        // Same as in SysdynProject.java. Should use the same code, not copy.\r
                         SysdynResource sr = SysdynResource.getInstance(g);\r
                         Layer0 l0 = Layer0.getInstance(g);\r
                         Layer0X L0X = Layer0X.getInstance(g);\r
                         ModelingResources mr = ModelingResources.getInstance(g);\r
                         StructuralResource2 sr2 = StructuralResource2.getInstance(g);\r
-                        DiagramResource dr = DiagramResource.getInstance(g);\r
                         \r
                         String name = NameUtils.findFreshName(g, "ModuleType", model, l0.ConsistsOf, "%s%d");\r
                         \r
@@ -49,6 +62,8 @@ public class NewModuleTypeAction implements ActionFactory{
                         g.claim(moduleType, l0.Inherits, sr.Module);\r
                         g.claim(moduleType, l0.PartOf, model);\r
                         \r
+                        \r
+                        \r
                         Resource configuration = GraphUtils.create2(g, \r
                                 sr.Configuration,\r
                                 l0.HasName, name + "Configuration",\r
@@ -70,6 +85,25 @@ public class NewModuleTypeAction implements ActionFactory{
                                 g.deny(diagram, L0X.HasTrigger, trigger);\r
                             }\r
                         }\r
+                        \r
+                        GraphUtils.create2(g,\r
+                                sr.Validations_Dependencies_MissingDependencyConnectionsIssueSource,\r
+                                L0X.IsActivatedBy, model,\r
+                                l0.PartOf, moduleType\r
+                                );\r
+                        \r
+                        GraphUtils.create2(g,\r
+                                sr.Validations_Dependencies_DependencyConnectionsIssueSource,\r
+                                L0X.IsActivatedBy, model,\r
+                                l0.PartOf, moduleType\r
+                                );\r
+                        \r
+                        GraphUtils.create2(g,\r
+                                sr.Validations_Expressions_ExpressionIssueSource,\r
+                                L0X.IsActivatedBy, model,\r
+                                l0.PartOf, moduleType\r
+                                );\r
+                        \r
                         Resource mapping = g.newResource();\r
                         g.claim(mapping, l0.InstanceOf, null, sr.DiagramToCompositeMapping);\r
                         g.claim(diagram, L0X.HasTrigger, mapping);\r
@@ -83,15 +117,16 @@ public class NewModuleTypeAction implements ActionFactory{
                         \r
                         Resource terminal = g.newResource();\r
                         g.claim(terminal, l0.InstanceOf, sr.SysdynTerminal);\r
-                        DiagramGraphUtil.addConnectionPoint(g, moduleSymbol, terminal, sr.IsHeadOfTerminal);\r
+                        DiagramGraphUtil.addConnectionPoint(g, moduleSymbol, terminal, sr.IsHeadOfTerminal);               \r
                         \r
                         Resource terminal2 = g.newResource();\r
                         g.claim(terminal2, l0.InstanceOf, sr.SysdynTerminal);\r
                         DiagramGraphUtil.addConnectionPoint(g, moduleSymbol, terminal2, sr.IsTailOfTerminal);\r
-                        \r
+                                        \r
                         g.claim(moduleSymbol, sr2.IsDefinedBy, OrderedSetUtils.create(g, sr2.Composite, terminal, terminal2));\r
                     \r
                         \r
+                        \r
                     }\r
                 });\r
             }\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewPieChartAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewPieChartAction.java
new file mode 100644 (file)
index 0000000..1ae83a6
--- /dev/null
@@ -0,0 +1,90 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
+\r
+import java.util.Collections;\r
+import java.util.UUID;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.utils.ListUtils;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.ActionFactory;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Creates a new pie chart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewPieChartAction implements ActionFactory{\r
+\r
+    @Override\r
+    public Runnable create(Object target) {\r
+        if(!(target instanceof Resource))\r
+            return null;\r
+        final Resource model = (Resource)target;\r
+\r
+        return new Runnable() {\r
+            @Override\r
+            public void run() {\r
+\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
+                        JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+                        G2DResource g2d = G2DResource.getInstance(graph);\r
+\r
+                        // Chart\r
+                        Resource jfreechart = GraphUtils.create2(graph, jfree.Chart,\r
+                                l0.HasName, "PieChart" + UUID.randomUUID().toString(),\r
+                                l0.HasLabel, NameUtils.findFreshLabel(graph, "Pie Chart", model),\r
+                                l0.PartOf, model,\r
+                                jfree.Chart_visibleBorder, true,\r
+                                jfree.Chart_borderWidth, 3);\r
+                        graph.claimLiteral(jfreechart, jfree.Chart_borderColor, g2d.Color, new float[] {0,0,0,1});\r
+\r
+                        // Title\r
+                        GraphUtils.create2(graph, jfree.TextTitle,\r
+                                l0.HasName, "TextTitle" + UUID.randomUUID().toString(),\r
+                                l0.HasLabel, "Pie Chart Title",\r
+                                jfree.Title_position, jfree.Top,\r
+                                l0.PartOf, jfreechart);\r
+                        \r
+                        // Dataset\r
+                        Resource dataset = GraphUtils.create2(graph, jfree.PieDataset,\r
+                                l0.HasName, "CategoryDataset" + UUID.randomUUID().toString(),\r
+                                jfree.Dataset_seriesList, ListUtils.create(graph, Collections.<Resource>emptyList())\r
+                                );\r
+\r
+                        // Plot\r
+                        GraphUtils.create2(graph, jfree.PiePlot,\r
+                                l0.HasName, "PiePlot" + UUID.randomUUID().toString(),\r
+                                l0.PartOf, jfreechart,\r
+                                l0.ConsistsOf, dataset\r
+                                );\r
+                    }\r
+\r
+                });\r
+            }\r
+        };\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSharedFunctionLibraryAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSharedFunctionLibraryAction.java
new file mode 100644 (file)
index 0000000..98efd11
--- /dev/null
@@ -0,0 +1,38 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
+\r
+import org.simantics.db.Resource;\r
+\r
+/**\r
+ * Creates a new shared function library\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewSharedFunctionLibraryAction extends NewFunctionLibraryAction {\r
+    \r
+    \r
+    @Override\r
+    public Runnable create(Object target) {\r
+        if(!(target instanceof Resource))\r
+            return null;\r
+        final Resource resource = (Resource)target;\r
+\r
+        return new Runnable() {\r
+            @Override\r
+            public void run() {\r
+                createLibrary(resource, true);\r
+            }\r
+        };\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSheetAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSheetAction.java
new file mode 100644 (file)
index 0000000..418f019
--- /dev/null
@@ -0,0 +1,51 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.ActionFactory;\r
+import org.simantics.sysdyn.ui.utils.SheetUtils;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Creates a new spreadsheet to a book\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewSheetAction implements ActionFactory{\r
+\r
+    @Override\r
+    public Runnable create(Object target) {\r
+        if(!(target instanceof Resource))\r
+            return null;\r
+        final Resource book = (Resource)target;\r
+\r
+        return new Runnable() {\r
+            @Override\r
+            public void run() {\r
+\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        SheetUtils.createSheet(graph, book, null, new String[] {}, new int[] {50});\r
+                    }\r
+                    \r
+                });\r
+            }\r
+        };\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSimulationPlaybackExperimentAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewSimulationPlaybackExperimentAction.java
new file mode 100644 (file)
index 0000000..b0363b9
--- /dev/null
@@ -0,0 +1,55 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.newActions;\r
+\r
+import java.awt.Color;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+/**\r
+ * Creates a new simulation playback experiment\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewSimulationPlaybackExperimentAction extends NewExperimentAction {\r
+    \r
+    protected void configureExperiment(WriteGraph graph, Resource experiment) throws DatabaseException {\r
+        G2DResource g2d = G2DResource.getInstance(graph);\r
+        Resource defaultGradient = GraphUtils.create2(graph, g2d.ColorGradient);\r
+        graph.claim(experiment, g2d.HasColorGradient, defaultGradient);\r
+\r
+        Resource placement = GraphUtils.create2(graph, g2d.ColorPlacement, \r
+                g2d.HasGradientPosition, 0.0);\r
+        graph.claimLiteral(placement, g2d.HasColor, g2d.Color, new Color(0, 62, 133).getColorComponents(new float[4]));\r
+        graph.claim(defaultGradient, g2d.HasColorPlacement, placement);\r
+        \r
+        placement = GraphUtils.create2(graph, g2d.ColorPlacement, \r
+                g2d.HasGradientPosition, 1.0);\r
+        graph.claimLiteral(placement, g2d.HasColor, g2d.Color, new Color(255, 230, 0).getColorComponents(new float[4]));\r
+        graph.claim(defaultGradient, g2d.HasColorPlacement, placement);\r
+    }\r
+\r
+    protected Resource getExperimentType(ReadGraph g) {\r
+        return SysdynResource.getInstance(g).PlaybackExperiment;\r
+    }\r
+\r
+    protected String getNameSuggestion() {\r
+        return "Playback Experiment";\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/remove/ModuleTypeRemover.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/remove/ModuleTypeRemover.java
new file mode 100644 (file)
index 0000000..e21bd81
--- /dev/null
@@ -0,0 +1,47 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions.remove;\r
+\r
+import java.util.Map;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.Remover;\r
+import org.simantics.modeling.ui.modelBrowser.handlers.DeleteNodeHandler;\r
+\r
+/**\r
+ * Remover for module type nodes. Not functioning - {@link DeleteNodeHandler} prevents deleting other than entityNodes\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class ModuleTypeRemover implements Remover {\r
+\r
+    private Resource resource;\r
+    \r
+    public ModuleTypeRemover(ReadGraph graph, Resource resource) {\r
+        this.resource = resource;\r
+    }\r
+    \r
+    @Override\r
+    public String canRemove(ReadGraph graph, Map<Object, Object> aux) throws DatabaseException {\r
+        return null;\r
+    }\r
+\r
+    @Override\r
+    public void remove(WriteGraph graph) throws DatabaseException {\r
+        System.out.println("Delete resource " + resource);\r
+    }\r
+\r
+}\r
index 3bb275577e88092016c7ade8fb0b0598dc6cf7d8..df545e7f6451e945a468682af0180f36c48fd25e 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.ui.browser.childrules;\r
 \r
 import java.util.ArrayList;\r
@@ -12,6 +23,11 @@ import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 \r
+/**\r
+ * Child rule for displaying children of module types in Modules folder\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
 public class ModuleContentChildRule implements ChildRule {\r
 \r
     @Override\r
@@ -32,16 +48,19 @@ public class ModuleContentChildRule implements ChildRule {
 \r
         Resource symbol = (Resource)parent;\r
         \r
+        // Find module component\r
         Resource component = graph.getPossibleObject(symbol,ModelingResources.getInstance(graph).SymbolToComponentType);\r
         \r
         if(component == null)\r
             return children;\r
         \r
+        // Find component configuration\r
         Resource configuration = graph.getSingleObject(component, str.IsDefinedBy);\r
         \r
         if(configuration == null)\r
             return children;\r
         \r
+        // Add all components \r
         children.addAll(graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, str.Component)));\r
         \r
         return children;\r
index 7afcb1b91878be8641d6e7257ba33b0399568c89..111d12c3eda53e99e5f6f26004c5f8d0a5b18f41 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.ui.browser.childrules;\r
 \r
 import java.util.ArrayList;\r
@@ -13,7 +24,11 @@ import org.simantics.modeling.ModelingResources;
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
-\r
+/**\r
+ * Child rule for finding module types defined in a model\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
 public class ModuleTypeChildRule implements ChildRule {\r
 \r
        @Override\r
@@ -38,6 +53,7 @@ public class ModuleTypeChildRule implements ChildRule {
                if(!graph.isInstanceOf(model, SysdynResource.getInstance(graph).SysdynModel))\r
                    return children;\r
                \r
+               // Find all component types that are inherited from SYSDYN.Module\r
         for(Resource r : graph.syncRequest(new ObjectsWithType(model, l0.ConsistsOf, st.ComponentType))) {\r
                if(graph.isInheritedFrom(r, SysdynResource.getInstance(graph).Module)) {\r
                        Resource symbol = graph.getPossibleObject(r,ModelingResources.getInstance(graph).ComponentTypeToSymbol);\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/VariableChildRule.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/childrules/VariableChildRule.java
new file mode 100644 (file)
index 0000000..aaecd2d
--- /dev/null
@@ -0,0 +1,86 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.childrules;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.model.children.ChildRule;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+/**\r
+ * Child rule for building model configuration out of Variable nodes\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class VariableChildRule implements ChildRule {\r
+\r
+    @Override\r
+    public boolean isCompatible(Class<?> contentType) {\r
+        return contentType.equals(Variable.class) || contentType.equals(Resource.class);\r
+    }\r
+\r
+    @Override\r
+    public Collection<?> getChildren(ReadGraph graph, Object parent) throws DatabaseException {\r
+        \r
+        ArrayList<Variable> result = new ArrayList<Variable>();\r
+        \r
+        if (parent == null) {\r
+            return result;\r
+        }\r
+        \r
+        Variable variable = null;\r
+        \r
+        if(parent instanceof Variable) {\r
+            variable = (Variable) parent;\r
+        } else if(parent instanceof Resource) {\r
+            variable = Variables.getVariable(graph, (Resource)parent);\r
+        }\r
+        \r
+        if(variable == null)\r
+            return result;\r
+        \r
+        SysdynResource sr = SysdynResource.getInstance(graph);\r
+        \r
+        ArrayList<Variable> variables = new ArrayList<Variable>();\r
+\r
+        for(Variable child : variable.browseChildren(graph)) {\r
+            Resource represents = (Resource)child.getPropertyValue(graph, Variables.REPRESENTS);\r
+            if(graph.isInstanceOf(represents, sr.IndependentVariable)) {\r
+                variables.add(child);\r
+            } else if (graph.isInstanceOf(represents, sr.Input)) {\r
+                variables.add(child);\r
+            } else if (graph.isInstanceOf(represents, sr.Module)) {\r
+                variables.add(child);\r
+            } else if (graph.isInstanceOf(represents, sr.Enumeration)) {\r
+                variables.add(child);\r
+            }\r
+        }\r
+        \r
+        for (Variable v : variables) {\r
+            result.add(v);\r
+        }\r
+        \r
+        return result;\r
+    }\r
+\r
+    @Override\r
+    public Collection<?> getParents(ReadGraph graph, Object child) throws DatabaseException {\r
+        return null;\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/ChartImageRule.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/ChartImageRule.java
new file mode 100644 (file)
index 0000000..044d9bc
--- /dev/null
@@ -0,0 +1,58 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.imagerules;\r
+\r
+import java.util.Collections;\r
+import java.util.Map;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.model.images.ImageRule;\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.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.ui.Activator;\r
+\r
+public class ChartImageRule implements ImageRule {\r
+\r
+    @Override\r
+    public boolean isCompatible(Class<?> contentType) {\r
+        return Resource.class.equals(contentType);\r
+    }\r
+\r
+    @Override\r
+    public Map<String, ImageDescriptor> getImage(ReadGraph graph, Object content) throws DatabaseException {\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
+        JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+        String image = "icons/chart_line.png";\r
+\r
+        Resource chart = (Resource) content;\r
+\r
+        Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot));\r
+        if(plot != null) {\r
+            if(graph.isInstanceOf(plot, jfree.CategoryPlot)) {\r
+                image = "icons/chart_bar.png";\r
+            } else if(graph.isInstanceOf(plot, jfree.PiePlot)) {\r
+                image = "icons/chart_pie.png";\r
+            }\r
+        }\r
+\r
+        return Collections.singletonMap(ColumnKeys.SINGLE, \r
+                ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource(image))\r
+                );    \r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/ResultImageRule.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/ResultImageRule.java
new file mode 100644 (file)
index 0000000..ed7024e
--- /dev/null
@@ -0,0 +1,46 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.imagerules;\r
+\r
+import java.util.Collections;\r
+import java.util.Map;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.model.images.ImageRule;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.Activator;\r
+\r
+public class ResultImageRule implements ImageRule {\r
+\r
+    @Override\r
+    public boolean isCompatible(Class<?> contentType) {\r
+        return Resource.class.equals(contentType);\r
+    }\r
+\r
+    @Override\r
+    public Map<String, ImageDescriptor> getImage(ReadGraph graph, Object content) throws DatabaseException {\r
+        SysdynResource sr = SysdynResource.getInstance(graph);\r
+        Resource data = (Resource) content;\r
+        \r
+        String image = "icons/chart_bar_blackAndWhite.png";\r
+        if(graph.hasStatement(data, sr.Result_showResult))\r
+            image ="icons/chart_bar.png";\r
+        \r
+        return Collections.singletonMap(ColumnKeys.SINGLE, \r
+                ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource(image))\r
+                );   \r
+    }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/VariableImageRule.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/imagerules/VariableImageRule.java
new file mode 100644 (file)
index 0000000..c35a895
--- /dev/null
@@ -0,0 +1,58 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.imagerules;\r
+\r
+import java.util.Collections;\r
+import java.util.Map;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.model.images.ImageRule;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\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.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.Activator;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+public class VariableImageRule implements ImageRule {\r
+\r
+    @Override\r
+    public boolean isCompatible(Class<?> contentType) {\r
+        return Variable.class.equals(contentType);\r
+    }\r
+\r
+    @Override\r
+    public Map<String, ImageDescriptor> getImage(ReadGraph graph, Object content) throws DatabaseException {\r
+        Variable var = AdaptionUtils.adaptToSingle(content, Variable.class);\r
+\r
+        String image =  "icons/brick.png";\r
+        \r
+        Resource r =  (Resource)var.getPropertyValue(graph, Variables.REPRESENTS);\r
+        if(r != null) {\r
+            Layer0 L0 = Layer0.getInstance(graph);\r
+            SysdynResource sr = SysdynResource.getInstance(graph);\r
+            Resource type = graph.getSingleObject(r, L0.InstanceOf);\r
+            if(graph.isInheritedFrom(type, sr.Module)) {\r
+                image = "icons/bricks.png";\r
+            }\r
+        }\r
+\r
+        return Collections.singletonMap(ColumnKeys.SINGLE, \r
+                ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource(image))\r
+                );\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/labelrules/VariableNameLabelRule.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/labelrules/VariableNameLabelRule.java
new file mode 100644 (file)
index 0000000..03def7f
--- /dev/null
@@ -0,0 +1,40 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.labelrules;\r
+\r
+import java.util.Collections;\r
+import java.util.Map;\r
+\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.model.labels.LabelRule;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+public class VariableNameLabelRule  implements LabelRule {\r
+    public static final ModuleTypeLabelRule INSTANCE = new ModuleTypeLabelRule();\r
+\r
+    @Override\r
+    public boolean isCompatible(Class<?> contentType) {\r
+        return contentType.equals(Variable.class);\r
+    }\r
+\r
+    @Override\r
+    public Map<String, String> getLabel(ReadGraph graph, Object content) throws DatabaseException {\r
+        Variable var = AdaptionUtils.adaptToSingle(content, Variable.class);\r
+        return Collections.singletonMap(ColumnKeys.SINGLE, \r
+                var != null ? var.getName(graph) : "No variable"\r
+                );\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodeTypes/ModuleSymbolNodeType.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodeTypes/ModuleSymbolNodeType.java
new file mode 100644 (file)
index 0000000..3ab81f1
--- /dev/null
@@ -0,0 +1,108 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.nodeTypes;\r
+\r
+import java.util.Collection;\r
+import java.util.Collections;\r
+import java.util.WeakHashMap;\r
+\r
+import org.simantics.browsing.ui.NodeContext;\r
+import org.simantics.browsing.ui.common.NodeContextBuilder;\r
+import org.simantics.browsing.ui.model.nodetypes.NodeType;\r
+import org.simantics.browsing.ui.model.nodetypes.SpecialNodeType;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+\r
+/**\r
+ * Experimental node type for Module symbols. Copied mostly from {@link SpecialNodeType}. \r
+ * Not necessary needed.\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class ModuleSymbolNodeType implements NodeType {\r
+    \r
+    private Resource resource;\r
+    private Class<?> contentType;\r
+    \r
+    private static final WeakHashMap<Resource, ModuleSymbolNodeType> nodeTypeCache =\r
+            new WeakHashMap<Resource, ModuleSymbolNodeType>();\r
+\r
+    public ModuleSymbolNodeType(Resource resource) {\r
+        this.resource = resource;\r
+        this.contentType = Resource.class;\r
+    }\r
+    \r
+    public static ModuleSymbolNodeType  create(Resource entityType) {\r
+        synchronized(nodeTypeCache) {\r
+            ModuleSymbolNodeType result = nodeTypeCache.get(entityType);\r
+            if(result == null) {\r
+                result = new ModuleSymbolNodeType(entityType);\r
+                nodeTypeCache.put(entityType, result);\r
+            }\r
+            return result;\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public NodeContext createNodeContext(ReadGraph graph, Object content)\r
+            throws DatabaseException {\r
+        if(contentType.isInstance(content))\r
+            return NodeContextBuilder.buildWithData(KEY_SEQUENCE,\r
+                    new Object[] {content, this}\r
+            );\r
+        else\r
+            return null;\r
+    }\r
+\r
+    @Override\r
+    public Class<?> getContentType() {\r
+        return contentType;\r
+    }\r
+\r
+    @Override\r
+    public int hashCode() {\r
+        return resource.hashCode();\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (this == obj)\r
+            return true;\r
+        if (obj == null)\r
+            return false;\r
+        if (getClass() != obj.getClass())\r
+            return false;\r
+        ModuleSymbolNodeType other = (ModuleSymbolNodeType) obj;\r
+        return resource.equals(other.resource);\r
+    }\r
+\r
+    @Override\r
+    public boolean inherits(ReadGraph graph, NodeType superType) {\r
+        // Special node type does not support inheritance\r
+        return equals(superType);\r
+    }\r
+\r
+    @Override\r
+    public Collection<NodeType> getSuper(ReadGraph g) {\r
+        return Collections.emptyList();\r
+    }\r
+    \r
+    @Override\r
+    public String toString(ReadGraph graph) throws DatabaseException {\r
+        return "(" + NameUtils.getSafeName(graph, resource) + ")";\r
+    }\r
+    \r
+\r
+}\r
index 261d04db424913c9d6a2c47fc3b24b20420da360..ca386d6b2ee001bb3081aef9a8d7170fdf11ab7e 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
  * Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
@@ -27,7 +27,7 @@ import org.simantics.ui.workbench.IResourceEditorInput2;
  * If the viewer shows an instantiated module, the service provides a name of type: "instanceName : instanceOf".\r
  * Otherwise works as standard EditorNamingService2.\r
  * \r
- * @author TLTEEMU\r
+ * @author Teemu Lempinen\r
  *\r
  */\r
 public class SysdynEditorNamingService extends EditorNamingService2 {\r
@@ -37,8 +37,9 @@ public class SysdynEditorNamingService extends EditorNamingService2 {
         if(in instanceof IResourceEditorInput2) {\r
                 IResourceEditorInput2 input = (IResourceEditorInput2) in;\r
                 \r
+             Resource model = g.getPossibleResource(input.getModelURI());\r
+\r
                 if(!input.getRVI().isEmpty()) {\r
-                        Resource model = g.getPossibleResource(input.getModelURI());\r
                         if(model != null) {\r
                                 Resource configuration = g.getPossibleObject(model, SimulationResource.getInstance(g).HasConfiguration);\r
                                 String configurationName = NameUtils.getSafeName(g, configuration);\r
@@ -54,6 +55,8 @@ public class SysdynEditorNamingService extends EditorNamingService2 {
                         }\r
                         }\r
 \r
+                } else {\r
+                    return NameUtils.getSafeLabel(g, model);\r
                 }\r
         }\r
         return super.getName(g, editorId, in);\r
index d871355adbaa327640495e7c62a50a2823b448ad..b3bc6d9f46804902664c48fdd276cd98db5c578e 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
  * Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
@@ -99,7 +99,7 @@ public class SysdynProject extends AbstractProjectFeature {
         }\r
     }\r
 \r
\r
+\r
 \r
     ModelManager mm;\r
 \r
@@ -193,8 +193,8 @@ public class SysdynProject extends AbstractProjectFeature {
                 ErrorLogger.defaultLogError(e);\r
             }\r
         }\r
-        \r
-        \r
+\r
+\r
         // Issues\r
         try {\r
             session.syncRequest(new ReadRequest() {\r
@@ -233,8 +233,10 @@ public class SysdynProject extends AbstractProjectFeature {
                             for(Resource experiment : graph.getObjects(model, l0.ConsistsOf)) {\r
                                 if(graph.isInstanceOf(experiment, SIMU.Experiment)) {\r
                                     for(Resource result : graph.getObjects(experiment, sr.Experiment_result)) {\r
-                                        String resultFile = (String)graph.getPossibleRelatedValue(result, sr.Result_resultFile);\r
-                                        if(result != null) resultPaths.put(resultFile, result);\r
+                                        if(!graph.isInstanceOf(result, sr.HistoryDataset)) {\r
+                                            String resultFile = (String)graph.getPossibleRelatedValue(result, sr.Result_resultFile);\r
+                                            if(result != null) resultPaths.put(resultFile, result);\r
+                                        }\r
                                     }\r
                                 }\r
                             }\r
@@ -279,9 +281,9 @@ public class SysdynProject extends AbstractProjectFeature {
             }\r
         }\r
     }\r
-    \r
+\r
     public void onActivated(final ReadGraph graph, final IProject project) throws DatabaseException {\r
-        \r
+\r
         GraphChangeListenerSupport changeSupport = graph.getService(GraphChangeListenerSupport.class);\r
         changeSupport.addMetadataListener(new GenericChangeListener<DependencyChangesRequest, DependencyChanges>() {\r
 \r
@@ -294,9 +296,9 @@ public class SysdynProject extends AbstractProjectFeature {
             }\r
 \r
         });\r
-        \r
+\r
         IssueUtils.listenActiveProjectIssueSources(graph, project.get());\r
-        \r
+\r
     }\r
 \r
 }\r
index aa8bc2a1f4ae28efa6c87fa63cdf29d75ae93966..dab187f9a48c125509070fcde44ad02cc7bbc4e6 100644 (file)
@@ -17,6 +17,9 @@ import java.util.Collections;
 import java.util.List;\r
 \r
 import org.eclipse.jface.viewers.ISelection;\r
+import org.simantics.browsing.ui.NodeContext;\r
+import org.simantics.browsing.ui.model.nodetypes.NodeType;\r
+import org.simantics.browsing.ui.model.nodetypes.SpecialNodeType;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
@@ -24,6 +27,8 @@ import org.simantics.db.common.utils.OrderedSetUtils;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;\r
 import org.simantics.db.exception.ServiceException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
@@ -51,6 +56,8 @@ import org.simantics.ui.utils.AdaptionUtils;
  */\r
 public class ResourceSelectionProcessor implements SelectionProcessor<Object, ReadGraph>  {\r
 \r
+    private SpecialNodeType sharedFunctionsTestNode;\r
+\r
     @Override\r
     public Collection<?> process(Object selection, ReadGraph backend) {\r
         Collection<ComparableTabContributor> tabs = new ArrayList<ComparableTabContributor>();\r
@@ -60,6 +67,10 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
         SimulationResource simu = SimulationResource.getInstance(backend);\r
         JFreeChartResource jfree = JFreeChartResource.getInstance(backend);\r
 \r
+        // Test nodes\r
+        if(sharedFunctionsTestNode == null)\r
+            sharedFunctionsTestNode = new SpecialNodeType(sr.ModelingBrowseContext_SharedFunctionsFolder, Resource.class);\r
+\r
         try {\r
             // Many elements \r
             if (selection instanceof ArrayList<?> && ((ArrayList<?>) selection).size() > 1) {\r
@@ -84,9 +95,13 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
                 return tabs;\r
             }\r
 \r
-\r
             // Single element\r
             Resource r = AdaptionUtils.adaptToSingle(selection, Resource.class);\r
+            if(r == null) {\r
+                // Selection is not directly a resource, try if it is a variable \r
+                Variable var = AdaptionUtils.adaptToSingle(selection, Variable.class);\r
+                r = (Resource)var.getPropertyValue(backend, Variables.REPRESENTS);\r
+            }\r
 \r
             if(r == null) {\r
                 // SharedFunctionsFolder has properties but no adapted resource\r
@@ -102,6 +117,18 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
                 return Collections.emptyList();\r
             }\r
 \r
+            NodeContext nc = AdaptionUtils.adaptToSingle(selection, NodeContext.class);\r
+            if(nc != null) {\r
+                NodeType type = nc.getConstant(NodeType.TYPE);\r
+                if(type.equals(sharedFunctionsTestNode)) {\r
+                    return Collections.singleton(new ComparableTabContributor(\r
+                            new SharedFunctionLibrariesTab(),\r
+                            2,\r
+                            r,\r
+                            "Shared Functions"));\r
+                }\r
+            }\r
+\r
             // if r == diagram element, change it to component\r
             if (backend.isInstanceOf(r, dr.Element)) {\r
                 Resource component = backend.getPossibleObject(r, mr.ElementToComponent);\r
@@ -258,7 +285,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
                                 0,\r
                                 r,\r
                                 "History Data Properties"));\r
-            \r
+\r
             // Saved simulation result\r
             if (backend.isInstanceOf(r, sr.Result))\r
                 return Collections.singleton(\r
@@ -379,7 +406,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
                                 r,\r
                                 "Variables"));\r
                     }\r
-                    \r
+\r
                     tabs.add(new ComparableTabContributor(\r
                             new ChartTab(),\r
                             1,\r
@@ -389,7 +416,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
 \r
                 } \r
             }\r
-            \r
+\r
             // Default experiment\r
             if (backend.isInstanceOf(r, sr.AdditionalSymbols_MultilineText))\r
                 return Collections.singleton(\r
index 08a45e84c6a61f90d818d98a5d58c7aad85110ec..3b270819f4054938eae9a1cfca2bb612657e2b7d 100644 (file)
@@ -54,7 +54,7 @@ public class ParameterChildRule implements ChildRule {
         SysdynModel model = sdm.getModel(graph, configuration);\r
         \r
         Resource varConfRes = graph.getSingleObject(moduleInstance, L0.PartOf);\r
-        Configuration varConf = sdm.getModel(varConfRes).getConfiguration();\r
+        Configuration varConf = sdm.getModel(graph, varConfRes).getConfiguration();\r
         \r
         for(Resource variable : graph.syncRequest(new ObjectsWithType(configuration, L0.ConsistsOf, sr.IndependentVariable))) {\r
             IElement element = model.getElement(variable);\r
index 88dbac818b6849a58270c5ff3fe5a9dfc231ebde..ed094c182959b334e64bddb14581f7651c23e10b 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
  * Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
@@ -119,6 +119,7 @@ public class DependencyFunction {
 \r
         ArrayList<Issue> result = new ArrayList<Issue>();\r
 \r
+        boolean isStock = isStock(graph, component);\r
         StandardIssue noSuchVariableIssue = null;\r
         // Check that all references have corresponding arrows\r
         if (references != null && dependencies != null) {\r
@@ -126,7 +127,12 @@ public class DependencyFunction {
                 if (!dependencies.contains(reference)) {\r
                     Resource variable = null;\r
                     if ((variable = ValidationUtils.reach(graph, component, reference)) != null) {\r
-                        result.add(new StandardIssue(sr.Validations_MissingLinkIssue, component, variable));\r
+                        if(isStock) {\r
+                            /* Stocks do not get incoming dependencies. They are allowed\r
+                            to have references without arrows */\r
+                        } else {\r
+                            result.add(new StandardIssue(sr.Validations_MissingLinkIssue, component, variable));\r
+                        }\r
                     } else {\r
                         if (noSuchVariableIssue == null) {\r
                             noSuchVariableIssue = new StandardIssue(sr.Validations_NoSuchVariableIssue, component);\r
@@ -140,6 +146,19 @@ public class DependencyFunction {
         return result;\r
 \r
     }\r
+    \r
+    private static boolean isStock(ReadGraph graph, Resource variable) throws DatabaseException {\r
+        List<Resource> expressionList = ValidationUtils.getExpressions(graph, variable);\r
+        if(expressionList == null || expressionList.isEmpty()) {\r
+            return false;\r
+        } else {\r
+            for(Resource expression : expressionList) {\r
+                if(!graph.isInstanceOf(expression, SysdynResource.getInstance(graph).StockExpression))\r
+                    return false;\r
+            }\r
+            return true;\r
+        }\r
+    }\r
 \r
     /**\r
      * Missing link description\r
index 3826bbc9e21bcc8159fbaa6eca2749bad22e6e58..e6fa77b63434a27c7b9c590265b47d6688561b85 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
  * Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
@@ -92,7 +92,7 @@ public class ValidationUtils {
      * @return List of expression (resources)\r
      * @throws DatabaseException\r
      */\r
-    private static List<Resource> getExpressions(ReadGraph graph, Resource r) throws DatabaseException {\r
+    public static List<Resource> getExpressions(ReadGraph graph, Resource r) throws DatabaseException {\r
         SysdynResource sr = SysdynResource.getInstance(graph);\r
         Resource hasExpressions = graph.getPossibleObject(r, sr.Variable_expressions);\r
         if(hasExpressions != null)\r
index 21ed8b0bba06a4ba41a483a2dd8da24d3151881e..9b0d515c1602ec66670c3be8a0ac87a2f9d7bef3 100644 (file)
@@ -239,7 +239,8 @@ public class HistoryDatasetResult extends SimulationResult {
                 // Update result set and send message to model that results have been changed\r
                 HistoryDatasetResult.this.variables = result.second;\r
                 sysdynResult.setResult(HistoryDatasetResult.this);\r
-                result.first.resultChanged();\r
+                if(result.first != null)\r
+                    result.first.resultChanged();\r
             }\r
 \r
             @Override\r
index 4ae415bfb4b72ede74bbac16eb86473ec4feb8cd..0b95bf6bc377d75fd0914aa1fe5c8f076a505dc6 100644 (file)
@@ -31,7 +31,7 @@ public abstract class IndependentVariable extends Variable {
      */\r
     public String getDeclaration() {\r
         Variability variability = Variability.getVariability(this);\r
-        \r
+\r
         // [variability] type name[range]\r
         StringBuilder sb = new StringBuilder();\r
         sb.append("    ");\r
@@ -51,11 +51,13 @@ public abstract class IndependentVariable extends Variable {
         sb.append(";\n");\r
 \r
         // Possible additions to expressions. e.g. helper classes and variables\r
-        String addition;\r
-        for(IExpression e : getExpressions().getExpressions()) {\r
-            addition = e.getDeclarationAddition(this);\r
-            if(addition != null)\r
-                sb.append(addition);\r
+        if(getExpressions() != null) {\r
+            String addition;\r
+            for(IExpression e : getExpressions().getExpressions()) {\r
+                addition = e.getDeclarationAddition(this);\r
+                if(addition != null)\r
+                    sb.append(addition);\r
+            }\r
         }\r
 \r
         return sb.toString();\r
@@ -125,6 +127,9 @@ public abstract class IndependentVariable extends Variable {
      * @return equations or null\r
      */\r
     protected String getVariableEquation() {\r
+        if(this.expressions == null)\r
+            return null;\r
+        \r
         ArrayList<IExpression> expressions = this.expressions.getExpressions();\r
         ArrayIndexes ai = this.getArrayIndexes();\r
         ArrayList<Enumeration> enumerations = null;\r
index e027774ada1aa607509b0f23ece8f125e10113c4..dc4f483fd27e8c2aa34d58efabe407b9c207d7c5 100644 (file)
@@ -139,6 +139,9 @@ public enum Variability {
      * @return Variabilty of a variable\r
      */\r
     static public Variability getVariability(IndependentVariable variable, boolean allowVariableReferences, Configuration configuration) {\r
+        if(variable == null || variable.getExpressions() == null)\r
+            return Variability.CONTINUOUS;\r
+        \r
         ArrayList<org.simantics.sysdyn.representation.expressions.IExpression> expressions = variable.getExpressions().getExpressions();\r
 \r
         if(expressions.size() != 1)\r