import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\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.jfreechart.chart.properties.AdjustableTab;\r
+import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.elements.connections.DependencyEdgeClass;\r
import org.simantics.sysdyn.ui.elements.connections.DependencyNode;\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
float width = ((float)selection) / 10.0f;\r
graph.claimLiteral(connectionElement, sr.DependencyConnection_strokeWidth, width);\r
+ Layer0Utils.addCommentMetadata(graph, "Modified Line thickness for connection " + graph.getPossibleRelatedValue2(connectionElement, Layer0.getInstance(graph).HasName, Bindings.STRING) + " to " + width);\r
}\r
\r
}\r
@Override\r
public void apply(WriteGraph graph, Resource connectionElement) throws DatabaseException {\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
+ String currentLocation = graph.getPossibleRelatedValue2(connectionElement, sr.DependencyConnection_polarityLocation, Bindings.STRING);\r
+ if (currentLocation != null && currentLocation.equals(location))\r
+ return;\r
graph.claimLiteral(connectionElement, sr.DependencyConnection_polarityLocation, location);\r
+ Layer0Utils.addCommentMetadata(graph, "Modified Location for connection " + graph.getPossibleRelatedValue2(connectionElement, Layer0.getInstance(graph).HasName, Bindings.STRING) + " to " + location);\r
}\r
- \r
}\r
\r
class PolarityLocationRadioSelectionFactory extends ReadFactoryImpl<Resource, Boolean> {\r
@Override\r
public void apply(WriteGraph graph, Resource connectionElement) throws DatabaseException {\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
+ String currentPolarity = graph.getPossibleRelatedValue2(connectionElement, sr.DependencyConnection_polarity, Bindings.STRING);\r
+ if (currentPolarity != null && currentPolarity.equals(polarity))\r
+ return;\r
graph.claimLiteral(connectionElement, sr.DependencyConnection_polarity, polarity.trim());\r
+ Layer0Utils.addCommentMetadata(graph, "Modified Polarity for connection " + graph.getPossibleRelatedValue2(connectionElement, Layer0.getInstance(graph).HasName, Bindings.STRING) + " to " + polarity.trim());\r
}\r
\r
}\r
import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
+import org.simantics.databoard.Bindings;\r
import org.simantics.db.AsyncReadGraph;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.common.request.WriteResultRequest;\r
import org.simantics.db.common.utils.ListUtils;\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.management.ISessionContext;\r
import org.simantics.db.procedure.AsyncListener;\r
);\r
}\r
});\r
+ Layer0Utils.addCommentMetadata(graph, "Deleted Expression " + activeExpression + " from " + graph.getPossibleRelatedValue2(input, Layer0.getInstance(graph).HasName, Bindings.STRING));\r
}\r
});\r
\r
graph.claim(newExpression, l0.InstanceOf, graph.getSingleObject(activeExpression, l0.InstanceOf));\r
if(graph.isInstanceOf(newExpression, sr.StockExpression)) {\r
graph.claimLiteral(newExpression, sr.StockExpression_initialEquation, "");\r
+ Layer0Utils.addCommentMetadata(graph, "Created new Stock Expression " + newExpression + " for " + graph.getPossibleRelatedValue2(input, Layer0.getInstance(graph).HasName, Bindings.STRING));\r
}\r
} else {\r
// If there was no active expression, create a normal expression\r
graph.claim(newExpression, l0.InstanceOf, sr.NormalExpression);\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
addition.add(newExpression);\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.databoard.Bindings;\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
+import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.utils.ui.ISelectionUtils;\r
\r
final SysdynResource sr = SysdynResource.getInstance(graph);\r
if(graph.hasStatement(input, sr.DependencyConnection_delayMark)) {\r
graph.deny(input, sr.DependencyConnection_delayMark);\r
+ Layer0Utils.addCommentMetadata(graph, "Modified Delay mark for connection " + graph.getPossibleRelatedValue2(input, Layer0.getInstance(graph).HasName, Bindings.STRING) + " to False");\r
} else {\r
graph.claim(input, SysdynResource.getInstance(graph).DependencyConnection_delayMark, null, input);\r
+ Layer0Utils.addCommentMetadata(graph, "Modified Delay mark for connection " + graph.getPossibleRelatedValue2(input, Layer0.getInstance(graph).HasName, Bindings.STRING) + " to True");\r
}\r
} \r
});\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.databoard.Bindings;\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
+import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.utils.ui.ISelectionUtils;\r
\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
if(graph.hasStatement(input, sr.IsOutput)) {\r
graph.deny(input, sr.IsOutput);\r
+ Layer0Utils.addCommentMetadata(graph, "Modified Is Output for " + graph.getPossibleRelatedValue2(input, Layer0.getInstance(graph).HasName, Bindings.STRING) + " to False");\r
} else {\r
graph.claim(input, SysdynResource.getInstance(graph).IsOutput, null, input);\r
+ Layer0Utils.addCommentMetadata(graph, "Modified Is Output for " + graph.getPossibleRelatedValue2(input, Layer0.getInstance(graph).HasName, Bindings.STRING) + " to True");\r
}\r
}\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.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.jfreechart.chart.properties.xyline.SeriesPropertyComposite;\r
import org.simantics.layer0.Layer0;\r
Boolean result = graph.getPossibleRelatedValue(dataset, SR.Charts_SensitivityDataset_median, Bindings.BOOLEAN);\r
if(result == null)\r
result = false;\r
- graph.claimLiteral(dataset, SR.Charts_SensitivityDataset_median, Boolean.FALSE.equals(result));\r
+ boolean newValue = Boolean.FALSE.equals(result);\r
+ graph.claimLiteral(dataset, SR.Charts_SensitivityDataset_median, newValue);\r
+ Layer0Utils.addCommentMetadata(graph, "Display Median for " + NameUtils.getSafeName(graph, series) + " to " + newValue);\r
}\r
- \r
});\r
\r
Composite c = new Composite(this, SWT.NONE);\r
public static String matchUnits(ReadGraph graph, SysdynModel model, Configuration configuration, String unit, String expression) {\r
if(unit == null)\r
return "Unit not defined";\r
- \r
+ if (expression == null)\r
+ return "Expression not defined";\r
try {\r
StringReader rightReader = new StringReader(expression);\r
UnitParser rightParser = new UnitParser(rightReader);\r