IVsEditorFactory2.RetargetCodeOrDesignerToOpen Method
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)
Syntax
'Declaration
Function RetargetCodeOrDesignerToOpen ( _
pszMkDocumentSource As String, _
ByRef rguidLogicalViewSource As Guid, _
pvHier As IVsHierarchy, _
itemidSource As UInteger, _
<OutAttribute> ByRef pitemidTarget As UInteger, _
<OutAttribute> ByRef pgrfEditorFlags As UInteger, _
<OutAttribute> ByRef pguidEditorTypeTarget As Guid, _
<OutAttribute> ByRef pbstrPhysicalViewTarget As String, _
<OutAttribute> ByRef pguidLogicalViewTarget As Guid _
) As Integer
int RetargetCodeOrDesignerToOpen(
string pszMkDocumentSource,
ref Guid rguidLogicalViewSource,
IVsHierarchy pvHier,
uint itemidSource,
out uint pitemidTarget,
out uint pgrfEditorFlags,
out Guid pguidEditorTypeTarget,
out string pbstrPhysicalViewTarget,
out Guid pguidLogicalViewTarget
)
int RetargetCodeOrDesignerToOpen(
[InAttribute] String^ pszMkDocumentSource,
[InAttribute] Guid% rguidLogicalViewSource,
[InAttribute] IVsHierarchy^ pvHier,
[InAttribute] unsigned int itemidSource,
[OutAttribute] unsigned int% pitemidTarget,
[OutAttribute] unsigned int% pgrfEditorFlags,
[OutAttribute] Guid% pguidEditorTypeTarget,
[OutAttribute] String^% pbstrPhysicalViewTarget,
[OutAttribute] Guid% pguidLogicalViewTarget
)
abstract RetargetCodeOrDesignerToOpen :
pszMkDocumentSource:string *
rguidLogicalViewSource:Guid byref *
pvHier:IVsHierarchy *
itemidSource:uint32 *
pitemidTarget:uint32 byref *
pgrfEditorFlags:uint32 byref *
pguidEditorTypeTarget:Guid byref *
pbstrPhysicalViewTarget:string byref *
pguidLogicalViewTarget:Guid byref -> int
function RetargetCodeOrDesignerToOpen(
pszMkDocumentSource : String,
rguidLogicalViewSource : Guid,
pvHier : IVsHierarchy,
itemidSource : uint,
pitemidTarget : uint,
pgrfEditorFlags : uint,
pguidEditorTypeTarget : Guid,
pbstrPhysicalViewTarget : String,
pguidLogicalViewTarget : Guid
) : int
Parameters
pszMkDocumentSource
Type: StringOriginal document to open
rguidLogicalViewSource
Type: Guid%A view specified by a LogicalViewID value.
pvHier
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchyA IVsHierarchy hierarchy object.
itemidSource
Type: UInt32A DWORD uniquely identifying the source node within a IVsHierarchy.
pitemidTarget
Type: UInt32%A DWORD uniquely identifying the target node within a IVsHierarchy.
pgrfEditorFlags
Type: UInt32%A __VSSPECIFICEDITORFLAGS value specifying editor options.
pguidEditorTypeTarget
Type: Guid%A GUID specifying the new target editor type.
pbstrPhysicalViewTarget
Type: String%A string specifying the physical view target.
pguidLogicalViewTarget
Type: Guid%A GUID specifying the logical view target.s
Return Value
Type: Int32
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);
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.