Share via


IVsEditorFactory2.RetargetCodeOrDesignerToOpen Method

Definition

Re-targets the item opened by View commands.

public:
 int RetargetCodeOrDesignerToOpen(System::String ^ pszMkDocumentSource, Guid % rguidLogicalViewSource, Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ pvHier, System::UInt32 itemidSource, [Runtime::InteropServices::Out] System::UInt32 % pitemidTarget, [Runtime::InteropServices::Out] System::UInt32 % pgrfEditorFlags, [Runtime::InteropServices::Out] Guid % pguidEditorTypeTarget, [Runtime::InteropServices::Out] System::String ^ % pbstrPhysicalViewTarget, [Runtime::InteropServices::Out] Guid % pguidLogicalViewTarget);
public int RetargetCodeOrDesignerToOpen (string pszMkDocumentSource, ref Guid rguidLogicalViewSource, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pvHier, uint itemidSource, out uint pitemidTarget, out uint pgrfEditorFlags, out Guid pguidEditorTypeTarget, out string pbstrPhysicalViewTarget, out Guid pguidLogicalViewTarget);
abstract member RetargetCodeOrDesignerToOpen : string * Guid * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 * uint32 * uint32 * Guid * string * Guid -> int
Public Function RetargetCodeOrDesignerToOpen (pszMkDocumentSource As String, ByRef rguidLogicalViewSource As Guid, pvHier As IVsHierarchy, itemidSource As UInteger, ByRef pitemidTarget As UInteger, ByRef pgrfEditorFlags As UInteger, ByRef pguidEditorTypeTarget As Guid, ByRef pbstrPhysicalViewTarget As String, ByRef pguidLogicalViewTarget As Guid) As Integer

Parameters

pszMkDocumentSource
String

Original document to open

rguidLogicalViewSource
Guid

A view specified by a LogicalViewID value.

pvHier
IVsHierarchy

A IVsHierarchy hierarchy object.

itemidSource
UInt32

A DWORD uniquely identifying the source node within a IVsHierarchy.

pitemidTarget
UInt32

A DWORD uniquely identifying the target node within a IVsHierarchy.

pgrfEditorFlags
UInt32

A __VSSPECIFICEDITORFLAGS value specifying editor options.

pguidEditorTypeTarget
Guid

A GUID specifying the new target editor type.

pbstrPhysicalViewTarget
String

A string specifying the physical view target.

pguidLogicalViewTarget
Guid

A GUID specifying the logical view target.s

Returns

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

Remarks

This method is used to retarget which item is opened for the View Code or View Designer commands for an item. This is used to cause a different file to be opened than the original source item. For example a designer item (like *.xaml) may want to open a nested code-behind item for the ViewCode command instead of the *.xaml file.

NOTE: Return S_OK and *pitemidTarget = VSITEMID_NIL, if you do not want to retarget to a different item.

The project system is expected to call OpenItemWithSpecific with the out parameters returned from this call. A project system's implementation of cmdidViewCode/cmdidViewDesigner should check if the specific IVsEditorFactory that they otherwise would have called using OpenSpecificEditor implements this interface. If so, then they should redirect which item is opened.

COM Signature

From vsshell90.idl:

HRESULT RetargetCodeOrDesignerToOpen(  
    [in]  LPCOLESTR              pszMkDocumentSource,  
    [in]  REFGUID                rguidLogicalViewSource,  
    [in]  IVsHierarchy          *pvHier,  
    [in]  VSITEMID               itemidSource,  
    [out] VSITEMID              *pitemidTarget,  
    [out] VSSPECIFICEDITORFLAGS *pgrfEditorFlags,  
    [out] GUID                  *pguidEditorTypeTarget,  
    [out] BSTR                  *pbstrPhysicalViewTarget,  
    [out] GUID                  *pguidLogicalViewTarget);  

Applies to