Thanks!.Yes, I appreciate behaviour isn't guaranteed. But it sure looks like a bug to the end user!
This is what I'm doing. I have a multitabbed editor which can switch between the HTML Editor and the core text editor. The core text Editor is wrapped in my editor object which implements IVsOLeCommandTarget, IVsCodeWindow, IVsDocOutlineProvider, etc. To switch, I first get the HTML Editor's frame and code window interfaces like this:
logical = new Guid(LogicalViewID.Primary);
ErrorHandler.ThrowOnFailure(uiShellOpenDocument.OpenSpecificEditor(0, htmlFileName, ref GuidList.guidHTMLEditor, null, ref logical, editorCaption.Caption(), pIVsUIHierarchy, itemId, docData, serviceProvider, out htmlFrame));
ErrorHandler.ThrowOnFailure(htmlFrame.SetProperty((int)__VSFPROPID2.VSFPROPID_ParentFrame, _frame));
ErrorHandler.ThrowOnFailure(htmlFrame.SetProperty((int)__VSFPROPID2.VSFPROPID_ParentHwnd, htmlControl.Handle));
object o;
r = htmlFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out o);
htmlCodeWindow = (IVsCodeWindow)o;
htmlDocOutlineProvider = (IVsDocOutlineProvider)htmlCodeWindow;
I then show the frame (selecting the design/source view as required by the user) and the HTML Editor appears. Next, I implement the IVsDocumentProvider like this:
int IVsDocOutlineProvider.GetOutline(out IntPtr phwnd, out IOleCommandTarget ppCmdTarget) {
if (htmlFrame != null) {
int r;
r = htmlDocOutlineProvider.GetOutline(out phwnd, out ppCmdTarget);
return r;
} else {
// do my stuff
ppCmdTarget = this;
phwnd = outliner.Handle;
outliner.Refresh();
}
and similarly for the other parts of the IVsDocOutlineProvider interface. When the HTML Editor is closed, I set the htmlFrame to null and this allows me to display my Outliner rather than the HTML one.
It all works rather nicely in VS2005 but not in VS2008!
Dermot