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