@Override\r
public void applyText(WriteGraph graph, Resource issue, String text) throws DatabaseException {\r
Layer0 l0 = Layer0.getInstance(graph);\r
- graph.claimLiteral(issue, l0.HasLabel, text);\r
String safeName = NameUtils.findFreshName(graph, text, graph.getSingleObject(issue, l0.PartOf), l0.ConsistsOf, "%s%d");\r
graph.claimLiteral(issue, l0.HasName, safeName);\r
}\r
nameLabel.setText("Name");\r
\r
name = new TrackedText(composite, support, SWT.BORDER);\r
- name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
- name.addModifyListener(new ModelLabelModifier(context, Layer0.URIs.HasLabel));\r
+ name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName));\r
+ name.addModifyListener(new ModelLabelModifier(context, Layer0.URIs.HasName));\r
name.setInputValidator(new ModelNameInputValidator(support));\r
\r
startTimeLabel = new Label(composite, SWT.NONE);\r
Resource container = graph.getSingleObject(model, l0.PartOf);\r
String freshName = NameUtils.findFreshName(graph, name, container, l0.ConsistsOf, "%s%d");\r
graph.claimLiteral(model, l0.HasName, freshName, Bindings.STRING);\r
- graph.claimLiteral(model, l0.HasLabel, freshName, Bindings.STRING);\r
\r
// TODO: this must be updated if/when simulation parameters are moved \r
// from model to experiment\r
sr.SysdynModel,
l0.PartOf, project,
l0.HasName, modelName,
- l0.HasLabel, modelName,
L0X.IsActivatedBy, project
);
return status;\r
\r
subTask(monitor, "Validate model");\r
- Collection<Resource> confs = Simantics.getSession().syncRequest(new Read<Collection<Resource>>() {\r
+ Collection<Resource> confs = session.syncRequest((ReadGraph graph) -> findAllConfigurations(graph, ModelRoot));\r
\r
- @Override\r
- public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
- return findAllConfigurations(graph, ModelRoot);\r
- }\r
+ session.syncRequest((WriteGraph graph) -> {\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ Layer0 L0 = Layer0.getInstance(graph);\r
\r
+ for(Resource r : findAllModelsAndModules(graph, ModelRoot)) {\r
+ if(graph.isInstanceOf(r, sr.SysdynModel)) {\r
+ graph.deny(r, L0.HasLabel);\r
+ }\r
+ }\r
});\r
\r
\r
\r
return configurations;\r
}\r
-\r
+ \r
private static Collection<Resource> findAllModelsAndModules(ReadGraph graph, Resource modelRoot) throws DatabaseException {\r
Layer0 L0 = Layer0.getInstance(graph);\r
SysdynResource sr = SysdynResource.getInstance(graph);\r