gecko-dev/editor/txmgr/TransactionItem.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

286 строки
8.8 KiB
C++
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2012-05-21 15:12:37 +04:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
1998-12-01 21:35:49 +03:00
#include "TransactionItem.h"
#include "mozilla/mozalloc.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/TransactionManager.h"
#include "mozilla/TransactionStack.h"
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsISupportsImpl.h"
#include "nsITransaction.h"
1998-12-01 21:35:49 +03:00
namespace mozilla {
TransactionItem::TransactionItem(nsITransaction* aTransaction)
: mTransaction(aTransaction), mUndoStack(0), mRedoStack(0) {}
1998-12-01 21:35:49 +03:00
TransactionItem::~TransactionItem() {
delete mRedoStack;
delete mUndoStack;
2008-12-10 19:46:36 +03:00
}
1998-12-01 21:35:49 +03:00
void TransactionItem::CleanUp() {
mData.Clear();
mTransaction = nullptr;
if (mRedoStack) {
mRedoStack->DoUnlink();
}
if (mUndoStack) {
mUndoStack->DoUnlink();
}
}
NS_IMPL_CYCLE_COLLECTING_NATIVE_ADDREF(TransactionItem)
NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE_WITH_LAST_RELEASE(TransactionItem,
CleanUp())
1998-12-01 21:35:49 +03:00
NS_IMPL_CYCLE_COLLECTION_CLASS(TransactionItem)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TransactionItem)
tmp->CleanUp();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TransactionItem)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mData)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTransaction)
if (tmp->mRedoStack) {
tmp->mRedoStack->DoTraverse(cb);
}
if (tmp->mUndoStack) {
tmp->mUndoStack->DoTraverse(cb);
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(TransactionItem, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(TransactionItem, Release)
nsresult TransactionItem::AddChild(TransactionItem& aTransactionItem) {
1998-12-01 21:35:49 +03:00
if (!mUndoStack) {
mUndoStack = new TransactionStack(TransactionStack::FOR_UNDO);
1998-12-01 21:35:49 +03:00
}
mUndoStack->Push(&aTransactionItem);
1998-12-01 21:35:49 +03:00
return NS_OK;
}
already_AddRefed<nsITransaction> TransactionItem::GetTransaction() {
return do_AddRef(mTransaction);
Fixes for bug #66308 ([embed] XPIDL'ize transaction manager) sr=sfraser@netscape.com,mscott@netscape.com r=jfrancis@netscape.com * nsITransaction, nsITransactionListenter, nsITransactionManager have been XPIDL'ized and moved into mozilla/editor/txmgr/idl. The versions of these interfaces in mozilla/editor/txmgr/public are being CVS removed. * Renamed Do(), Undo(), and Redo() to DoTransaction(), UndoTransaction(), and RedoTransaction() to avoid reserved word problems in languages like JS. I did a sweep through editor and mailnews to remove these methods. * PeekUndoStack() and PeekRedoStack() now return an AddRef'd pointer. * Removed GetUndoString(), GetRedoString() and Write() from the nsITransaction interface. Neither editor or mailnews really made use of these methods. * Removed Write() from the nsITransactionManager.cpp interface. * The Transaction Manager now supports weak references. * Added support for nsITransactionList to the TransactionManager to allow access to all transactions on the Undo and Redo stacks, as well as auto-aggregated transactions. * Removed all references to nsITransactionDescription from txmgr and editor. * Added nsPIEditorTransaction and made all Editor internal transactions inherit from it so we can distinguish between our transactions and ones from 3rd parties. New files checked in: editor/txmgr/idl/nsITransaction.idl editor/txmgr/idl/nsITransactionList.idl editor/txmgr/idl/nsITransactionListener.idl editor/txmgr/idl/nsITransactionManager.idl editor/txmgr/src/nsITransactionList.cpp editor/txmgr/src/nsITransactionList.h editor/idl/nsPIEditorTransaction.idl Files that were CVS removed: editor/txmgr/public/nsITransaction.h editor/txmgr/public/nsITransactionListener.h editor/txmgr/public/nsITransactionManager.h editor/txmgr/idl/nsITransactionDescription.h editor/base/IMECommitTxn.cpp editor/base/IMECommitTxn.h Files modified: editor/Makefile.in editor/makefile.win editor/base/ChangeAttributeTxn.cpp editor/base/ChangeAttributeTxn.h editor/base/CreateElementTxn.cpp editor/base/CreateElementTxn.h editor/base/DeleteElementTxn.cpp editor/base/DeleteElementTxn.h editor/base/DeleteRangeTxn.cpp editor/base/DeleteRangeTxn.h editor/base/DeleteTextTxn.cpp editor/base/DeleteTextTxn.h editor/base/EditAggregateTxn.cpp editor/base/EditAggregateTxn.h editor/base/EditTxn.cpp editor/base/EditTxn.h editor/base/IMECommitTxn.cpp editor/base/IMECommitTxn.h editor/base/IMETextTxn.cpp editor/base/IMETextTxn.h editor/base/InsertElementTxn.cpp editor/base/InsertElementTxn.h editor/base/InsertTextTxn.cpp editor/base/InsertTextTxn.h editor/base/JoinElementTxn.cpp editor/base/JoinElementTxn.h editor/base/nsEditor.cpp editor/base/nsEditorShell.cpp editor/base/nsEditorShell.h editor/base/nsEditorTxnLog.cpp editor/base/nsStyleSheetTxns.cpp editor/base/nsStyleSheetTxns.h editor/base/PlaceholderTxn.cpp editor/base/PlaceholderTxn.h editor/base/SetDocTitleTxn.cpp editor/base/SetDocTitleTxn.h editor/base/SplitElementTxn.cpp editor/base/SplitElementTxn.h editor/idl/Makefile.in editor/idl/makefile.win editor/idl/MANIFEST editor/idl/nsIEditorShell.idl editor/macbuild/editor.mcp editor/macbuild/EditorIDL.mcp editor/txmgr/idl/Makefile.in editor/txmgr/idl/makefile.win editor/txmgr/idl/MANIFEST editor/txmgr/idl/nsITransactionManager.idl editor/txmgr/macbuild/txmgr.mcp editor/txmgr/macbuild/txmgrIDL.mcp editor/txmgr/public/Makefile.in editor/txmgr/public/makefile.win editor/txmgr/public/MANIFEST editor/txmgr/src/Makefile.in editor/txmgr/src/makefile.win editor/txmgr/src/nsTransactionItem.cpp editor/txmgr/src/nsTransactionItem.h editor/txmgr/src/nsTransactionList.cpp editor/txmgr/src/nsTransactionList.h editor/txmgr/src/nsTransactionManager.cpp editor/txmgr/src/nsTransactionManager.h editor/txmgr/src/nsTransactionManagerFactory.cpp editor/txmgr/src/nsTransactionStack.cpp editor/txmgr/src/nsTransactionStack.h editor/txmgr/tests/TestTXMgr.cpp editor/ui/composer/content/EditorCommandsDebug.js editor/ui/composer/content/editorOverlay.xul editor/ui/composer/locale/en-US/editorOverlay.dtd mailnews/base/src/nsMessenger.cpp mailnews/base/util/nsMsgTxn.cpp mailnews/base/util/nsMsgTxn.h mailnews/imap/src/nsImapMailFolder.cpp mailnews/imap/src/nsImapUndoTxn.cpp mailnews/imap/src/nsImapUndoTxn.h mailnews/local/src/nsLocalMailFolder.cpp mailnews/local/src/nsLocalUndoTxn.cpp mailnews/local/src/nsLocalUndoTxn.h
2001-03-09 17:23:59 +03:00
}
nsresult TransactionItem::DoTransaction() {
if (!mTransaction) {
return NS_OK;
}
OwningNonNull<nsITransaction> transaction = *mTransaction;
nsresult rv = transaction->DoTransaction();
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"nsITransaction::DoTransaction() failed");
return rv;
1998-12-01 21:35:49 +03:00
}
nsresult TransactionItem::UndoTransaction(
TransactionManager* aTransactionManager) {
nsresult rv = UndoChildren(aTransactionManager);
if (NS_FAILED(rv)) {
NS_WARNING("TransactionItem::UndoChildren() failed");
DebugOnly<nsresult> rvIgnored = RecoverFromUndoError(aTransactionManager);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
"TransactionItem::RecoverFromUndoError() failed");
return rv;
}
if (!mTransaction) {
return NS_OK;
}
OwningNonNull<nsITransaction> transaction = *mTransaction;
rv = transaction->UndoTransaction();
if (NS_SUCCEEDED(rv)) {
return NS_OK;
}
NS_WARNING("TransactionItem::UndoTransaction() failed");
DebugOnly<nsresult> rvIgnored = RecoverFromUndoError(aTransactionManager);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
"TransactionItem::RecoverFromUndoError() failed");
return rv;
}
nsresult TransactionItem::UndoChildren(
TransactionManager* aTransactionManager) {
if (!mUndoStack) {
return NS_OK;
}
if (!mRedoStack) {
mRedoStack = new TransactionStack(TransactionStack::FOR_REDO);
}
size_t undoStackSize = mUndoStack->GetSize();
nsresult rv = NS_OK;
while (undoStackSize-- > 0) {
RefPtr<TransactionItem> transactionItem = mUndoStack->Peek();
if (!transactionItem) {
return NS_ERROR_FAILURE;
1998-12-01 21:35:49 +03:00
}
nsCOMPtr<nsITransaction> transaction = transactionItem->GetTransaction();
bool doInterrupt = false;
rv = aTransactionManager->WillUndoNotify(transaction, &doInterrupt);
if (NS_FAILED(rv)) {
NS_WARNING("TransactionManager::WillUndoNotify() failed");
return rv;
}
if (doInterrupt) {
return NS_OK;
1998-12-01 21:35:49 +03:00
}
rv = transactionItem->UndoTransaction(aTransactionManager);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"TransactionItem::UndoTransaction() failed");
if (NS_SUCCEEDED(rv)) {
transactionItem = mUndoStack->Pop();
mRedoStack->Push(transactionItem.forget());
}
nsresult rv2 = aTransactionManager->DidUndoNotify(transaction, rv);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv2),
"TransactionManager::DidUndoNotify() failed");
if (NS_SUCCEEDED(rv)) {
rv = rv2;
}
}
// XXX NS_OK if there is no Undo items or all methods work fine, otherwise,
// the result of the last item's UndoTransaction() or
// DidUndoNotify() if UndoTransaction() succeeded.
return rv;
1998-12-01 21:35:49 +03:00
}
nsresult TransactionItem::RedoTransaction(
TransactionManager* aTransactionManager) {
nsCOMPtr<nsITransaction> transaction(mTransaction);
if (transaction) {
nsresult rv = transaction->RedoTransaction();
if (NS_FAILED(rv)) {
NS_WARNING("nsITransaction::RedoTransaction() failed");
return rv;
}
}
1998-12-01 21:35:49 +03:00
nsresult rv = RedoChildren(aTransactionManager);
if (NS_SUCCEEDED(rv)) {
return NS_OK;
1998-12-01 21:35:49 +03:00
}
NS_WARNING("TransactionItem::RedoChildren() failed");
DebugOnly<nsresult> rvIgnored = RecoverFromRedoError(aTransactionManager);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
"TransactionItem::RecoverFromRedoError() failed");
return rv;
}
nsresult TransactionItem::RedoChildren(
TransactionManager* aTransactionManager) {
if (!mRedoStack) {
return NS_OK;
}
/* Redo all of the transaction items children! */
size_t redoStackSize = mRedoStack->GetSize();
nsresult rv = NS_OK;
while (redoStackSize-- > 0) {
RefPtr<TransactionItem> transactionItem = mRedoStack->Peek();
if (NS_WARN_IF(!transactionItem)) {
return NS_ERROR_FAILURE;
1998-12-01 21:35:49 +03:00
}
nsCOMPtr<nsITransaction> transaction = transactionItem->GetTransaction();
bool doInterrupt = false;
rv = aTransactionManager->WillRedoNotify(transaction, &doInterrupt);
if (NS_FAILED(rv)) {
NS_WARNING("TransactionManager::WillRedoNotify() failed");
return rv;
1998-12-01 21:35:49 +03:00
}
if (doInterrupt) {
return NS_OK;
}
1998-12-01 21:35:49 +03:00
rv = transactionItem->RedoTransaction(aTransactionManager);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"TransactionItem::RedoTransaction() failed");
if (NS_SUCCEEDED(rv)) {
transactionItem = mRedoStack->Pop();
mUndoStack->Push(transactionItem.forget());
}
// XXX Shouldn't this DidRedoNotify()? (bug 1311626)
nsresult rv2 = aTransactionManager->DidUndoNotify(transaction, rv);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv2),
"TransactionManager::DidUndoNotify() failed");
if (NS_SUCCEEDED(rv)) {
rv = rv2;
1998-12-01 21:35:49 +03:00
}
}
// XXX NS_OK if there is no Redo items or all methods work fine, otherwise,
// the result of the last item's RedoTransaction() or
// DidUndoNotify() if UndoTransaction() succeeded.
return rv;
1998-12-01 21:35:49 +03:00
}
size_t TransactionItem::NumberOfUndoItems() const {
NS_WARNING_ASSERTION(!mUndoStack || mUndoStack->GetSize() > 0,
"UndoStack cannot have no children");
return mUndoStack ? mUndoStack->GetSize() : 0;
1998-12-01 21:35:49 +03:00
}
size_t TransactionItem::NumberOfRedoItems() const {
NS_WARNING_ASSERTION(!mRedoStack || mRedoStack->GetSize() > 0,
"UndoStack cannot have no children");
return mRedoStack ? mRedoStack->GetSize() : 0;
1998-12-01 21:35:49 +03:00
}
nsresult TransactionItem::RecoverFromUndoError(
TransactionManager* aTransactionManager) {
// If this method gets called, we never got to the point where we
Fixes for bug #66308 ([embed] XPIDL'ize transaction manager) sr=sfraser@netscape.com,mscott@netscape.com r=jfrancis@netscape.com * nsITransaction, nsITransactionListenter, nsITransactionManager have been XPIDL'ized and moved into mozilla/editor/txmgr/idl. The versions of these interfaces in mozilla/editor/txmgr/public are being CVS removed. * Renamed Do(), Undo(), and Redo() to DoTransaction(), UndoTransaction(), and RedoTransaction() to avoid reserved word problems in languages like JS. I did a sweep through editor and mailnews to remove these methods. * PeekUndoStack() and PeekRedoStack() now return an AddRef'd pointer. * Removed GetUndoString(), GetRedoString() and Write() from the nsITransaction interface. Neither editor or mailnews really made use of these methods. * Removed Write() from the nsITransactionManager.cpp interface. * The Transaction Manager now supports weak references. * Added support for nsITransactionList to the TransactionManager to allow access to all transactions on the Undo and Redo stacks, as well as auto-aggregated transactions. * Removed all references to nsITransactionDescription from txmgr and editor. * Added nsPIEditorTransaction and made all Editor internal transactions inherit from it so we can distinguish between our transactions and ones from 3rd parties. New files checked in: editor/txmgr/idl/nsITransaction.idl editor/txmgr/idl/nsITransactionList.idl editor/txmgr/idl/nsITransactionListener.idl editor/txmgr/idl/nsITransactionManager.idl editor/txmgr/src/nsITransactionList.cpp editor/txmgr/src/nsITransactionList.h editor/idl/nsPIEditorTransaction.idl Files that were CVS removed: editor/txmgr/public/nsITransaction.h editor/txmgr/public/nsITransactionListener.h editor/txmgr/public/nsITransactionManager.h editor/txmgr/idl/nsITransactionDescription.h editor/base/IMECommitTxn.cpp editor/base/IMECommitTxn.h Files modified: editor/Makefile.in editor/makefile.win editor/base/ChangeAttributeTxn.cpp editor/base/ChangeAttributeTxn.h editor/base/CreateElementTxn.cpp editor/base/CreateElementTxn.h editor/base/DeleteElementTxn.cpp editor/base/DeleteElementTxn.h editor/base/DeleteRangeTxn.cpp editor/base/DeleteRangeTxn.h editor/base/DeleteTextTxn.cpp editor/base/DeleteTextTxn.h editor/base/EditAggregateTxn.cpp editor/base/EditAggregateTxn.h editor/base/EditTxn.cpp editor/base/EditTxn.h editor/base/IMECommitTxn.cpp editor/base/IMECommitTxn.h editor/base/IMETextTxn.cpp editor/base/IMETextTxn.h editor/base/InsertElementTxn.cpp editor/base/InsertElementTxn.h editor/base/InsertTextTxn.cpp editor/base/InsertTextTxn.h editor/base/JoinElementTxn.cpp editor/base/JoinElementTxn.h editor/base/nsEditor.cpp editor/base/nsEditorShell.cpp editor/base/nsEditorShell.h editor/base/nsEditorTxnLog.cpp editor/base/nsStyleSheetTxns.cpp editor/base/nsStyleSheetTxns.h editor/base/PlaceholderTxn.cpp editor/base/PlaceholderTxn.h editor/base/SetDocTitleTxn.cpp editor/base/SetDocTitleTxn.h editor/base/SplitElementTxn.cpp editor/base/SplitElementTxn.h editor/idl/Makefile.in editor/idl/makefile.win editor/idl/MANIFEST editor/idl/nsIEditorShell.idl editor/macbuild/editor.mcp editor/macbuild/EditorIDL.mcp editor/txmgr/idl/Makefile.in editor/txmgr/idl/makefile.win editor/txmgr/idl/MANIFEST editor/txmgr/idl/nsITransactionManager.idl editor/txmgr/macbuild/txmgr.mcp editor/txmgr/macbuild/txmgrIDL.mcp editor/txmgr/public/Makefile.in editor/txmgr/public/makefile.win editor/txmgr/public/MANIFEST editor/txmgr/src/Makefile.in editor/txmgr/src/makefile.win editor/txmgr/src/nsTransactionItem.cpp editor/txmgr/src/nsTransactionItem.h editor/txmgr/src/nsTransactionList.cpp editor/txmgr/src/nsTransactionList.h editor/txmgr/src/nsTransactionManager.cpp editor/txmgr/src/nsTransactionManager.h editor/txmgr/src/nsTransactionManagerFactory.cpp editor/txmgr/src/nsTransactionStack.cpp editor/txmgr/src/nsTransactionStack.h editor/txmgr/tests/TestTXMgr.cpp editor/ui/composer/content/EditorCommandsDebug.js editor/ui/composer/content/editorOverlay.xul editor/ui/composer/locale/en-US/editorOverlay.dtd mailnews/base/src/nsMessenger.cpp mailnews/base/util/nsMsgTxn.cpp mailnews/base/util/nsMsgTxn.h mailnews/imap/src/nsImapMailFolder.cpp mailnews/imap/src/nsImapUndoTxn.cpp mailnews/imap/src/nsImapUndoTxn.h mailnews/local/src/nsLocalMailFolder.cpp mailnews/local/src/nsLocalUndoTxn.cpp mailnews/local/src/nsLocalUndoTxn.h
2001-03-09 17:23:59 +03:00
// successfully called UndoTransaction() for the transaction item itself.
// Just redo any children that successfully called undo!
nsresult rv = RedoChildren(aTransactionManager);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"TransactionItem::RedoChildren() failed");
return rv;
1998-12-01 21:35:49 +03:00
}
nsresult TransactionItem::RecoverFromRedoError(
TransactionManager* aTransactionManager) {
Fixes for bug #66308 ([embed] XPIDL'ize transaction manager) sr=sfraser@netscape.com,mscott@netscape.com r=jfrancis@netscape.com * nsITransaction, nsITransactionListenter, nsITransactionManager have been XPIDL'ized and moved into mozilla/editor/txmgr/idl. The versions of these interfaces in mozilla/editor/txmgr/public are being CVS removed. * Renamed Do(), Undo(), and Redo() to DoTransaction(), UndoTransaction(), and RedoTransaction() to avoid reserved word problems in languages like JS. I did a sweep through editor and mailnews to remove these methods. * PeekUndoStack() and PeekRedoStack() now return an AddRef'd pointer. * Removed GetUndoString(), GetRedoString() and Write() from the nsITransaction interface. Neither editor or mailnews really made use of these methods. * Removed Write() from the nsITransactionManager.cpp interface. * The Transaction Manager now supports weak references. * Added support for nsITransactionList to the TransactionManager to allow access to all transactions on the Undo and Redo stacks, as well as auto-aggregated transactions. * Removed all references to nsITransactionDescription from txmgr and editor. * Added nsPIEditorTransaction and made all Editor internal transactions inherit from it so we can distinguish between our transactions and ones from 3rd parties. New files checked in: editor/txmgr/idl/nsITransaction.idl editor/txmgr/idl/nsITransactionList.idl editor/txmgr/idl/nsITransactionListener.idl editor/txmgr/idl/nsITransactionManager.idl editor/txmgr/src/nsITransactionList.cpp editor/txmgr/src/nsITransactionList.h editor/idl/nsPIEditorTransaction.idl Files that were CVS removed: editor/txmgr/public/nsITransaction.h editor/txmgr/public/nsITransactionListener.h editor/txmgr/public/nsITransactionManager.h editor/txmgr/idl/nsITransactionDescription.h editor/base/IMECommitTxn.cpp editor/base/IMECommitTxn.h Files modified: editor/Makefile.in editor/makefile.win editor/base/ChangeAttributeTxn.cpp editor/base/ChangeAttributeTxn.h editor/base/CreateElementTxn.cpp editor/base/CreateElementTxn.h editor/base/DeleteElementTxn.cpp editor/base/DeleteElementTxn.h editor/base/DeleteRangeTxn.cpp editor/base/DeleteRangeTxn.h editor/base/DeleteTextTxn.cpp editor/base/DeleteTextTxn.h editor/base/EditAggregateTxn.cpp editor/base/EditAggregateTxn.h editor/base/EditTxn.cpp editor/base/EditTxn.h editor/base/IMECommitTxn.cpp editor/base/IMECommitTxn.h editor/base/IMETextTxn.cpp editor/base/IMETextTxn.h editor/base/InsertElementTxn.cpp editor/base/InsertElementTxn.h editor/base/InsertTextTxn.cpp editor/base/InsertTextTxn.h editor/base/JoinElementTxn.cpp editor/base/JoinElementTxn.h editor/base/nsEditor.cpp editor/base/nsEditorShell.cpp editor/base/nsEditorShell.h editor/base/nsEditorTxnLog.cpp editor/base/nsStyleSheetTxns.cpp editor/base/nsStyleSheetTxns.h editor/base/PlaceholderTxn.cpp editor/base/PlaceholderTxn.h editor/base/SetDocTitleTxn.cpp editor/base/SetDocTitleTxn.h editor/base/SplitElementTxn.cpp editor/base/SplitElementTxn.h editor/idl/Makefile.in editor/idl/makefile.win editor/idl/MANIFEST editor/idl/nsIEditorShell.idl editor/macbuild/editor.mcp editor/macbuild/EditorIDL.mcp editor/txmgr/idl/Makefile.in editor/txmgr/idl/makefile.win editor/txmgr/idl/MANIFEST editor/txmgr/idl/nsITransactionManager.idl editor/txmgr/macbuild/txmgr.mcp editor/txmgr/macbuild/txmgrIDL.mcp editor/txmgr/public/Makefile.in editor/txmgr/public/makefile.win editor/txmgr/public/MANIFEST editor/txmgr/src/Makefile.in editor/txmgr/src/makefile.win editor/txmgr/src/nsTransactionItem.cpp editor/txmgr/src/nsTransactionItem.h editor/txmgr/src/nsTransactionList.cpp editor/txmgr/src/nsTransactionList.h editor/txmgr/src/nsTransactionManager.cpp editor/txmgr/src/nsTransactionManager.h editor/txmgr/src/nsTransactionManagerFactory.cpp editor/txmgr/src/nsTransactionStack.cpp editor/txmgr/src/nsTransactionStack.h editor/txmgr/tests/TestTXMgr.cpp editor/ui/composer/content/EditorCommandsDebug.js editor/ui/composer/content/editorOverlay.xul editor/ui/composer/locale/en-US/editorOverlay.dtd mailnews/base/src/nsMessenger.cpp mailnews/base/util/nsMsgTxn.cpp mailnews/base/util/nsMsgTxn.h mailnews/imap/src/nsImapMailFolder.cpp mailnews/imap/src/nsImapUndoTxn.cpp mailnews/imap/src/nsImapUndoTxn.h mailnews/local/src/nsLocalMailFolder.cpp mailnews/local/src/nsLocalUndoTxn.cpp mailnews/local/src/nsLocalUndoTxn.h
2001-03-09 17:23:59 +03:00
// If this method gets called, we already successfully called
// RedoTransaction() for the transaction item itself. Undo all
// the children that successfully called RedoTransaction(),
// then undo the transaction item itself.
nsresult rv = UndoChildren(aTransactionManager);
if (NS_FAILED(rv)) {
NS_WARNING("TransactionItem::UndoChildren() failed");
return rv;
}
if (!mTransaction) {
return NS_OK;
}
OwningNonNull<nsITransaction> transaction = *mTransaction;
rv = transaction->UndoTransaction();
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"nsITransaction::UndoTransaction() failed");
return rv;
}
1998-12-01 21:35:49 +03:00
} // namespace mozilla