From: jsimomaa Date: Wed, 16 Jul 2014 08:04:42 +0000 (+0000) Subject: refs #5093 X-Git-Tag: v1.29.0~237 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=c58c4e640bd2f0ca43ed365411ea69937ba3de8f;p=simantics%2Fsysdyn.git refs #5093 Fixing undo problems in Sysdyn by adding graph.markUndoPoint() calls in write transactions git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29904 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewSpreadSheetHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewSpreadSheetHandler.java index 3a64607a..5a612a49 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewSpreadSheetHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewSpreadSheetHandler.java @@ -19,7 +19,9 @@ import org.eclipse.ui.handlers.HandlerUtil; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; +import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.sysdyn.utils.SheetUtils; import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; @@ -44,7 +46,9 @@ public class NewSpreadSheetHandler extends AbstractHandler { @Override public void perform(WriteGraph graph) throws DatabaseException { - SheetUtils.createSheet(graph, book, null, new String[] {}, new int[] {50}); + graph.markUndoPoint(); + Resource sheet = SheetUtils.createSheet(graph, book, null, new String[] {}, new int[] {50}); + Layer0Utils.addCommentMetadata(graph, "Created new Spreadsheet " + NameUtils.getSafeName(graph, sheet) + " " + sheet.toString()); } }); return null; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SheetUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SheetUtils.java index 5e93b99a..5525cc8d 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SheetUtils.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/utils/SheetUtils.java @@ -19,7 +19,6 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.layer0.Layer0; @@ -30,7 +29,6 @@ import org.simantics.spreadsheet.resource.SpreadsheetResource; public class SheetUtils { public static Resource createSheet(WriteGraph graph, Resource book, String name, String[] colNames, int[] colWidths) throws DatabaseException { - graph.markUndoPoint(); Layer0 L0 = Layer0.getInstance(graph); SpreadsheetResource sr = SpreadsheetResource.getInstance(graph); @@ -76,7 +74,6 @@ public class SheetUtils { // graph.claim(result, L0.HasChildVariables, L0.HasChildVariables_Inverse, newCell); // // } - Layer0Utils.addCommentMetadata(graph, "Created new Spreadsheet " + name + " " + result.toString()); return result; }