]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/UndoContext.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / UndoContext.java
diff --git a/bundles/org.simantics.db/src/org/simantics/db/UndoContext.java b/bundles/org.simantics.db/src/org/simantics/db/UndoContext.java
new file mode 100644 (file)
index 0000000..5fb0c86
--- /dev/null
@@ -0,0 +1,68 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.db;\r
+\r
+import java.util.Collection;\r
+import java.util.List;\r
+\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.exception.NoHistoryException;\r
+import org.simantics.db.service.UndoRedoSupport;\r
+\r
+public interface UndoContext {\r
+    /**\r
+     * Called when operation has been committed successfully.\r
+     * \r
+     * @param operation\r
+     */\r
+    void commitOk(Operation operation) throws DatabaseException;\r
+    /**\r
+     * \r
+     * @return the last successfully committed operation.\r
+     */\r
+    Operation getLast() throws DatabaseException;\r
+\r
+    /**\r
+     * \r
+     * @return the operation list.\r
+     */\r
+    Collection<Operation> getAll() throws DatabaseException;\r
+    \r
+    /**\r
+     * \r
+     * @return the redo operation list.\r
+     */\r
+    Collection<Operation> getRedoList() throws DatabaseException ;\r
+\r
+    /**\r
+     * Revert the effects of last successfully committed operation in this context.\r
+     * \r
+     * @param support\r
+     * @return Number of change sets reverted. Zero if operation is not supported.\r
+     * @throws NoHistoryException if there is no undo history left in this context\r
+     * @throws DatabaseException\r
+     */\r
+    List<Operation> undo(UndoRedoSupport support, int count) throws NoHistoryException, DatabaseException;\r
+    /**\r
+     * Revert the effects of last successfully committed undo operation in this context.\r
+     * \r
+     * @param support\r
+     * @throws NoHistoryException if there is no redo history left in this context\r
+     * @throws DatabaseException\r
+     */\r
+    List<Operation> redo(UndoRedoSupport support, int count) throws NoHistoryException, DatabaseException;\r
+\r
+    /**\r
+     * Remove all undo information. \r
+     */\r
+    void clear();\r
+}\r