示例#1
0
        int IVsProject3.OpenItemWithSpecific(uint itemid, uint grfEditorFlags, ref Guid rguidEditorType, string pszPhysicalView, ref Guid rguidLogicalView, IntPtr punkDocDataExisting, out IVsWindowFrame ppWindowFrame)
        {
            ppWindowFrame = null;

            FileNode node = this.GetNode(itemid, false) as FileNode;

            if (node == null)
            {
                Tracer.Fail("The framework is calling us in an unexpected way because we report that we don't own the item '{0}' but Visual Studio thinks we do.", itemid);
                return(NativeMethods.E_UNEXPECTED);
            }

            // Map the raw logical view guid to one of our predetermined ones.
            VsLogicalView view;

            if (!VsLogicalView.TryFromGuid(rguidLogicalView, out view))
            {
                Tracer.WriteLine(classType, "IVsProject3.OpenItemWithSpecific", Tracer.Level.Warning, "We're getting a logical view that we don't understand: '{0}'. Using the primary view instead.", rguidLogicalView.ToString("B"));
                view = VsLogicalView.Primary;
            }

            // Do we open with the standard or a specific editor?
            bool openWithSpecificEditor = ((((__VSSPECIFICEDITORFLAGS)grfEditorFlags) & __VSSPECIFICEDITORFLAGS.VSSPECIFICEDITOR_UseEditor) == __VSSPECIFICEDITORFLAGS.VSSPECIFICEDITOR_UseEditor);

            // Tell the node to open itself.
            if (openWithSpecificEditor)
            {
                ppWindowFrame = node.OpenWithSpecificEditor(view, punkDocDataExisting, pszPhysicalView, rguidEditorType);
            }
            else
            {
                ppWindowFrame = node.OpenWithStandardEditor(view, punkDocDataExisting);
            }

            return(NativeMethods.S_OK);
        }