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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.db;
\r
14 import java.util.Collection;
\r
15 import java.util.List;
\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
21 public interface UndoContext {
\r
23 * Called when operation has been committed successfully.
\r
27 void commitOk(Operation operation) throws DatabaseException;
\r
30 * @return the last successfully committed operation.
\r
32 Operation getLast() throws DatabaseException;
\r
36 * @return the operation list.
\r
38 Collection<Operation> getAll() throws DatabaseException;
\r
42 * @return the redo operation list.
\r
44 Collection<Operation> getRedoList() throws DatabaseException ;
\r
47 * Revert the effects of last successfully committed operation in this context.
\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
54 List<Operation> undo(UndoRedoSupport support, int count) throws NoHistoryException, DatabaseException;
\r
56 * Revert the effects of last successfully committed undo operation in this context.
\r
59 * @throws NoHistoryException if there is no redo history left in this context
\r
60 * @throws DatabaseException
\r
62 List<Operation> redo(UndoRedoSupport support, int count) throws NoHistoryException, DatabaseException;
\r
65 * Remove all undo information.
\r