import org.simantics.db.layer0.migration.MigrationState;\r
import org.simantics.db.layer0.migration.MigrationStateKeys;\r
import org.simantics.db.layer0.migration.MigrationUtils;\r
+import org.simantics.db.layer0.util.Layer0Utils;\r
import org.simantics.db.layer0.util.ModelDependenciesBean;\r
import org.simantics.db.layer0.util.ModelDependency;\r
import org.simantics.db.layer0.util.RemoverUtil;\r
if(project == null) return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Import model: project not found", null);\r
\r
beginTask(monitor, "Import model", 10);\r
- File importFile = new File(path);\r
+ final File importFile = new File(path);\r
MigrationState state = MigrationUtils.newState();\r
state.setProperty(MigrationStateKeys.BASE_URI, SysdynResource.URIs.Migration);\r
state.setProperty(MigrationStateKeys.MODEL_FILE, importFile);\r
\r
Session session = Simantics.getSession();\r
\r
+ //TODO\r
+ // With this empty write it is possible to group change sets nicely in undo view and make good undoable collection\r
+ session.syncRequest(new WriteRequest() {\r
+ \r
+ @Override\r
+ public void perform(WriteGraph graph) throws DatabaseException {\r
+ graph.markUndoPoint();\r
+ Layer0Utils.addCommentMetadata(graph, "Imported Sysdyn model from " + importFile.getName());\r
+ }\r
+ });\r
+ \r
final ModelDependenciesBean dependenciesBean = getModelDependenciesBean(state);\r
if(dependenciesBean != null) {\r
for(ModelDependency dependency : dependenciesBean.dependencies) {\r