import org.simantics.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.browsing.ui.content.Labeler.Modifier;\r
import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
+import org.simantics.databoard.Bindings;\r
import org.simantics.db.Resource;\r
import org.simantics.db.Session;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.utils.ListUtils;\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
SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
+ graph.markUndoPoint();\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
for(Resource redeclaration : graph.getObjects(data, sr.Redeclaration_replacedEnumeration_Inverse)) {\r
graph.deny(redeclaration, sr.Module_redeclaration_Inverse);\r
}\r
}\r
\r
+ String enumerationName = graph.getPossibleRelatedValue2(data, Layer0.getInstance(graph).HasName, Bindings.STRING);\r
RemoverUtil.remove(graph, data);\r
- \r
+ Layer0Utils.addCommentMetadata(graph, "Removed Enumeration " + enumerationName + " "+ data.toString());\r
}\r
});\r
} catch (DatabaseException e) {\r
import org.simantics.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.browsing.ui.content.Labeler.Modifier;\r
import org.simantics.browsing.ui.graph.impl.LabelModifier;\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.layer0.Layer0;\r
import org.simantics.project.IProject;\r
import org.simantics.simulation.project.IExperimentManager;\r
import org.simantics.sysdyn.SysdynResource;\r
if(resultSets != null)\r
for(Resource resultSet : resultSets) \r
SimulationResultSetNode.unlinkResultSet(graph, resultSet);\r
+ String ontologyName = graph.getPossibleRelatedValue2(data, Layer0.getInstance(graph).HasName, Bindings.STRING);\r
RemoverUtil.remove(graph, data);\r
+ Layer0Utils.addCommentMetadata(graph, "Removed experiment " + ontologyName + " "+ data.toString());\r
}\r
});\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.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.browsing.ui.content.Labeler.Modifier;\r
import org.simantics.browsing.ui.graph.impl.LabelModifier;\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.utils.NameUtils;\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.procedure.Listener;\r
import org.simantics.db.request.Read;\r
\r
@Override\r
public void execute(final String result) {\r
- SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+ if (result == null)\r
+ return;\r
+ Simantics.getSession().asyncRequest(new WriteRequest() {\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
Layer0 l0 = Layer0.getInstance(graph);\r
SimulationResource sim = SimulationResource.getInstance(graph);\r
Resource configuration = graph.getPossibleObject(data, sim.HasConfiguration);\r
+ \r
+ String label = graph.getPossibleRelatedValue2(configuration, l0.HasLabel, Bindings.STRING);\r
+ if (label != null)\r
+ return;\r
+ \r
graph.claimLiteral(configuration, l0.HasLabel, result);\r
+ Layer0Utils.addCommentMetadata(graph, "Created ModelNode to model browser for model " + result);\r
}\r
});\r
}\r
return new WriteRequest() {\r
@Override\r
public void perform(WriteGraph g) throws DatabaseException {\r
+ g.markUndoPoint();\r
Layer0 l0 = Layer0.getInstance(g);\r
+ String oldName = g.getPossibleRelatedValue2(data, l0.HasLabel, Bindings.STRING);\r
g.claimLiteral(data, l0.HasLabel, label);\r
String safeName = NameUtils.findFreshName(g, label, g.getSingleObject(data, l0.PartOf), l0.ConsistsOf, "%s%d");\r
g.claimLiteral(data, l0.HasName, safeName);\r
+ Layer0Utils.addCommentMetadata(g, "Renamed model " + oldName + " to " + label + " " + data.toString());\r
}\r
};\r
}\r
SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
+ \r
+ graph.markUndoPoint();\r
+ \r
Layer0 l0 = Layer0.getInstance(graph);\r
\r
for(Resource r : graph.getObjects(data, l0.ConsistsOf))\r
if(graph.isInstanceOf(r, SysdynResource.getInstance(graph).Result))\r
SimulationResultNode.deleteResultFiles(graph, r);\r
\r
+ String modelName = graph.getPossibleRelatedValue2(data, l0.HasName, Bindings.STRING);\r
+ String modelResource = data.toString();\r
RemoverUtil.remove(graph, data);\r
+ \r
+ Layer0Utils.addCommentMetadata(graph, "Removed model '" + modelName +"' " + modelResource);\r
}\r
});\r
} catch (DatabaseException e) {\r
import org.simantics.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.browsing.ui.content.Labeler.Modifier;\r
import org.simantics.browsing.ui.graph.impl.LabelModifier;\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.exception.ServiceException;\r
import org.simantics.db.layer0.adapter.PasteHandler;\r
import org.simantics.db.layer0.adapter.impl.DefaultPasteHandler;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.db.layer0.util.RemoverUtil;\r
import org.simantics.db.procedure.Listener;\r
import org.simantics.db.request.Read;\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
- if(configuration != null)\r
- graph.claimLiteral(configuration, Layer0.getInstance(graph).HasLabel, result);\r
+ if(configuration != null) {\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
+ String currentLabel = graph.getRelatedValue2(configuration, L0.HasLabel, Bindings.STRING);\r
+ if (!currentLabel.equals(result))\r
+ graph.claimLiteral(configuration, L0.HasLabel, result);\r
+ }\r
}\r
});\r
}\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException{\r
+ graph.markUndoPoint();\r
Layer0 l0 = Layer0.getInstance(graph);\r
StructuralResource2 st = StructuralResource2.getInstance(graph);\r
ModelingResources mr = ModelingResources.getInstance(graph);\r
RemoverUtil.remove(graph, issue);\r
}\r
}\r
+ Layer0Utils.addCommentMetadata(graph, "Removed Module Type " + graph.getRelatedValue2(type, l0.HasName, Bindings.STRING) + " " + type.toString());\r
RemoverUtil.remove(graph, type);\r
}\r
});\r
import org.simantics.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.browsing.ui.content.Labeler.Modifier;\r
import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
+import org.simantics.databoard.Bindings;\r
import org.simantics.db.Resource;\r
import org.simantics.db.Session;\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.layer0.Layer0;\r
import org.simantics.ui.SimanticsUI;\r
SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
+ String ontologyName = graph.getPossibleRelatedValue2(data, Layer0.getInstance(graph).HasName, Bindings.STRING);\r
RemoverUtil.remove(graph, data);\r
+ Layer0Utils.addCommentMetadata(graph, "Removed SCL Module " + ontologyName + " "+ data.toString());\r
}\r
});\r
} catch (DatabaseException e) {\r
import org.simantics.browsing.ui.common.node.IDropTargetNode;\r
import org.simantics.browsing.ui.content.Labeler.Modifier;\r
import org.simantics.browsing.ui.graph.impl.LabelModifier;\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.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.SharedFunctionLibraryNameValidator;\r
\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException {\r
- Layer0 l0 = Layer0.getInstance(graph);\r
- \r
- graph.deny(data, l0.PartOf);\r
- graph.deny(data, l0.IsLinkedTo_Inverse);\r
-\r
- // TODO: remove file\r
+ String ontologyName = graph.getPossibleRelatedValue2(data, Layer0.getInstance(graph).HasName, Bindings.STRING);\r
+ RemoverUtil.remove(graph, data);\r
+ Layer0Utils.addCommentMetadata(graph, "Removed Shared Function Library " + ontologyName + " "+ data.toString());\r
}\r
});\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.browsing.ui.common.node.IModifiableNode;\r
import org.simantics.browsing.ui.content.Labeler.Modifier;\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.ui.SimanticsUI;\r
+import org.simantics.layer0.Layer0;\r
import org.simantics.utils.ui.ExceptionUtils;\r
\r
public class SharedOntologyNode extends AbstractNode<Resource> implements IDeletableNode, IModifiableNode {\r
@Override\r
public void delete() throws DeleteException {\r
try {\r
- SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+ Simantics.getSession().syncRequest(new WriteRequest() {\r
@Override\r
public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
+ graph.markUndoPoint();\r
+ String ontologyName = graph.getPossibleRelatedValue2(data, Layer0.getInstance(graph).HasName, Bindings.STRING);\r
RemoverUtil.remove(graph, data);\r
+ Layer0Utils.addCommentMetadata(graph, "Removed Shared Ontology " + ontologyName + " "+ data.toString());\r
}\r
});\r
} catch (DatabaseException e) {\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.utils.OrderedSetUtils;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.diagram.content.ConnectionUtil;\r
import org.simantics.diagram.participant.ConnectionBuilder;\r
import org.simantics.diagram.participant.ControlPoint;\r
*/\r
public void create(WriteGraph graph, ConnectionJudgement judgment, Deque<ControlPoint> controlPoints,\r
TerminalInfo startTerminal, TerminalInfo endTerminal) throws DatabaseException {\r
+ \r
+ graph.markUndoPoint();\r
+ \r
// If needs a valve, we will create two separate connections\r
if(needsValve(startTerminal, endTerminal)) {\r
createValveAndConnections(graph, judgment, controlPoints, startTerminal, endTerminal);\r
else {\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
+ \r
+ Layer0Utils.addCommentMetadata(graph, "Created dependency starting from " + startElementName + " " + startElementResource + " and ending to " + endElementName + " " + endElementResource);\r
}\r
/**\r
* @param graph\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.jface.viewers.ISelection;\r
import org.eclipse.ui.handlers.HandlerUtil;\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.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.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.modeling.ModelingResources;\r
\r
@Override\r
public void perform(WriteGraph g) throws DatabaseException {\r
+ g.markUndoPoint();\r
SysdynResource sr = SysdynResource.getInstance(g);\r
Layer0 l0 = Layer0.getInstance(g);\r
\r
l0.HasName, name,\r
sr.Enumeration_enumerationIndexList, ListUtils.create(g, new ArrayList<Resource>()),\r
l0.PartOf, configuration);\r
+ Layer0Utils.addCommentMetadata(g, "Created new Enumeration " + name + " to " + g.getRelatedValue2(configuration, l0.HasLabel, Bindings.STRING));\r
}\r
});\r
return null;\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
String label = NameUtils.findFreshName(g, getNameSuggestion(), model, l0.ConsistsOf, l0.HasLabel, "%s%d");\r
Resource experiment = GraphUtils.create2(g, getExperimentType(g),\r
l0.HasLabel, label,\r
l0.PartOf, model);\r
configureExperiment(g, experiment);\r
+ Layer0Utils.addCommentMetadata(g, "Created new experiment " + label + " " + experiment.toString());\r
}\r
});\r
return null;\r
import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.exception.ResourceNotFoundException;\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
if(shared)\r
g.claim(model, l0.IsLinkedTo, functionLibrary);\r
+ \r
+ Layer0Utils.addCommentMetadata(g, "Created new Function Library " + name + " " + functionLibrary.toString());\r
}\r
});\r
}\r
import org.simantics.db.common.utils.OrderedSetUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.adapter.Template;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.diagram.synchronization.graph.DiagramGraphUtil;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.sysdyn.ui.browser.actions.newActions.NewModuleTypeAction;\r
import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\r
import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.ui.AdaptionUtils;\r
import org.simantics.utils.datastructures.ArrayMap;\r
+import org.simantics.utils.ui.AdaptionUtils;\r
\r
/**\r
* Creates a new module node for a model.\r
\r
@Override\r
public void perform(WriteGraph g) throws DatabaseException {\r
+ g.markUndoPoint();\r
SysdynResource sr = SysdynResource.getInstance(g);\r
Layer0 l0 = Layer0.getInstance(g);\r
Layer0X L0X = Layer0X.getInstance(g);\r
\r
g.claim(moduleSymbol, sr2.IsDefinedBy, OrderedSetUtils.create(g, sr2.Composite, terminal, terminal2));\r
\r
- \r
+ Layer0Utils.addCommentMetadata(g, "Created new Module Type " + name + " " + moduleType.toString());\r
}\r
});\r
return null;\r
\r
@Override\r
public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
+ graph.markUndoPoint();\r
Resource element = graph.getPossibleObject(input, ModelingResources.getInstance(graph).ComponentToElement);\r
if(element != null) {\r
G2DResource g2d = G2DResource.getInstance(graph);\r
graph.deny(element, g2d.HasFont);\r
- if(f != null)\r
+ StringBuilder sb = new StringBuilder();\r
+ if(f != null) {\r
graph.claim(element, g2d.HasFont, G2DUtils.createFont(graph, f));\r
+ sb.append(" font to " + f.getName());\r
+ }\r
graph.deny(element, g2d.HasColor);\r
- if(color != null)\r
+ if(color != null) {\r
graph.claim(element, g2d.HasColor, G2DUtils.createColor(graph, color));\r
+ sb.append(" color to " + color.getRGB());\r
+ }\r
+ sb.insert(0, "Modified");\r
+ Layer0Utils.addCommentMetadata(graph, sb.toString());\r
}\r
}\r
\r
import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.adapter.Template;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.document.DocumentResource;\r
import org.simantics.issues.ontology.IssueResource;\r
import org.simantics.layer0.Layer0;\r
\r
// TODO: remove this\r
public static Resource createModelAt(WriteGraph g, Resource library) {\r
+ \r
+ g.markUndoPoint();\r
try {\r
Layer0 l0 = Layer0.getInstance(g);\r
Layer0X L0X = Layer0X.getInstance(g);\r
\r
ProfileEntries.createStandardProfiles(g, model);\r
\r
+ Layer0Utils.addCommentMetadata(g, "Created new Sysdyn Model '" + modelName + "' " + model.toString());\r
+ \r
return model;\r
\r
} catch (DatabaseException e ) {\r