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)

Syntax

'Déclaration
Function OpenLinkedUndo ( _
    dwFlags As UInteger, _
    pszDescription As String _
) As Integer
'Utilisation
Dim instance As IVsLinkedUndoTransactionManager
Dim dwFlags As UInteger
Dim pszDescription As String
Dim returnValue As Integer

returnValue = instance.OpenLinkedUndo(dwFlags, _
    pszDescription)
int OpenLinkedUndo(
    uint dwFlags,
    string pszDescription
)
int OpenLinkedUndo(
    [InAttribute] unsigned int dwFlags, 
    [InAttribute] String^ pszDescription
)
abstract OpenLinkedUndo : 
        dwFlags:uint32 * 
        pszDescription:string -> int 
function OpenLinkedUndo(
    dwFlags : uint, 
    pszDescription : String
) : int

Parameters

  • dwFlags
    Type: System.UInt32
    [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
    Type: System.String
    [in] Localized string that describes this action; appears in the undo/redo dropdown menus. This value may not be nulla null reference (Nothing in Visual Basic).

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

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.

.NET Framework Security

See Also

Reference

IVsLinkedUndoTransactionManager Interface

IVsLinkedUndoTransactionManager Members

Microsoft.VisualStudio.TextManager.Interop Namespace