Exemplo n.º 1
0
        private void SetGuid(__VSFPROPID propId, Guid value)
        {
            if (_frame == null)
            {
                throw new InvalidOperationException();
            }

            Marshal.ThrowExceptionForHR((_frame.SetGuidProperty((int)propId, ref value)));
        }
Exemplo n.º 2
0
        private IVsWindowFrame CreateChildEditorFrame(Guid guidEditorFactory, SplitterPanel panel)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsUIShellOpenDocument vsUISHOD = GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;

            IVsWindowFrame      childFrame = null;
            IVsUIHierarchy      vsUIHier;
            uint                itemid;
            int                 fOpen;
            Guid                guidLogEditorView = Guid.Empty;
            IOleServiceProvider oleServiceProvider;

            int hr = vsUISHOD.IsSpecificDocumentViewOpen((IVsUIHierarchy)this.vsHierarchy, this.itemid, this.fileName, ref guidEditorFactory, null, 0, out vsUIHier, out itemid, out childFrame, out fOpen);

            if (ErrorHandler.Succeeded(hr) && fOpen != 0)
            {
                // if already open, create a copy
                hr = vsUISHOD.OpenCopyOfStandardEditor(childFrame, ref guidLogEditorView, out childFrame);
            }
            else
            {
                hr = vsUISHOD.OpenDocumentViaProjectWithSpecific(fileName,
                                                                 (uint)__VSSPECIFICEDITORFLAGS.VSSPECIFICEDITOR_UseEditor | (uint)__VSSPECIFICEDITORFLAGS.VSSPECIFICEDITOR_DoOpen,
                                                                 ref guidEditorFactory, null, ref guidLogEditorView, out oleServiceProvider, out vsUIHier, out itemid, out childFrame);
            }

            if (ErrorHandler.Failed(hr))
            {
                Debug.Fail("Failed to create/open editor!!!");
                Marshal.ThrowExceptionForHR(hr);
            }

            IVsWindowFrame parentFrame = GetService(typeof(SVsWindowFrame)) as IVsWindowFrame;

            if (parentFrame == null)
            {
                throw new System.InvalidOperationException("could not retrieve the parent Window Frame");
            }

            childFrame.SetProperty((int)__VSFPROPID2.VSFPROPID_ParentFrame, parentFrame);
            childFrame.SetProperty((int)__VSFPROPID.VSFPROPID_ViewHelper, this);
            childFrame.SetProperty((int)__VSFPROPID3.VSFPROPID_NotifyOnActivate, true);
            childFrame.SetProperty((int)__VSFPROPID5.VSFPROPID_DontAutoOpen, true);
            childFrame.SetProperty((int)__VSFPROPID2.VSFPROPID_ParentHwnd, panel.Handle);

            Guid cmdUITextEditorGuid = VSConstants.GUID_TextEditorFactory;

            childFrame.SetGuidProperty((int)__VSFPROPID.VSFPROPID_InheritKeyBindings, ref cmdUITextEditorGuid);

            return(childFrame);
        }
Exemplo n.º 3
0
 // --------------------------------------------------------------------------------------------
 /// <summary>
 /// Sets a window frame property based on a supplied GUID.
 /// </summary>
 /// <param name="propid">
 /// Identifier of the property whose values are taken from the __VSFPROPID enumeration.
 /// </param>
 /// <param name="rguid">Unique identifier of the property to set.</param>
 /// <returns>
 /// If the method succeeds, it returns S_OK. If it fails, it returns an error code.
 /// </returns>
 // --------------------------------------------------------------------------------------------
 int IVsWindowFrame.SetGuidProperty(int propid, ref Guid rguid)
 {
     return(_Frame.SetGuidProperty(propid, ref rguid));
 }