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