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-0.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.elements.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.elements.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements.CloudFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements.InputFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ShadowSymbol"\r class="org.simantics.sysdyn.ui.elements.ShadowFactory" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/LoopSymbol"\r class="org.simantics.sysdyn.ui.elements.LoopFactory" /> \r\r <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements.CloudFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements.InputFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/ShadowSymbol"\r class="org.simantics.sysdyn.ui.elements.ShadowFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/LoopSymbol"\r class="org.simantics.sysdyn.ui.elements.LoopFactory" /> \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.elements.MultilineTextElementFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r class="org.simantics.sysdyn.ui.elements.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.elements.connections.RouteFlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowEdgeFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowConnectionFactory">\r <graph/>\r </type> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.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/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableChildRule"/> \r <resource uri=" http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterChildRule"/> \r \r \r <!-- Sensitivity analysis -->\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/ParameterBrowseContext/ParameterChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.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 \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/Module/ParameterOverrideBrowseContext/ParameterLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterLabelDecorationRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelDecorationRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterModifierRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterModifierRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterSorterRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterSorterRule"/> \r \r <!-- Sensitivity analysis -->\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/ParameterBrowseContext/ParameterLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.ParameterLabelRule"/>\r\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 \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 <type uri="http://www.simantics.org/Sysdyn-0.0/Variable"\r class="org.simantics.sysdyn.ui.actions.SysdynVariableRemover">\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-0.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.elements.profiles.SimulationPlaybackStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.IssueDecorationStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ShadowStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.ShadowStyle">\r </resource> \r </target>\r \r \r <!-- TODO: currently maps jfree concepts directly to Sysdyn implementations. Sysdyn needs tool specific types for the datasets. -->\r <!-- TODO: AllVariablesOfModel query is run on random Resources; listing all possible types explicitly is cumbersome, we need a better implementation. -->\r <target interface="org.simantics.jfreechart.chart.properties.IAllVariablesOfModel"> \r <type uri="http://www.simantics.org/Sysdyn-1.1/SysdynModel"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/Series"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/Parameter"\r class="org.simantics.sysdyn.ui.trend.AllParametersOfModel">\r <this />\r </type>\r </target> \r \r <target interface="org.simantics.jfreechart.chart.properties.RangeHandlerFactory"> \r <type uri="http://www.simantics.org/JFreeChart-1.0/Series"\r class="org.simantics.sysdyn.ui.trend.SysdynRangeHandlerFactory">\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/Parameter"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.SensitivityRangeHandlerFactory">\r </type>\r </target> \r \r <!-- TODO: currently maps jfree concepts directly to Sysdyn implementations. Sysdyn needs tool specific types for the datasets. -->\r <target interface="org.simantics.jfreechart.chart.IDataset">\r <type uri="http://www.simantics.org/JFreeChart-0.0/XYDataset"\r class="org.simantics.sysdyn.ui.trend.XYDataset">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-0.0/CategoryDataset"\r class="org.simantics.sysdyn.ui.trend.CategoryDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-0.0/PieDataset"\r class="org.simantics.sysdyn.ui.trend.PieDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/Charts/SensitivityDataset"\r class="org.simantics.sysdyn.ui.trend.SensitivityDataset">\r <graph />\r <this />\r </type>\r </target>\r \r <!-- Sensitivity analysis -->\r <target\r interface="org.simantics.sysdyn.ui.properties.widgets.sensitivity.IDistributionProperties">\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/NormalDistribution"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.NormalDistributionProperties">\r <this />\r </type> \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/UniformDistribution"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.UniformDistributionProperties">\r <this />\r </type> \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/Interval"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.IntervalProperties">\r <this />\r </type>\r </target>\r \r <!-- Search -->\r <target interface="org.simantics.scl.runtime.function.Function">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModulesSearchFunction"\r class="org.simantics.sysdyn.ui.function.ModulesSearchFunction">\r </resource>\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/Simulation-0.0/Model"\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 uri="http://www.simantics.org/Simulation-0.0/Model"\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-0.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.elements.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.elements.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements.CloudFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements.InputFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ShadowSymbol"\r class="org.simantics.sysdyn.ui.elements.ShadowFactory" /> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/LoopSymbol"\r class="org.simantics.sysdyn.ui.elements.LoopFactory" /> \r\r <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements.CloudFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements.InputFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/ShadowSymbol"\r class="org.simantics.sysdyn.ui.elements.ShadowFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/LoopSymbol"\r class="org.simantics.sysdyn.ui.elements.LoopFactory" /> \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.elements.MultilineTextElementFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AdditionalSymbols/MultilineText"\r class="org.simantics.sysdyn.ui.elements.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.elements.connections.RouteFlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowEdgeFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements.connections.RouteFlowConnectionFactory">\r <graph/>\r </type> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements.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/HistoryDataset/HistoryDatasetVariablesBrowseContext/VariableChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.historyDataset.VariableChildRule"/> \r <resource uri=" http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterChildRule"/> \r \r \r <!-- Sensitivity analysis -->\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/ParameterBrowseContext/ParameterChildRule"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.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 \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/Module/ParameterOverrideBrowseContext/ParameterLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterLabelDecorationRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterLabelDecorationRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterModifierRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterModifierRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/Module/ParameterOverrideBrowseContext/ParameterSorterRule"\r class="org.simantics.sysdyn.ui.properties.widgets.modules.ParameterSorterRule"/> \r \r <!-- Sensitivity analysis -->\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/ParameterBrowseContext/ParameterLabelRule"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.ParameterLabelRule"/>\r\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 \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 <type uri="http://www.simantics.org/Sysdyn-0.0/Variable"\r class="org.simantics.sysdyn.ui.actions.SysdynVariableRemover">\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-0.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.elements.profiles.SimulationPlaybackStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.IssueDecorationStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ShadowStyle"\r class="org.simantics.sysdyn.ui.elements.profiles.ShadowStyle">\r </resource> \r </target>\r \r \r <!-- TODO: currently maps jfree concepts directly to Sysdyn implementations. Sysdyn needs tool specific types for the datasets. -->\r <!-- TODO: AllVariablesOfModel query is run on random Resources; listing all possible types explicitly is cumbersome, we need a better implementation. -->\r <target interface="org.simantics.jfreechart.chart.properties.IAllVariablesOfModel"> \r <type uri="http://www.simantics.org/Sysdyn-1.1/SysdynModel"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/Series"\r class="org.simantics.sysdyn.ui.trend.AllVariablesOfModel">\r <this />\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/Parameter"\r class="org.simantics.sysdyn.ui.trend.AllParametersOfModel">\r <this />\r </type>\r </target> \r \r <target interface="org.simantics.jfreechart.chart.properties.RangeHandlerFactory"> \r <type uri="http://www.simantics.org/JFreeChart-1.0/Series"\r class="org.simantics.sysdyn.ui.trend.SysdynRangeHandlerFactory">\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/SensitivityAnalysisExperiment/Parameter"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.SensitivityRangeHandlerFactory">\r </type>\r </target> \r \r <!-- TODO: currently maps jfree concepts directly to Sysdyn implementations. Sysdyn needs tool specific types for the datasets. -->\r <target interface="org.simantics.jfreechart.chart.IDataset">\r <type uri="http://www.simantics.org/JFreeChart-0.0/XYDataset"\r class="org.simantics.sysdyn.ui.trend.XYDataset">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-0.0/CategoryDataset"\r class="org.simantics.sysdyn.ui.trend.CategoryDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-0.0/PieDataset"\r class="org.simantics.sysdyn.ui.trend.PieDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/Sysdyn-0.0/Charts/SensitivityDataset"\r class="org.simantics.sysdyn.ui.trend.SensitivityDataset">\r <graph />\r <this />\r </type>\r </target>\r \r <!-- Sensitivity analysis -->\r <target\r interface="org.simantics.sysdyn.ui.properties.widgets.sensitivity.IDistributionProperties">\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/NormalDistribution"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.NormalDistributionProperties">\r <this />\r </type> \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/UniformDistribution"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.UniformDistributionProperties">\r <this />\r </type> \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/Interval"\r class="org.simantics.sysdyn.ui.properties.widgets.sensitivity.IntervalProperties">\r <this />\r </type>\r </target>\r \r <!-- Search -->\r <target interface="org.simantics.scl.runtime.function.Function">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModulesSearchFunction"\r class="org.simantics.sysdyn.ui.function.ModulesSearchFunction">\r </resource>\r </target>\r \r
</adapters>
\ No newline at end of file
tooltip="Exports the trend to SVG file">\r
</command>\r
</menuContribution>\r
+ \r
+ <menuContribution\r
+ locationURI="popup:#EnumerationTabPopup?after=wbStart">\r
+ \r
+ <command\r
+ commandId="org.simantics.sysdyn.ui.renameNode1"\r
+ icon="platform:/plugin/com.famfamfam.silk/icons/textfield_rename.png"\r
+ id="org.simantics.sysdyn.ui.browser.rename"\r
+ label="Rename"\r
+ style="push">\r
+ <visibleWhen checkEnabled="true">\r
+ </visibleWhen>\r
+ </command>\r
+ \r
+ </menuContribution>\r
<menuContribution\r
locationURI="popup:#SysdynBrowserPopup?after=wbStart">\r
<menu id="org.simantics.new"\r
checkEnabled="true">\r
<with\r
variable="selection">\r
+ <or>\r
<test\r
args="http://www.simantics.org/Layer0-0.0/Library"\r
property="org.simantics.graph.resourceType"\r
value="true">\r
</test>\r
+ <test\r
+ args="http://www.simantics.org/Structural-0.0/ComponentType"\r
+ property="org.simantics.graph.resourceType"\r
+ value="true">\r
+ </test>\r
+ </or>\r
</with>\r
</visibleWhen>\r
</command>\r
id="org.simantics.sysdyn.ui.renameNode"\r
name="Rename Node">\r
</command>\r
+ <command\r
+ id="org.simantics.sysdyn.ui.enumerationIndexRenameNode"\r
+ name="Rename Node">\r
+ </command>\r
<command\r
defaultHandler="org.simantics.sysdyn.ui.handlers.ToggleSimulation"\r
id="org.simantics.sysdyn.ui.toggleSimulation"\r
</extension>\r
<extension\r
point="org.eclipse.ui.handlers">\r
+ \r
+ <handler\r
+ class="org.simantics.sysdyn.ui.handlers.EnumerationIndexRenameNodeHandler"\r
+ commandId="org.simantics.sysdyn.ui.enumerationIndexRenameNode">\r
+ </handler>\r
+ \r
+ \r
<handler\r
class="org.simantics.sysdyn.ui.trend.PinTrend"\r
commandId="org.simantics.sysdyn.ui.trend.view.pin">\r
property="org.simantics.graph.resourceType"\r
value="true">\r
</test>\r
+ <test\r
+ args="http://www.simantics.org/Structural-0.0/ComponentType"\r
+ property="org.simantics.graph.resourceType"\r
+ value="true">\r
+ </test>\r
</or>\r
</with>\r
</activeWhen>\r
org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false\r
-org.eclipse.ui/DOCK_PERSPECTIVE_BAR=right
\ No newline at end of file
+org.eclipse.ui/DOCK_PERSPECTIVE_BAR=right\r
+\r
+org.simantics.sysdyn.solver.preferences/SOLVER_TYPE=OPENMODELICA
\ No newline at end of file
public class ChartDropAction implements DropActionFactory {\r
\r
@Override\r
- public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException {\r
+ public Runnable create(ReadGraph g, Object target, Object source, int operation) throws DatabaseException {\r
\r
final Resource targetChart = AdaptionUtils.adaptToSingle(target, Resource.class);\r
if(targetChart == null || source == null || !(source instanceof IStructuredSelection))\r
public class FunctionDropAction implements DropActionFactory {\r
\r
@Override\r
- public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException {\r
+ public Runnable create(ReadGraph g, Object target, Object source, int operation) throws DatabaseException {\r
Resource t = AdaptionUtils.adaptToSingle(target, Resource.class);\r
Resource s = AdaptionUtils.adaptToSingle(source, Resource.class);\r
\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.project.ontology.ProjectResource;\r
-import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
import org.simantics.sysdyn.ui.browser.nodes.SharedOntologyNode;\r
\r
public class Project extends ViewpointContributor<Resource> {\r
\r
ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
Layer0 l0 = Layer0.getInstance(graph);\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
- for(Resource r : graph.syncRequest(new ObjectsWithType(project, l0.ConsistsOf, sr.SysdynModel))) {\r
+ SimulationResource SIMU = SimulationResource.getInstance(graph);\r
+ for(Resource r : graph.syncRequest(new ObjectsWithType(project, l0.ConsistsOf, SIMU.Model))) {\r
try {\r
result.add(graph.adapt(r, AbstractNode.class));\r
} catch(DatabaseException e) {\r
if(!graph.isInstanceOf(project, PROJ.Project)) return Collections.emptyList();\r
Collection<Resource> ontologies = Simantics.applySCL("Simantics/SharedOntologies", "traverseSharedOntologies", graph, graph.getRootLibrary());\r
for(Resource o : ontologies) {\r
- if(!graph.isImmutable(o))\r
+// if(!graph.isImmutable(o))\r
result.add(new SharedOntologyNode(o));\r
}\r
\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.layer0.Layer0;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
import org.simantics.structural.ui.modelBrowser.nodes.AbstractNode;\r
-import org.simantics.sysdyn.SysdynResource;\r
\r
public class SysdynProject extends ViewpointContributor<Resource> {\r
\r
\r
ArrayList<AbstractNode> result = new ArrayList<AbstractNode>();\r
Layer0 L0 = Layer0.getInstance(graph);\r
- for(Resource r : graph.syncRequest(new ObjectsWithType(project, L0.ConsistsOf, SysdynResource.getInstance(graph).SysdynModel))) {\r
+ for(Resource r : graph.syncRequest(new ObjectsWithType(project, L0.ConsistsOf, SimulationResource.getInstance(graph).Model))) {\r
try {\r
result.add(graph.adapt(r, AbstractNode.class));\r
} catch(DatabaseException e) {\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.Simantics;\r
import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.DeleteException;\r
import org.simantics.browsing.ui.common.node.IDeletableNode;\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.util.Layer0Utils;\r
import org.simantics.db.layer0.util.RemoverUtil;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
+ graph.markUndoPoint();\r
+ Layer0Utils.addCommentMetadata(graph, "Removed " + NameUtils.getSafeName(graph, data));\r
RemoverUtil.remove(graph, data);\r
}\r
});\r
final Resource[] resources = ResourceAdaptionUtils.toResources(data);\r
final Resource library = this.data;\r
if(resources.length > 0) {\r
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+ Simantics.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
+ \r
+ // Fixing #5196\r
+ // Prevent dropping functions to immutable function libraries such as Built-in Functions, Modelica Array Functions etc.\r
+ if (graph.isImmutable(library))\r
+ return;\r
+ \r
for(Resource tobeMoved : resources) {\r
if(graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunction) ||\r
graph.isInstanceOf(tobeMoved, sr.SysdynModelicaFunctionLibrary)) {\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.Simantics;\r
import org.simantics.browsing.ui.common.node.DeleteException;\r
import org.simantics.browsing.ui.common.node.IDeletableNode;\r
import org.simantics.browsing.ui.common.node.IDropTargetNode;\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.util.Layer0Utils;\r
import org.simantics.db.layer0.util.RemoverUtil;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.utils.FunctionNameValidator;\r
-import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
\r
public class FunctionNode extends VariableNode<Resource> implements IDeletableNode, IModifiableNode, IDropTargetNode {\r
@Override\r
public Modifier getModifier(String columnId) {\r
try {\r
- Resource hasName = Layer0.getInstance(SimanticsUI.getSession()).HasName;\r
- LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), data, hasName) {\r
+ Resource hasName = Layer0.getInstance(Simantics.getSession()).HasName;\r
+ LabelModifier modifier = new LabelModifier(Simantics.getSession(), data, hasName) {\r
@Override\r
public String isValid(String label) {\r
if (!new FunctionNameValidator().isValid(data, label))\r
\r
@Override\r
public void delete() throws DeleteException {\r
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+ Simantics.getSession().asyncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
+ graph.markUndoPoint();\r
+ Layer0Utils.addCommentMetadata(graph, "Removed " + NameUtils.getSafeName(graph, data));\r
RemoverUtil.remove(graph, data);\r
}\r
});\r
final Resource thisFunction = this.data;\r
\r
if(resources.length > 0) {\r
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+ Simantics.getSession().asyncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.Simantics;\r
import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.IDropTargetNode;\r
import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
\r
public class FunctionsFolder extends AbstractNode<Resource> implements IDropTargetNode{\r
final Resource[] resources = ResourceAdaptionUtils.toResources(data);\r
final Resource library = this.data;\r
if(resources.length > 0) {\r
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+ Simantics.getSession().asyncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
+import org.simantics.Simantics;\r
import org.simantics.browsing.ui.common.node.DeleteException;\r
import org.simantics.browsing.ui.common.node.IDropTargetNode;\r
import org.simantics.browsing.ui.content.Labeler.Modifier;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.utils.SharedFunctionLibraryNameValidator;\r
-import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
\r
public class SharedFunctionLibraryNode extends FunctionLibraryNode<Resource> implements IDropTargetNode {\r
\r
@Override\r
public void delete() throws DeleteException {\r
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+ Simantics.getSession().asyncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
@Override\r
public Modifier getModifier(String columnId) {\r
try {\r
- Resource hasName = Layer0.getInstance(SimanticsUI.getSession()).HasName;\r
- LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), data, hasName) {\r
+ Resource hasName = Layer0.getInstance(Simantics.getSession()).HasName;\r
+ LabelModifier modifier = new LabelModifier(Simantics.getSession(), data, hasName) {\r
@Override\r
public String isValid(String label) {\r
if (!new SharedFunctionLibraryNameValidator().isValid(data, label))\r
final Resource[] resources = ResourceAdaptionUtils.toResources(data);\r
final Resource library = this.data;\r
if(resources.length > 0) {\r
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+ Simantics.getSession().asyncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
\r
import org.eclipse.swt.widgets.Display;\r
import org.eclipse.ui.IEditorPart;\r
+import org.simantics.Simantics;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ReadRequest;\r
+import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;\r
+import org.simantics.db.common.request.UnaryRead;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.request.PossibleModel;\r
import org.simantics.db.layer0.variable.RVI;\r
import org.simantics.modeling.actions.NavigateToTarget;\r
import org.simantics.modeling.ui.Activator;\r
import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
import org.simantics.ui.workbench.editor.AbstractResourceEditorAdapter;\r
import org.simantics.utils.datastructures.Callback;\r
-import org.simantics.utils.threads.SWTThread;\r
import org.simantics.utils.threads.ThreadUtils;\r
import org.simantics.utils.ui.AdaptionUtils;\r
\r
\r
@Override\r
public boolean canHandle(ReadGraph graph, Object input) throws DatabaseException {\r
- Resource r = tryGetResource(graph, input);\r
- if (r == null)\r
- return false;\r
- Variable v = AdaptionUtils.adaptToSingle(input, Variable.class);\r
- Collection<Runnable> rs = tryFindDiagram(graph, r, v);\r
+ Collection<Runnable> rs = graph.syncRequest(new DiagramFinderRequest(input), TransientCacheAsyncListener.<Collection<Runnable>>instance());\r
return !rs.isEmpty();\r
}\r
\r
final Display d = Display.getCurrent();\r
if (d == null)\r
return;\r
-\r
- SimanticsUI.getSession().syncRequest(new ReadRequest() {\r
- @Override\r
- public void run(ReadGraph graph) throws DatabaseException {\r
- Resource r = tryGetResource(graph, input);\r
- if (r == null)\r
- return;\r
-\r
- Variable v = AdaptionUtils.adaptToSingle(input, Variable.class);\r
-\r
- final Collection<Runnable> rs = tryFindDiagram(graph, r, v);\r
- if (rs.isEmpty())\r
- return;\r
-\r
- SWTThread.getThreadAccess(d).asyncExec(new Runnable() {\r
- @Override\r
- public void run() {\r
- for (Runnable runnable : rs) {\r
- runnable.run();\r
- }\r
- }\r
- });\r
- }\r
- });\r
+ \r
+ Collection<Runnable> rs = Simantics.getSession().syncRequest(new DiagramFinderRequest(input), TransientCacheAsyncListener.<Collection<Runnable>>instance());\r
+ for (Runnable runnable : rs) {\r
+ runnable.run();\r
+ }\r
}\r
\r
private Collection<Runnable> tryFindDiagram(ReadGraph g, Resource module, Variable variable) throws DatabaseException {\r
}\r
return selectedObjects;\r
}\r
+ \r
+ private class DiagramFinderRequest extends UnaryRead<Object, Collection<Runnable>> {\r
+\r
+ public DiagramFinderRequest(Object parameter) {\r
+ super(parameter);\r
+ }\r
+\r
+ @Override\r
+ public Collection<Runnable> perform(ReadGraph graph) throws DatabaseException {\r
+ Resource r = tryGetResource(graph, parameter);\r
+ if (r == null)\r
+ return Collections.emptyList();\r
+ Variable v = AdaptionUtils.adaptToSingle(parameter, Variable.class);\r
+ return tryFindDiagram(graph, r, v);\r
+ }\r
+ }\r
\r
}\r
import java.util.Collection;\r
import java.util.HashMap;\r
\r
+import org.simantics.databoard.util.URIStringUtils;\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.common.utils.NameUtils;\r
-import org.simantics.db.common.utils.URIStringUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
*/\r
public void create(WriteGraph graph, ConnectionJudgement judgment, Deque<ControlPoint> controlPoints,\r
TerminalInfo startTerminal, TerminalInfo endTerminal) throws DatabaseException {\r
- \r
+\r
if(startTerminal == null) return;\r
if(endTerminal == null) return;\r
\r
createConnection(graph, judgment, controlPoints, startTerminal, endTerminal, false);\r
}\r
\r
- String startElementName = startTerminal.e.getHint(ElementHints.KEY_TEXT);\r
- String endElementName = endTerminal.e.getHint(ElementHints.KEY_TEXT);\r
\r
- String startElementResource = startTerminal.e.getHint(ElementHints.KEY_OBJECT).toString();\r
- String endElementResource = endTerminal.e.getHint(ElementHints.KEY_OBJECT).toString();\r
+ String startElementName = startTerminal != null ? startTerminal.e.getHint(ElementHints.KEY_TEXT).toString() : "null";\r
+ String endElementName = endTerminal != null ? endTerminal.e.getHint(ElementHints.KEY_TEXT).toString() : "null";\r
+ \r
+ String startElementResource = startTerminal != null ? startTerminal.e.getHint(ElementHints.KEY_OBJECT).toString() : "null";\r
+ String endElementResource = endTerminal != null ? endTerminal.e.getHint(ElementHints.KEY_OBJECT).toString() : "null";\r
\r
Layer0Utils.addCommentMetadata(graph, "Created dependency starting from " + startElementName + " " + startElementResource + " and ending to " + endElementName + " " + endElementResource);\r
}\r
\r
// Do we need this?\r
element.setHint(DiagramHints.ROUTE_ALGORITHM, new Router4(false));\r
-\r
IModelingRules modelingRules = diagram.getHint(DiagramModelHints.KEY_MODELING_RULES);\r
\r
- IElement mappedElement = ElementUtils.getByData(diagram, connection);\r
- if (mappedElement == null)\r
- // FIXME: With undo this seems to happen, don't know why yet!\r
- return;\r
-\r
Color color = null;\r
DiagramResource DR = DiagramResource.getInstance(graph);\r
G2DResource G2D = G2DResource.getInstance(graph);\r
// Initialize ConnectionEntity in element\r
// NOTE: MUST use the mapped element with class CE, not the connection (element) were loading into.\r
// GDS will synchronize element into mappedElement in a controlled manner.\r
- element.setHint(ElementHints.KEY_CONNECTION_ENTITY, new CE(connection, mappedElement, backendonnections));\r
+ element.setHint(ElementHints.KEY_CONNECTION_ENTITY, new CE(diagram, connection, element, backendonnections));\r
\r
// Setup graph writeback support for route graph modifications\r
final Session session = graph.getSession();\r
*/\r
static class CE implements ConnectionEntity {\r
\r
+ \r
+ private IDiagram diagram;\r
+\r
+ private transient DataElementMap dataMap;\r
+ \r
/**\r
* The connection instance resource in the graph backend.\r
*/\r
/**\r
* The connection entity element which is a part of the diagram.\r
*/\r
- final IElement connectionElement;\r
+ IElement connectionElement;\r
\r
/**\r
* @see #getTerminalConnections(Collection)\r
*/\r
Set<Connection> terminalConnections;\r
\r
- CE(Resource connection, IElement connectionElement, Set<BackendConnection> backendConnections) {\r
+ \r
+ public CE(IDiagram diagram, Resource connection, IElement connectionElement, Set<BackendConnection> backendConnections) {\r
+ if (connectionElement == null)\r
+ throw new NullPointerException("null connection element");\r
+ this.diagram = diagram;\r
+ this.dataMap = diagram.getDiagramClass().getSingleItem(DataElementMap.class);\r
this.connection = connection;\r
this.connectionElement = connectionElement;\r
this.backendConnections = backendConnections;\r
+ IElement ce = getConnection0();\r
+ if (ce != null)\r
+ this.connectionElement = ce;\r
+ }\r
+\r
+ public IElement getConnection0() {\r
+ IElement connectionElement = dataMap.getElement(diagram, connection);\r
+ return connectionElement;\r
}\r
\r
@Override\r
public IElement getConnection() {\r
- return connectionElement;\r
+ IElement c = getConnection0();\r
+ if (c == null)\r
+ c = this.connectionElement;\r
+ return c;\r
}\r
\r
public Object getConnectionObject() {\r
}\r
\r
private Set<Connection> calculateTerminalConnections() {\r
- IDiagram diagram = connectionElement.getDiagram();\r
DataElementMap dem = diagram.getDiagramClass().getSingleItem(DataElementMap.class);\r
Set<Connection> result = new HashSet<Connection>();\r
ArrayList<Terminal> ts = new ArrayList<Terminal>();\r
AffineTransform transform = DiagramGraphUtil.getAffineTransform(graph, element);\r
\r
Resource component = graph.getPossibleObject(element, MOD.ElementToComponent);\r
+ \r
+ if (component == null)\r
+ return new ShadowResult(Style.NONE, transform);\r
\r
Resource original = graph.getPossibleObject(component, SR.Shadow_original);\r
Collection<Resource> shadows = graph.getObjects(component, SR.Shadow_original_Inverse);\r
import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.request.PossibleModel;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modeling.ui.Activator;\r
import org.simantics.sysdyn.SysdynResource;\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
-\r
+ graph.markUndoPoint();\r
SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
\r
graph.deny(experiment, SYSDYN.Experiment_ic);\r
graph.claim(experiment, SYSDYN.Experiment_ic, ic);\r
-\r
+ Layer0Utils.addCommentMetadata(graph, "Assigned new IC " + NameUtils.getSafeName(graph, ic) + " to experiment " + NameUtils.getSafeLabel(graph, experiment));\r
}\r
-\r
});\r
-\r
} catch (DatabaseException e) {\r
-\r
+ e.printStackTrace();\r
}\r
-\r
return null;\r
- \r
}\r
-\r
}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2010 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.handlers;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.ui.IEditorPart;\r
+import org.eclipse.ui.IWorkbenchPart;\r
+import org.eclipse.ui.IWorkbenchSite;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
+import org.eclipse.ui.part.IPage;\r
+import org.eclipse.ui.part.IPageSite;\r
+import org.simantics.browsing.ui.GraphExplorer;\r
+import org.simantics.browsing.ui.NodeContext;\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
+import org.simantics.browsing.ui.platform.PropertyPageView;\r
+import org.simantics.browsing.ui.swt.widgets.GraphExplorerComposite;\r
+import org.simantics.sysdyn.ui.properties.SysdynPropertyPage;\r
+import org.simantics.utils.ui.ISelectionUtils;\r
+\r
+public class EnumerationIndexRenameNodeHandler extends AbstractHandler {\r
+\r
+ @Override\r
+ public Object execute(ExecutionEvent event) throws ExecutionException {\r
+ ISelection sel2 = HandlerUtil.getActiveMenuSelection(event);\r
+ NodeContext ctx = ISelectionUtils.filterSingleSelection(sel2, NodeContext.class);\r
+ if (ctx == null)\r
+ return null;\r
+\r
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);\r
+ if (part == null)\r
+ return null;\r
+\r
+ PropertyPageView ppv = (PropertyPageView) part;\r
+ IPage p = ppv.getCurrentPage();\r
+ Control control = p.getControl();\r
+ \r
+ Control geComposite = findGEComposite(control);\r
+ GraphExplorerComposite ge = (GraphExplorerComposite) geComposite;\r
+ ge.getExplorer().startEditing(ctx, ColumnKeys.SINGLE);\r
+ \r
+ return null;\r
+ }\r
+ \r
+ private Control findGEComposite(Control control) {\r
+ Control[] comp = ((Composite) control).getChildren();\r
+ Control ge = null;\r
+ for (Control cont : comp) {\r
+ if (cont instanceof GraphExplorerComposite)\r
+ return cont;\r
+ else if (cont instanceof Composite) {\r
+ ge = findGEComposite(cont);\r
+ return ge;\r
+ }\r
+ else\r
+ continue;\r
+ }\r
+ return ge;\r
+ }\r
+}\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.jface.resource.ImageDescriptor;\r
import org.eclipse.jface.window.Window;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.swt.widgets.MessageBox;\r
import org.eclipse.swt.widgets.Shell;\r
import org.eclipse.ui.PlatformUI;\r
import org.simantics.Simantics;\r
import org.simantics.sysdyn.manager.SysdynGameExperimentBase;\r
import org.simantics.sysdyn.manager.SysdynResult;\r
import org.simantics.sysdyn.ui.utils.HandlerUtils;\r
-import org.simantics.ui.SimanticsUI;\r
import org.simantics.utils.datastructures.Pair;\r
\r
public class SaveHistoryHandler extends AbstractHandler {\r
HandlerUtils.saveBeforeExperimentRun(event);\r
\r
IExperimentManager manager = \r
- SimanticsUI.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
+ Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
IExperiment experiment = manager.getActiveExperiment();\r
if(experiment instanceof SysdynGameExperimentBase) {\r
final SysdynGameExperimentBase exp = (SysdynGameExperimentBase)experiment;\r
if(r instanceof MemoryResult) {\r
MemoryResult gr = (MemoryResult)r;\r
SimulationResult sr = gr.getSimulationResult();\r
+ if (sr == null) {\r
+ \r
+ MessageBox messageDialog = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING | SWT.OK);\r
+ messageDialog.setText("No Simulation History");\r
+ messageDialog.setMessage("There is no simulation history available, please simulate first!");\r
+\r
+ messageDialog.open();\r
+ return null;\r
+ }\r
for(DataSet ds : sr.getVariableDataSets()) {\r
map.put(ds, new Pair<String,ImageDescriptor>(ds.name, null));\r
}\r
import org.simantics.sysdyn.manager.SysdynExperiment;\r
import org.simantics.sysdyn.manager.SysdynExperiments;\r
import org.simantics.sysdyn.ui.utils.HandlerUtils;\r
-import org.simantics.ui.SimanticsUI;\r
\r
public class SaveICHandler extends AbstractHandler {\r
\r
HandlerUtils.saveBeforeExperimentRun(event);\r
\r
IExperimentManager manager = \r
- SimanticsUI.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
+ Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
IExperiment experiment = manager.getActiveExperiment();\r
if(experiment instanceof SysdynExperiment) {\r
final SysdynExperiment exp = (SysdynExperiment)experiment;\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
Variable v = Variables.getVariable(graph, exp.getResource());\r
- SysdynExperiments.saveIC(graph, v, "IC");\r
+ SysdynExperiments.saveIC(graph, v);\r
}\r
\r
});\r
// Convert Vensim model to Simantics SysDyn format using MdlParser\r
final Model model;\r
try {\r
- model = MdlParser.parse(file);\r
+ model = new MdlParser().parse(file);\r
}\r
catch (Exception e) {\r
e.printStackTrace();\r
\r
@Override\r
public void doLoadDefault() {\r
- System.err.println("LOAD DEFAULT");\r
IScopeContext context = ConfigurationScope.INSTANCE;\r
Preferences node = context.getNode(Activator.PLUGIN_ID);\r
node.put(OpenModelicaPreferences.OM_HOME, ModelicaManager.getDefaultOMHome().getAbsolutePath());\r
\r
@Override\r
public void run() {\r
- up.getControl().setEnabled(finalEnabled);\r
- down.getControl().setEnabled(finalEnabled);\r
- remove.getControl().setEnabled(finalEnabled); \r
+ if (!up.getControl().isDisposed())\r
+ up.getControl().setEnabled(finalEnabled);\r
+ if (!down.getControl().isDisposed())\r
+ down.getControl().setEnabled(finalEnabled);\r
+ if (!remove.getControl().isDisposed())\r
+ remove.getControl().setEnabled(finalEnabled); \r
}\r
});\r
}\r
import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.operation.Layer0X;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.properties.widgets.EquivalentUnitsWidget;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.ComboStringPropertyModifier;\r
outputIntervalLabel, methodLabel, toleranceLabel, variableFilterLabel;\r
private TrackedText name, startTime, stopTime, stepLength, outputInterval, tolerance, variableFilter;\r
private TrackedCombo method, timeUnit;\r
- private Button validateUnits;\r
+ private Button validateUnits, useModelicaLibrary;\r
private EquivalentUnitsWidget equivalentUnitsWidget;\r
/**\r
* Modifier for modifying model labels\r
"NOTE: whitespace must be replaced with an underscore ('_') character" +\r
"e.g. 'Growth Rate' -> 'Growth_Rate'");\r
\r
+ useModelicaLibrary = new Button(composite, support, SWT.CHECK);\r
+ useModelicaLibrary.setText("Use Modelica libraries");\r
+ useModelicaLibrary.setSelectionFactory(new ReadFactoryImpl<Resource, Boolean>() {\r
+\r
+ @Override\r
+ public Boolean perform(ReadGraph graph, Resource model) throws DatabaseException {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ SimulationResource SIM = SimulationResource.getInstance(graph);\r
+ Resource configuration = graph.getPossibleObject(model, SIM.HasConfiguration);\r
+ return graph.getPossibleObject(configuration, SR.SysdynModel_useModelicaLibraries) != null;\r
+ }\r
+ });\r
+ \r
+ useModelicaLibrary.addSelectionListener(new SelectionListenerImpl<Resource>(context){\r
+\r
+ @Override\r
+ public void apply(WriteGraph graph, Resource model) throws DatabaseException {\r
+ SysdynResource SR = SysdynResource.getInstance(graph);\r
+ SimulationResource SIM = SimulationResource.getInstance(graph);\r
+ Resource configuration = graph.getPossibleObject(model, SIM.HasConfiguration);\r
+ boolean useModelicaLibraries = graph.getPossibleObject(configuration, SR.SysdynModel_useModelicaLibraries) != null;\r
+\r
+ if (!useModelicaLibraries)\r
+ graph.claim(configuration, SR.SysdynModel_useModelicaLibraries, configuration);\r
+ else\r
+ graph.deny(configuration, SR.SysdynModel_useModelicaLibraries);\r
+ }\r
+ });\r
+ \r
sc.setExpandHorizontal(true);\r
sc.setExpandVertical(true);\r
}\r
GridDataFactory.fillDefaults().grab(true, false).hint(50, SWT.DEFAULT).applyTo(tolerance.getWidget());\r
GridDataFactory.fillDefaults().span(2, 1).align(SWT.BEGINNING, SWT.CENTER).applyTo(variableFilterLabel);\r
GridDataFactory.fillDefaults().span(2, 1).grab(true, false).hint(100, SWT.DEFAULT).applyTo(variableFilter.getWidget());\r
+ GridDataFactory.fillDefaults().span(2, 1).grab(true, false).hint(100, SWT.DEFAULT).applyTo(useModelicaLibrary.getWidget());\r
\r
sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));\r
}\r
GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(toleranceLabel);\r
GridDataFactory.fillDefaults().grab(true, false).span(wideScreen ? 1 : 2, 1).hint(60, SWT.DEFAULT).applyTo(tolerance.getWidget());\r
GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(variableFilterLabel);\r
- GridDataFactory.fillDefaults().grab(true, false).span(wideScreen ? 10 : 5, 1).hint(200, SWT.DEFAULT).applyTo(variableFilter.getWidget());\r
+ GridDataFactory.fillDefaults().grab(true, false).span(wideScreen ? 9 : 4, 1).hint(200, SWT.DEFAULT).applyTo(variableFilter.getWidget());\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(useModelicaLibrary.getWidget());\r
\r
sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));\r
} \r
import java.util.HashSet;\r
import java.util.List;\r
\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.core.runtime.Status;\r
+import org.eclipse.core.runtime.jobs.Job;\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
import org.eclipse.jface.viewers.ISelectionProvider;\r
import org.eclipse.swt.widgets.Tree;\r
import org.eclipse.swt.widgets.TreeItem;\r
import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.Simantics;\r
import org.simantics.browsing.ui.NodeContext;\r
+import org.simantics.browsing.ui.common.ColumnKeys;\r
import org.simantics.browsing.ui.swt.SingleSelectionInputSource;\r
import org.simantics.browsing.ui.swt.widgets.Button;\r
import org.simantics.browsing.ui.swt.widgets.GraphExplorerComposite;\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.util.Layer0Utils;\r
import org.simantics.db.layer0.variable.Variable;\r
import org.simantics.db.layer0.variable.Variables;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.sysdyn.ui.properties.widgets.arrays.ReplaceableIndexesWidget;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.VariableNameInputValidator;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.VariableNamePropertyModifier;\r
-import org.simantics.ui.SimanticsUI;\r
import org.simantics.utils.datastructures.ArrayMap;\r
+import org.simantics.utils.threads.SWTThread;\r
import org.simantics.utils.ui.AdaptionUtils;\r
\r
public class EnumerationTab extends LabelPropertyTabContributor implements Widget {\r
Variable variable;\r
\r
Table table;\r
+\r
+ private Button add;\r
+ private Button remove;\r
+ \r
@Override\r
public void createControls(Composite body, IWorkbenchSite site,\r
final ISessionContext context, WidgetSupport support) {\r
indexExplorer = new GraphExplorerComposite(ArrayMap.keys(\r
"displaySelectors", "displayFilter").values(false, false), site, container, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI | SWT.CHECK);\r
\r
+ indexExplorer.setContextMenuId("#EnumerationTabPopup");\r
+ \r
indexExplorer\r
.setBrowseContexts(SysdynResource.URIs.EnumerationIndexes);\r
indexExplorer.setInputSource(new SingleSelectionInputSource(\r
final EnumerationIndexNode node = (EnumerationIndexNode) context.getAdapter(EnumerationIndexNode.class);\r
node.setShowInChartsSelected(checked);\r
\r
- SimanticsUI.getSession().asyncRequest(new ReadRequest() {\r
+ Simantics.getSession().asyncRequest(new ReadRequest() {\r
@Override\r
public void run(ReadGraph graph) throws DatabaseException {\r
updateModelResults(graph);\r
}\r
});\r
\r
-\r
+ \r
indexExplorer.finish();\r
\r
GridDataFactory.fillDefaults().grab(true, true).span(4, 1).applyTo(\r
((Tree) c).setLinesVisible(true);\r
\r
\r
- final Button add = new Button(container, support, SWT.None);\r
+ add = new Button(container, support, SWT.None);\r
add.setText("Add");\r
- add.addSelectionListener(new addEnumerationIndexListener(support));\r
+ add.addSelectionListener(new AddEnumerationIndexListener(support));\r
\r
- final Button remove = new Button(container, support, SWT.None);\r
+ remove = new Button(container, support, SWT.None);\r
remove.setText("Remove");\r
- remove.addSelectionListener(new removeEnumerationIndexListener(support));\r
+ remove.addSelectionListener(new RemoveEnumerationIndexListener(support));\r
\r
ReplaceableIndexesWidget externalIndexes = new ReplaceableIndexesWidget(container, support, SWT.NULL);\r
GridDataFactory.fillDefaults().applyTo(externalIndexes.getWidget());\r
\r
}\r
\r
- private class addEnumerationIndexListener implements SelectionListener, Widget {\r
+ private class AddEnumerationIndexListener implements SelectionListener, Widget {\r
\r
Resource enumerationIndexes;\r
\r
- public addEnumerationIndexListener(WidgetSupport support) {\r
+ public AddEnumerationIndexListener(WidgetSupport support) {\r
support.register(this);\r
}\r
\r
@Override\r
public void widgetSelected(SelectionEvent e) {\r
try {\r
- SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+ \r
+ currentItemCount = getCurrentItemCount();\r
+ lastItemCount = currentItemCount;\r
+ \r
+ Simantics.getSession().syncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
+ graph.markUndoPoint();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
Layer0 l0 = Layer0.getInstance(graph);\r
\r
ArrayList<Resource> index = new ArrayList<Resource>();\r
index.add(ei);\r
ListUtils.insertBack(graph, enumerationIndexes, index);\r
+ \r
+ List<Resource> list = ListUtils.toList(graph, enumerationIndexes);\r
+ if (!list.isEmpty())\r
+ updateRemoveButton(true);\r
+ \r
+ Layer0Utils.addCommentMetadata(graph, "Added new Enumeration Index " + NameUtils.getSafeName(graph, ei) + " to " + enumerationIndexes);\r
}\r
});\r
+ \r
+ enableItemForRename();\r
+ \r
} catch (DatabaseException e1) {\r
e1.printStackTrace();\r
}\r
\r
@Override\r
public void widgetDefaultSelected(SelectionEvent e) {\r
-\r
+ System.out.println("asd");\r
}\r
\r
}\r
\r
- private class removeEnumerationIndexListener implements SelectionListener, Widget {\r
+ private class RemoveEnumerationIndexListener implements SelectionListener, Widget {\r
\r
Resource enumerationIndexes;\r
\r
- public removeEnumerationIndexListener(WidgetSupport support) {\r
+ public RemoveEnumerationIndexListener(WidgetSupport support) {\r
support.register(this);\r
}\r
\r
@Override\r
public void run(ReadGraph graph) throws DatabaseException {\r
enumerationIndexes = graph.getSingleObject(enumeration, SysdynResource.getInstance(graph).Enumeration_enumerationIndexList);\r
+ List<Resource> list = ListUtils.toList(graph, enumerationIndexes);\r
+ if (list.isEmpty())\r
+ updateRemoveButton(false);\r
}\r
});\r
} catch (DatabaseException e) {\r
final IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();\r
\r
try {\r
- SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+ Simantics.getSession().syncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
+ graph.markUndoPoint();\r
for(Object o : selection.toList()) {\r
Resource r = AdaptionUtils.adaptToSingle(o, Resource.class);\r
if(r == null)\r
continue;\r
ListUtils.removeElement(graph, enumerationIndexes, r);\r
}\r
+ List<Resource> list = ListUtils.toList(graph, enumerationIndexes);\r
+ if (list.isEmpty())\r
+ updateRemoveButton(false);\r
+ Layer0Utils.addCommentMetadata(graph, "Removed Enumeration Index " );\r
}\r
});\r
} catch (DatabaseException e1) {\r
public void widgetSelected(SelectionEvent e) {\r
final boolean selected = showAll.getWidget().getSelection();\r
try {\r
- SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+ Simantics.getSession().syncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
+ graph.markUndoPoint();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
List<Resource> indexes = ListUtils.toList(graph, enumerationIndexes);\r
for(Resource index : indexes) {\r
graph.claimLiteral(index, sr.EnumerationIndex_showEnumerationIndexInCharts, false, Bindings.BOOLEAN);\r
}\r
}\r
- \r
+ Layer0Utils.addCommentMetadata(graph, "Modified Show all in charts");\r
updateModelResults(graph);\r
}\r
});\r
public void setInput(ISessionContext context, Object input) {\r
variable = AdaptionUtils.adaptToSingle(input, Variable.class);\r
}\r
+ \r
+ private void updateRemoveButton(final boolean enable) {\r
+ SWTThread.getThreadAccess().asyncExec(new Runnable() {\r
+ \r
+ @Override\r
+ public void run() {\r
+ remove.getWidget().setEnabled(enable);\r
+ if (!enable)\r
+ add.getWidget().setFocus();\r
+ }\r
+ });\r
+ }\r
+ \r
+ private int currentItemCount = 0;\r
+ private int lastItemCount = 0;\r
+ \r
+ private void enableItemForRename() {\r
+ \r
+ \r
+ \r
+ Job j = new Job("") {\r
+\r
+ @Override\r
+ protected IStatus run(IProgressMonitor monitor) {\r
+ \r
+ while (lastItemCount == currentItemCount) {\r
+ SWTThread.getThreadAccess().syncExec(new Runnable() {\r
+\r
+ @Override\r
+ public void run() {\r
+ lastItemCount = getCurrentItemCount();\r
+ }\r
+ });\r
+ try {\r
+ Thread.sleep(50);\r
+ } catch (InterruptedException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ \r
+ SWTThread.getThreadAccess().syncExec(new Runnable() {\r
+ \r
+ @Override\r
+ public void run() {\r
+ Control c = indexExplorer.getExplorer().getControl();\r
+ if (c instanceof Tree) {\r
+ Tree tree = (Tree) c; \r
+ TreeItem[] items = tree.getItems();\r
+ TreeItem lastItem = items[items.length - 1];\r
+ tree.setSelection(lastItem);\r
+ }\r
+ }\r
+ });\r
+ \r
+ SWTThread.getThreadAccess().syncExec(new Runnable() {\r
+ \r
+ @Override\r
+ public void run() {\r
+ Control c = indexExplorer.getExplorer().getControl();\r
+ if (c instanceof Tree) {\r
+ Tree tree = (Tree) c; \r
+ TreeItem[] items = tree.getItems();\r
+ TreeItem lastItem = items[items.length - 1];\r
+ NodeContext context = (NodeContext)lastItem.getData();\r
+ tree.setSelection(lastItem);\r
+ indexExplorer.getExplorer().startEditing(context, ColumnKeys.SINGLE); \r
+ tree.setSelection(lastItem);\r
+ }\r
+ }\r
+ });\r
+ \r
+ return Status.OK_STATUS;\r
+ }\r
+ };\r
+ j.schedule();\r
+ }\r
+ \r
+ public int getCurrentItemCount() {\r
+ Control c = indexExplorer.getExplorer().getControl();\r
+ Tree tree = (Tree) c; \r
+ return tree.getItemCount();\r
+ }\r
}\r
+\r
} else {\r
// If there was no active expression, create a normal expression\r
graph.claim(newExpression, l0.InstanceOf, sr.NormalExpression);\r
+ graph.claimLiteral(newExpression, sr.Expression_equation, "");\r
Layer0Utils.addCommentMetadata(graph, "Created new Normal Expression " + newExpression + " for " + graph.getPossibleRelatedValue2(input, Layer0.getInstance(graph).HasName, Bindings.STRING));\r
}\r
ArrayList<Resource> addition = new ArrayList<Resource>(1);\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.widgets.Button;\r
import org.eclipse.swt.widgets.Composite;\r
+import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
import org.simantics.browsing.ui.swt.widgets.impl.SelectionListenerImpl;\r
import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\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.ReadRequest;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.db.management.ISessionContext;\r
public IsOutputWidget(Composite parent, WidgetSupport support, int style) {\r
support.register(this);\r
isOutputButton = new org.simantics.browsing.ui.swt.widgets.Button(parent, support, style |= SWT.CHECK);\r
+ isOutputButton.setSelectionFactory(new ReadFactoryImpl<Resource, Boolean>() {\r
+\r
+ @Override\r
+ public Boolean perform(ReadGraph graph, Resource input) throws DatabaseException {\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ return graph.hasStatement(variable, sr.IsOutput);\r
+ }\r
+ });\r
isOutputButton.setText("Is Output");\r
}\r
\r
\r
if(variable == null) return;\r
\r
- try {\r
- context.getSession().syncRequest(new ReadRequest() {\r
- \r
- @Override\r
- public void run(ReadGraph graph) throws DatabaseException {\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
- final boolean isOutput = graph.hasStatement(variable, sr.IsOutput);\r
- final Button button = getWidget();\r
- button.getDisplay().asyncExec(new Runnable() {\r
- \r
- @Override\r
- public void run() {\r
- if(button.isDisposed()) return;\r
- \r
- if(isOutput)\r
- button.setSelection(true);\r
- else\r
- button.setSelection(false);\r
- }\r
- });\r
+ isOutputButton.setInput(context, input);\r
\r
- \r
- }\r
- });\r
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- }\r
- \r
isOutputButton.addSelectionListener(new SelectionListenerImpl<Resource>(context) {\r
\r
@Override\r
package org.simantics.sysdyn.ui.properties.widgets.arrays;\r
\r
+import org.simantics.Simantics;\r
import org.simantics.browsing.ui.common.node.AbstractNode;\r
import org.simantics.browsing.ui.common.node.IDoubleClickableNode;\r
import org.simantics.browsing.ui.common.node.IModifiableNode;\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.util.Layer0Utils;\r
import org.simantics.db.request.Read;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.utils.VariableNameValidator;\r
-import org.simantics.ui.SimanticsUI;\r
\r
public class EnumerationIndexNode extends AbstractNode<Resource> implements IModifiableNode, IDoubleClickableNode {\r
\r
\r
};\r
try {\r
- return SimanticsUI.getSession().syncRequest(request);\r
+ return Simantics.getSession().syncRequest(request);\r
} catch (DatabaseException e) {\r
e.printStackTrace();\r
return "";\r
\r
@Override\r
public void modify(final String label) {\r
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+ Simantics.getSession().asyncRequest(new WriteRequest() {\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
graph.claimLiteral(data, Layer0.getInstance(graph).HasName, label);\r
\r
public void setShowInChartsSelected(final boolean selected) {\r
try {\r
- SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+ Simantics.getSession().syncRequest(new WriteRequest() {\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
+ graph.markUndoPoint();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
graph.claimLiteral(data, sr.EnumerationIndex_showEnumerationIndexInCharts, selected);\r
+ Layer0Utils.addCommentMetadata(graph, "Modified show in chart of " + NameUtils.getSafeName(graph, data) + " to " + selected);\r
}\r
});\r
} catch (DatabaseException e) {\r
import org.eclipse.swt.events.SelectionListener;\r
import org.eclipse.swt.widgets.Button;\r
import org.eclipse.swt.widgets.Composite;\r
+import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
import org.simantics.browsing.ui.swt.widgets.impl.SelectionListenerImpl;\r
import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\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.ReadRequest;\r
+import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.utils.ui.ISelectionUtils;\r
public ReplaceableIndexesWidget(Composite parent, WidgetSupport support, int style) {\r
support.register(this);\r
isReplaceableButton = new org.simantics.browsing.ui.swt.widgets.Button(parent, support, style |= SWT.CHECK);\r
+ isReplaceableButton.setSelectionFactory(new ReadFactoryImpl<Resource, Boolean>() {\r
+\r
+ @Override\r
+ public Boolean perform(ReadGraph graph, Resource input) throws DatabaseException {\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ return graph.getPossibleRelatedValue(variable, sr.Enumeration_isReplaceable);\r
+ }\r
+ });\r
isReplaceableButton.setText("Can be replaced by parent module");\r
}\r
\r
\r
if(variable == null) return;\r
\r
- try {\r
- context.getSession().syncRequest(new ReadRequest() {\r
- \r
- @Override\r
- public void run(ReadGraph graph) throws DatabaseException {\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
- final Boolean replaceable = graph.getPossibleRelatedValue(variable, sr.Enumeration_isReplaceable);\r
- if(replaceable != null)\r
- selected = replaceable;\r
- final Button button = getWidget();\r
- button.getDisplay().asyncExec(new Runnable() {\r
- \r
- @Override\r
- public void run() {\r
- if(button.isDisposed()) return;\r
- \r
- if(replaceable)\r
- button.setSelection(true);\r
- else\r
- button.setSelection(false);\r
- }\r
- });\r
-\r
- \r
- }\r
- });\r
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- }\r
+ isReplaceableButton.setInput(context, input);\r
\r
isReplaceableButton.addSelectionListener(new SelectionListenerImpl<Resource>(context) {\r
\r
graph.claimLiteral(input, sr.Enumeration_isReplaceable, true);\r
selected = true;\r
}\r
+ Layer0Utils.addCommentMetadata(graph, "Modified " + NameUtils.getSafeName(graph, input) + " can be replaced to " + selected);\r
}\r
});\r
}\r
// Function, FunctionLibrary, and SharedFunctionLibrary are not\r
// allowed to have whitespace.\r
if (graph.isInstanceOf(resource, sr.Variable)\r
-// || graph.isInstanceOf(resource, sr.Module)\r
-// || graph.isInstanceOf(resource, sr.ModuleType)\r
+ || graph.isInstanceOf(resource, sr.Module)\r
+ || graph.isInheritedFrom(resource, sr.ModuleSymbol)\r
|| graph.isInstanceOf(resource, sr.Enumeration)\r
|| graph.isInstanceOf(resource, sr.EnumerationIndex)\r
|| graph.isInstanceOf(resource, sheet.Spreadsheet)\r
final Model model;\r
\r
try {\r
- model = MdlParser.parse(file);\r
+ model = new MdlParser().parse(file);\r
}\r
catch (Exception e) {\r
e.printStackTrace();\r