void LoadXamlEditor() { //Guid editorGuid = new Guid("FA3CD31E-987B-443A-9B81-186104E8DAC1"); // XML Editor //Guid editorGuid = new Guid("DEE6CEF9-3BCA-449A-82A6-FC757D6956FB"); // XSD Editor //Guid editorGuid = new Guid("f11acc28-31d1-4c80-a34b-f4e09d3d753c"); // XAML UI Designer (TabbedViewEditorFactory) //Guid editorGuid = new Guid("a4f9ff65-a78c-4650-866d-5069cc4127cf"); // XAML Text Editor (XamlTabEditorFactory) Guid editorGuid = VSConstants.VsEditorFactoryGuid.TextEditor_guid; IVsWindowFrame frame; IVsProject3 vsProject = (IVsProject3)_hierarchy; Guid _emptyGuid = Guid.Empty; uint editorFlags = (uint)__VSSPECIFICEDITORFLAGS.VSSPECIFICEDITOR_UseEditor | (uint)__VSSPECIFICEDITORFLAGS.VSSPECIFICEDITOR_DoOpen; ErrorHandler.ThrowOnFailure( vsProject.OpenItemWithSpecific( _itemid, editorFlags, ref editorGuid, _pszPhysicalView, ref _emptyGuid, _punkDocData, out frame)); IVsWindowFrame windowFrameOrig = GetFrame(); Debug.Assert(windowFrameOrig != null); ErrorHandler.ThrowOnFailure(frame.SetProperty((int)__VSFPROPID2.VSFPROPID_ParentFrame, windowFrameOrig)); ErrorHandler.ThrowOnFailure(frame.SetProperty((int)__VSFPROPID2.VSFPROPID_ParentHwnd, GetChildContainerHandle())); //ErrorHandler.ThrowOnFailure(frame.SetProperty((int)__VSFPROPID.VSFPROPID_pszPhysicalView, "MainFrame")); _subFrame = frame; var IID_IVsCodeWindow = typeof(IVsCodeWindow).GUID; IntPtr intPtr; _subFrame.QueryViewInterface(ref IID_IVsCodeWindow, out intPtr); _subCodeWindow = Marshal.GetObjectForIUnknown(intPtr) as IVsCodeWindow; //ErrorHandler.ThrowOnFailure(((IVsWindowFrame2)frame).ActivateOwnerDockedWindow()); /* * IVsTextView vsTextView; * ((IVsCodeWindow)_subCodeWindow).GetPrimaryView(out vsTextView); * * // Enable the "Quick Find" feature of Visual Studio: * EnableAutonomousFind(windowFrameOrig, vsTextView); * EnableAutonomousFind(_subFrame, vsTextView); * * foreach (Type theInterface in _subCodeWindow.GetType().GetInterfaces()) * { * string name = theInterface.Name; * string toString = theInterface.ToString(); * } */ }
int IVsProject.OpenItem(uint itemid, ref Guid rguidLogicalView, IntPtr punkDocDataExisting, out IVsWindowFrame ppWindowFrame) { if (_innerProject3 != null && IsHtmlFile(_innerVsHierarchy.GetItemName(itemid))) { // force HTML files opened w/o an editor type to be opened w/ our editor factory. Guid guid = GuidList.guidDjangoEditorFactory; return(_innerProject3.OpenItemWithSpecific( itemid, 0, ref guid, null, rguidLogicalView, punkDocDataExisting, out ppWindowFrame )); } return(_innerProject.OpenItem(itemid, rguidLogicalView, punkDocDataExisting, out ppWindowFrame)); }
public int OpenItem(uint itemid, ref Guid rguidLogicalView, IntPtr punkDocDataExisting, out IVsWindowFrame ppWindowFrame) { if (_innerProject3 != null && IsJavaScriptFile(GetItemName(_innerVsHierarchy, itemid))) { // force .js files opened w/o an editor type to be opened w/ our editor factory. Guid guid = typeof(NodejsEditorFactory).GUID; Guid view = Guid.Empty; int hr = _innerProject3.OpenItemWithSpecific( itemid, 0, ref guid, null, rguidLogicalView, punkDocDataExisting, out ppWindowFrame ); return(hr); } return(_innerProject.OpenItem(itemid, rguidLogicalView, punkDocDataExisting, out ppWindowFrame)); }