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.databoard.Bindings;\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.CancelTransactionException;\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.db.layer0.variable.Variable;\r
+import org.simantics.layer0.Layer0;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.utils.ui.ExceptionUtils;\r
\r
SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
+ graph.markUndoPoint();\r
+ String chartName = graph.getRelatedValue2(data, Layer0.getInstance(graph).HasName, Bindings.STRING);\r
RemoverUtil.remove(graph, data);\r
+ Layer0Utils.addCommentMetadata(graph, "Removed chart '" + chartName +"' " + data);\r
}\r
});\r
} catch (DatabaseException e) {\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.diagram.stubs.G2DResource;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
\r
@Override\r
public void perform(WriteGraph g) throws DatabaseException {\r
+ g.markUndoPoint();\r
Layer0 l0 = Layer0.getInstance(g);\r
JFreeChartResource jfree = JFreeChartResource.getInstance(g);\r
G2DResource g2d = G2DResource.getInstance(g);\r
\r
+ String label = NameUtils.findFreshLabel(g, "Bar Chart", model);\r
+ \r
Resource jfreechart = GraphUtils.create2(g, jfree.Chart,\r
l0.HasName, "BarChart" + UUID.randomUUID().toString(),\r
- l0.HasLabel, NameUtils.findFreshLabel(g, "Bar Chart", model),\r
+ l0.HasLabel, label,\r
l0.PartOf, model,\r
jfree.Chart_visibleBorder, true,\r
jfree.Chart_borderWidth, 3,\r
l0.ConsistsOf, dataset,\r
l0.ConsistsOf, domainAxis,\r
l0.ConsistsOf, rangeAxis);\r
+ Layer0Utils.addCommentMetadata(g, "Created new Bar Chart " + label + " " + jfreechart);\r
}\r
\r
});\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.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.sysdyn.SysdynResource;\r
\r
@Override\r
public void perform(WriteGraph g) throws DatabaseException {\r
+ g.markUndoPoint();\r
Layer0 l0 = Layer0.getInstance(g);\r
SysdynResource sr = SysdynResource.getInstance(g);\r
\r
\r
String name = NameUtils.findFreshName(g, "Function", library, l0.ConsistsOf, "%s%d");\r
\r
- GraphUtils.create2(g, sr.SysdynModelicaFunction,\r
+ Resource func = GraphUtils.create2(g, sr.SysdynModelicaFunction,\r
l0.HasName, name,\r
l0.HasDescription, "",\r
sr.SysdynModelicaFunction_modelicaFunctionCode, "",\r
l0.PartOf, library);\r
+ \r
+ Layer0Utils.addCommentMetadata(g, "Created new Function " + name + " " + func.toString());\r
}\r
});\r
\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.diagram.stubs.G2DResource;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
\r
@Override\r
public void perform(WriteGraph g) throws DatabaseException {\r
+ g.markUndoPoint();\r
Layer0 l0 = Layer0.getInstance(g);\r
JFreeChartResource jfree = JFreeChartResource.getInstance(g);\r
G2DResource g2d = G2DResource.getInstance(g);\r
\r
+ String label = NameUtils.findFreshLabel(g, "Pie Chart", model);\r
+ \r
Resource jfreechart = GraphUtils.create2(g, jfree.Chart,\r
l0.HasName, "PieChart" + UUID.randomUUID().toString(),\r
- l0.HasLabel, NameUtils.findFreshLabel(g, "Pie Chart", model),\r
+ l0.HasLabel, label,\r
l0.PartOf, model,\r
jfree.Chart_visibleBorder, true,\r
jfree.Chart_borderWidth, 3);\r
l0.PartOf, jfreechart,\r
l0.ConsistsOf, dataset\r
);\r
+ Layer0Utils.addCommentMetadata(g, "Created new Pie Chart " + label + " " + jfreechart);\r
+ \r
}\r
\r
});\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.diagram.stubs.G2DResource;\r
import org.simantics.jfreechart.chart.ChartUtils;\r
import org.simantics.layer0.Layer0;\r
\r
@Override\r
public void perform(WriteGraph g) throws DatabaseException {\r
+ g.markUndoPoint();\r
Layer0 l0 = Layer0.getInstance(g);\r
JFreeChartResource jfree = JFreeChartResource.getInstance(g);\r
G2DResource g2d = G2DResource.getInstance(g);\r
SysdynResource SR = SysdynResource.getInstance(g);\r
\r
+ String label = NameUtils.findFreshLabel(g, "SensitivityChart", model);\r
+ \r
Resource jfreechart = GraphUtils.create2(g, jfree.Chart,\r
l0.HasName, "SensitivityChart" + UUID.randomUUID().toString(),\r
- l0.HasLabel, NameUtils.findFreshLabel(g, "SensitivityChart", model),\r
+ l0.HasLabel, label,\r
l0.PartOf, model,\r
jfree.Chart_visibleBorder, true,\r
jfree.Chart_borderWidth, 3);\r
l0.ConsistsOf, dataset,\r
l0.ConsistsOf, domainAxis,\r
l0.ConsistsOf, rangeAxis);\r
+ Layer0Utils.addCommentMetadata(g, "Created new Sensitivity Chart " + label + " " + jfreechart);\r
}\r
\r
});\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.diagram.stubs.G2DResource;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
\r
@Override\r
public void perform(WriteGraph g) throws DatabaseException {\r
+ g.markUndoPoint();\r
Layer0 l0 = Layer0.getInstance(g);\r
JFreeChartResource jfree = JFreeChartResource.getInstance(g);\r
G2DResource g2d = G2DResource.getInstance(g);\r
-\r
+ \r
+ String label = NameUtils.findFreshLabel(g, "Chart", model);\r
+ \r
Resource jfreechart = GraphUtils.create2(g, jfree.Chart,\r
l0.HasName, "Chart" + UUID.randomUUID().toString(),\r
- l0.HasLabel, NameUtils.findFreshLabel(g, "Chart", model),\r
+ l0.HasLabel, label,\r
l0.PartOf, model,\r
jfree.Chart_visibleBorder, true,\r
jfree.Chart_borderWidth, 3);\r
l0.ConsistsOf, dataset,\r
l0.ConsistsOf, domainAxis,\r
l0.ConsistsOf, rangeAxis);\r
+ Layer0Utils.addCommentMetadata(g, "Created new Line Chart " + label + " " + jfreechart);\r
}\r
\r
});\r
import org.simantics.db.common.request.PossibleObjectWithType;\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.issues.ontology.IssueResource;\r
import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
public void applyText(WriteGraph graph, Resource input, String text)\r
throws DatabaseException {\r
graph.claimLiteral(input, SysdynResource.getInstance(graph).SysdynModel_timeUnit, text);\r
+ Layer0Utils.addCommentMetadata(graph, "Modified " + graph.getRelatedValue2(input, Layer0.getInstance(graph).HasName, Bindings.STRING) + " time unit to " + text);\r
}\r
});\r
\r
@SuppressWarnings("unchecked")\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
-\r
+ graph.markUndoPoint();\r
T single = (T) ISelectionUtils.filterSingleSelection((ISelection)input, clazz);\r
applyText(graph, single, textValue);\r
- \r
}\r
\r
});\r
}\r
\r
public static Resource saveIC(WriteGraph graph, Variable input, String name) throws DatabaseException {\r
- \r
+ graph.markUndoPoint();\r
Resource model = Variables.getModel(graph, input);\r
Resource child = Layer0Utils.getPossibleChild(graph, model, name);\r
SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
graph.addLiteral(ic, SYSDYN.InitialCondition_HasInitialValues, SYSDYN.InitialCondition_HasInitialValues_Inverse, MOD.PartialIC, IC, PartialIC.BINDING);\r
graph.claim(model, L0.ConsistsOf, ic);\r
\r
+ Layer0Utils.addCommentMetadata(graph, "Saved new Initial Condition " + name + " " + ic);\r
return ic;\r
\r
}\r
\r
public static void assignIC(WriteGraph graph, Variable experiment, String name) throws DatabaseException {\r
-\r
+ graph.markUndoPoint();\r
System.err.println("assignIC " + experiment.getURI(graph));\r
\r
Layer0 L0 = Layer0.getInstance(graph);\r
\r
graph.deny(exp, SYSDYN.Experiment_ic);\r
graph.claim(exp, SYSDYN.Experiment_ic, ic);\r
- \r
+ Layer0Utils.addCommentMetadata(graph, "Assigned Initial Condition " + graph.getRelatedValue2(ic, L0.HasName, Bindings.STRING) + " to experiment " + graph.getRelatedValue2(exp, L0.HasName, Bindings.STRING));\r
}\r
\r
public static void deassignIC(WriteGraph graph, Variable experiment) throws DatabaseException {\r
}\r
\r
public static void deleteIC(WriteGraph graph, Variable input, String name) throws DatabaseException {\r
-\r
+ graph.markUndoPoint();\r
Resource model = Variables.getModel(graph, input);\r
Resource child = Layer0Utils.getPossibleChild(graph, model, name);\r
SysdynResource SYSDYN = SysdynResource.getInstance(graph);\r
\r
if((child != null) && graph.isInstanceOf(child, SYSDYN.InitialCondition))\r
RemoverUtil.remove(graph, child);\r
- \r
+ Layer0Utils.addCommentMetadata(graph, "Deleted Initial Condition " + graph.getRelatedValue2(child, Layer0.getInstance(graph).HasName, Bindings.STRING));\r
}\r
\r
}\r
import org.simantics.db.common.request.ObjectsWithType;\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.layer0.Layer0;\r
public class SheetUtils {\r
\r
public static Resource createSheet(WriteGraph graph, Resource book, String name, String[] colNames, int[] colWidths) throws DatabaseException {\r
-\r
+ graph.markUndoPoint();\r
Layer0 L0 = Layer0.getInstance(graph);\r
SpreadsheetResource sr = SpreadsheetResource.getInstance(graph);\r
\r
// graph.claim(result, L0.HasChildVariables, L0.HasChildVariables_Inverse, newCell);\r
// \r
// }\r
-\r
+ Layer0Utils.addCommentMetadata(graph, "Created new Spreadsheet " + name + " " + result.toString());\r
return result;\r
\r
}\r