X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fservice%2FUndoRedoSupport.java;h=37a6023c085506e0164e72a02390106a78238780;hb=e460fd6f0af60314e2ca28391ef7ff2043016d97;hp=36b5a96a2a2867fbb5903b0f13287007a3b9dd28;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db/src/org/simantics/db/service/UndoRedoSupport.java b/bundles/org.simantics.db/src/org/simantics/db/service/UndoRedoSupport.java index 36b5a96a2..37a6023c0 100644 --- a/bundles/org.simantics.db/src/org/simantics/db/service/UndoRedoSupport.java +++ b/bundles/org.simantics.db/src/org/simantics/db/service/UndoRedoSupport.java @@ -1,88 +1,88 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.db.service; - -import java.util.Collection; -import java.util.List; - -import org.simantics.db.Operation; -import org.simantics.db.Session; -import org.simantics.db.UndoContext; -import org.simantics.db.WriteGraph; -import org.simantics.db.exception.ConflictException; -import org.simantics.db.exception.DatabaseException; - -public interface UndoRedoSupport { - - Operation getCurrent(); - - /** - * @param operations - * @return Operation generated by the undo operation. - * - * @throws DatabaseException - * @throws ConflictException - */ - Operation undo(Collection operations) - throws DatabaseException, ConflictException; - - /** - * This is just a wrapper for the undo operation above. See documentation above - * - * @param op the operation that will be undone. - * @throws DatabaseException - * @throws ConflictException - */ - void undo(Operation op) - throws DatabaseException, ConflictException; - - /** - * Undo first count operations from the session undo list. - * - * @param count number of operations to revert and move to sessions redo list. - * @return Number of changes sets reverted. - * @throws DatabaseException - * @throws ConflictException - */ - int undo(Session session, int count) - throws DatabaseException; - - List undoAndReturnOperations(Session session, int count) - throws DatabaseException; - - List redo(Session session, int count) - throws DatabaseException; - - int undoTo(Session session, long changeSet) - throws DatabaseException; - - int initUndoListFrom(Session session, long changeSet) - throws DatabaseException; - - /** - * @return undo context used by given session. If session does not support - * undo or session is disposed, null will be returned. - */ - UndoContext getUndoContext(Session session); - - interface ChangeListener { - /** - * Called when undo/redo lists change. - */ - void onChanged(); - } - void subscribe(ChangeListener changeListener); - void cancel(ChangeListener changeListener); - - void addExternalOperation(WriteGraph graph, ExternalOperation op); - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.db.service; + +import java.util.Collection; +import java.util.List; + +import org.simantics.db.Operation; +import org.simantics.db.Session; +import org.simantics.db.UndoContext; +import org.simantics.db.WriteGraph; +import org.simantics.db.exception.ConflictException; +import org.simantics.db.exception.DatabaseException; + +public interface UndoRedoSupport { + + Operation getCurrent(); + + /** + * @param operations + * @return Operation generated by the undo operation. + * + * @throws DatabaseException + * @throws ConflictException + */ + Operation undo(Collection operations) + throws DatabaseException, ConflictException; + + /** + * This is just a wrapper for the undo operation above. See documentation above + * + * @param op the operation that will be undone. + * @throws DatabaseException + * @throws ConflictException + */ + void undo(Operation op) + throws DatabaseException, ConflictException; + + /** + * Undo first count operations from the session undo list. + * + * @param count number of operations to revert and move to sessions redo list. + * @return Number of changes sets reverted. + * @throws DatabaseException + * @throws ConflictException + */ + int undo(Session session, int count) + throws DatabaseException; + + List undoAndReturnOperations(Session session, int count) + throws DatabaseException; + + List redo(Session session, int count) + throws DatabaseException; + + int undoTo(Session session, long changeSet) + throws DatabaseException; + + int initUndoListFrom(Session session, long changeSet) + throws DatabaseException; + + /** + * @return undo context used by given session. If session does not support + * undo or session is disposed, null will be returned. + */ + UndoContext getUndoContext(Session session); + + interface ChangeListener { + /** + * Called when undo/redo lists change. + */ + void onChanged(); + } + void subscribe(ChangeListener changeListener); + void cancel(ChangeListener changeListener); + + void addExternalOperation(WriteGraph graph, ExternalOperation op); + +}