]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db;\r
13 \r
14 import java.util.Collection;\r
15 import java.util.List;\r
16 \r
17 import org.simantics.db.exception.DatabaseException;\r
18 import org.simantics.db.exception.NoHistoryException;\r
19 import org.simantics.db.service.UndoRedoSupport;\r
20 \r
21 public interface UndoContext {\r
22     /**\r
23      * Called when operation has been committed successfully.\r
24      * \r
25      * @param operation\r
26      */\r
27     void commitOk(Operation operation) throws DatabaseException;\r
28     /**\r
29      * \r
30      * @return the last successfully committed operation.\r
31      */\r
32     Operation getLast() throws DatabaseException;\r
33 \r
34     /**\r
35      * \r
36      * @return the operation list.\r
37      */\r
38     Collection<Operation> getAll() throws DatabaseException;\r
39     \r
40     /**\r
41      * \r
42      * @return the redo operation list.\r
43      */\r
44     Collection<Operation> getRedoList() throws DatabaseException ;\r
45 \r
46     /**\r
47      * Revert the effects of last successfully committed operation in this context.\r
48      * \r
49      * @param support\r
50      * @return Number of change sets reverted. Zero if operation is not supported.\r
51      * @throws NoHistoryException if there is no undo history left in this context\r
52      * @throws DatabaseException\r
53      */\r
54     List<Operation> undo(UndoRedoSupport support, int count) throws NoHistoryException, DatabaseException;\r
55     /**\r
56      * Revert the effects of last successfully committed undo operation in this context.\r
57      * \r
58      * @param support\r
59      * @throws NoHistoryException if there is no redo history left in this context\r
60      * @throws DatabaseException\r
61      */\r
62     List<Operation> redo(UndoRedoSupport support, int count) throws NoHistoryException, DatabaseException;\r
63 \r
64     /**\r
65      * Remove all undo information. \r
66      */\r
67     void clear();\r
68 }\r