Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#include "nsISupports.idl"
7
8
/*
9
* The nsITransaction interface.
10
* <P>
11
* This interface is implemented by an object that needs to
12
* execute some behavior that must be tracked by the transaction manager.
13
*/
14
[scriptable, uuid(58e330c1-7b48-11d2-98b9-00805f297d89)]
15
interface nsITransaction : nsISupports
16
{
17
/**
18
* Executes the transaction.
19
*/
20
void doTransaction();
21
22
/**
23
* Restores the state to what it was before the transaction was executed.
24
*/
25
void undoTransaction();
26
27
/**
28
* Executes the transaction again. Can only be called on a transaction that
29
* was previously undone.
30
* <P>
31
* In most cases, the redoTransaction() method will actually call the
32
* doTransaction() method to execute the transaction again.
33
*/
34
void redoTransaction();
35
36
/**
37
* The transaction's transient state. This attribute is checked by
38
* the transaction manager after the transaction's Execute() method is called.
39
* If the transient state is false, a reference to the transaction is
40
* held by the transaction manager so that the transactions' undoTransaction()
41
* and redoTransaction() methods can be called. If the transient state is
42
* true, the transaction manager returns immediately after the transaction's
43
* doTransaction() method is called, no references to the transaction are
44
* maintained. Transient transactions cannot be undone or redone by the
45
* transaction manager.
46
*/
47
readonly attribute boolean isTransient;
48
49
/**
50
* Attempts to merge a transaction into "this" transaction. Both transactions
51
* must be in their undo state, doTransaction() methods already called. The
52
* transaction manager calls this method to coalesce a new transaction with
53
* the transaction on the top of the undo stack.
54
* This method returns a boolean value that indicates the merge result.
55
* A true value indicates that the transactions were merged successfully,
56
* a false value if the merge was not possible or failed. If true,
57
* the transaction manager will Release() the new transacton instead of
58
* pushing it on the undo stack.
59
* @param aTransaction the previously executed transaction to merge.
60
*/
61
boolean merge(in nsITransaction aTransaction);
62
};
63