IVsEditorFactory2::RetargetCodeOrDesignerToOpen Method (String^, Guid, IVsHierarchy^, UInt32, UInt32, UInt32, Guid, String^, Guid)

 

Re-targets the item opened by View commands.

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.9.0 (in Microsoft.VisualStudio.Shell.Interop.9.0.dll)

int RetargetCodeOrDesignerToOpen(
	String^ pszMkDocumentSource,
	[InAttribute] Guid% rguidLogicalViewSource,
	IVsHierarchy^ pvHier,
	unsigned int itemidSource,
	[OutAttribute] unsigned int% pitemidTarget,
	[OutAttribute] unsigned int% pgrfEditorFlags,
	[OutAttribute] Guid% pguidEditorTypeTarget,
	[OutAttribute] String^% pbstrPhysicalViewTarget,
	[OutAttribute] Guid% pguidLogicalViewTarget
)

Parameters

pszMkDocumentSource
Type: System::String^

Original document to open

rguidLogicalViewSource
Type: System::Guid

A view specified by a LogicalViewID value.

pvHier
Type: Microsoft.VisualStudio.Shell.Interop::IVsHierarchy^

A IVsHierarchy hierarchy object.

itemidSource
Type: System::UInt32

A DWORD uniquely identifying the source node within a IVsHierarchy.

pitemidTarget
Type: System::UInt32

A DWORD uniquely identifying the target node within a IVsHierarchy.

pgrfEditorFlags
Type: System::UInt32

A __VSSPECIFICEDITORFLAGS value specifying editor options.

pguidEditorTypeTarget
Type: System::Guid

A GUID specifying the new target editor type.

pbstrPhysicalViewTarget
Type: System::String^

A string specifying the physical view target.

pguidLogicalViewTarget
Type: System::Guid

A GUID specifying the logical view target.s

Return Value

Type: System::Int32

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

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.

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);
Return to top
Show: