Export (0) Print
Expand All

IVsLinkedUndoTransactionManager.OpenLinkedUndo Method

Opens a linked undo transaction parent unit.

Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in microsoft.visualstudio.textmanager.interop.dll)

int OpenLinkedUndo (
	[InAttribute] uint dwFlags,
	[InAttribute] string pszDescription
)
int OpenLinkedUndo (
	/** @attribute InAttribute() */ UInt32 dwFlags, 
	/** @attribute InAttribute() */ String pszDescription
)
function OpenLinkedUndo (
	dwFlags : uint, 
	pszDescription : String
) : int

Parameters

dwFlags

[in] Value taken from the LinkedTransactionFlags enumeration. mdtDefault specifies the transaction to be nonstrict, which is default behavior. The other possible enum values are mdtStrict which specifies the undo linking behavior as strict, and mdtGlobal, which specifies the undo linking behavior as global. For more information, see the Remarks section later in this topic.

pszDescription

[in] Localized string that describes this action; appears in the undo/redo dropdown menus. This value may not be a null reference (Nothing in Visual Basic).

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

From textmgr.idl:

HRESULT IVsLinkedUndoTransactionManager::OpenLinkedUndo(

[in] DWORD dwFlags,

[in] const WCHAR *pszDescription

);

  • Nonstrict linked undo behavior (mdtDefault) means that some of the documents with linked undo siblings can close and still leave the other linked undo siblings on their stacks. An example of nonstrict undo behavior is found in the Microsoft® Office® suite. Microsoft Word allows one file to close during a drag-and-drop operation in such a way that one file loses information.

  • Strict linked undo behavior specifies that all the linked undo sibling stacks have to be undone together or not at all. A strict linked undo operation (mdtStrict) is usually necessary in editorial changes that involve simultaneous text changes across multiple program files, such as a header file and a Visual C++ file. This is, in fact, the model used in Visual Studio.

  • A global undo operation (mdtGlobal) is a strict undo behavior as well, the only difference being that the affected documents need not be open in the Visual Studio IDE to have their changes reversed. One example of this is if you were to undo a Rename refactoring operation on a variable name in a project. The undo reverts the rename changes in all affected documents of the project, regardless of whether they are currently open in the IDE.

    Any buffer that is opened (but not necessarily changed) during an mdtGlobal undo transaction is flagged as a buffer that participates in the global buffer undo operation. The undo stacks of those buffers (documents) are preserved if the buffers are closed and then reopened again in the same IDE session.

To enable global undo when creating your own implementation of IVsPersistDocData2 — using a VsTextBuffer as a buffer for your implementation of DocData — be sure to site the DocData properly by calling SetSite with a valid service provider. In addition, you must call OnRegisterDocData on your VsTextBuffer.

Community Additions

ADD
Show:
© 2014 Microsoft