Example #1
0
        public int CreateEditorInstance(
                        uint grfCreateDoc,
                        string pszMkDocument,
                        string pszPhysicalView,
                        IVsHierarchy visualStudioHierarchy,
                        uint itemid,
                        IntPtr punkDocDataExisting,
                        out IntPtr ppunkDocView,
                        out IntPtr ppunkDocData,
                        out string pbstrEditorCaption,
                        out Guid commandUserInterfaceGuid,
                        out int flagsForCreateDocumentsWindow)
        {
            Debug.WriteLine(CultureInfo.CurrentCulture.ToString(), "Entering {0} CreateEditorInstace()", this);

            // Initialize to null
            ppunkDocView = IntPtr.Zero;
            ppunkDocData = IntPtr.Zero;
            commandUserInterfaceGuid = GuidList.NuSetEditoryFactoryGuid;
            flagsForCreateDocumentsWindow = 0;
            pbstrEditorCaption = null;

            // Validate inputs
            if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0)
            {
                return VSConstants.E_INVALIDARG;
            }

            if (punkDocDataExisting != IntPtr.Zero)
            {
                return VSConstants.VS_E_INCOMPATIBLEDOCDATA;
            }

            // Create the Document (editor)
            var newEditor = new EditorPane(this.editorPackage);
            ppunkDocView = Marshal.GetIUnknownForObject(newEditor);
            ppunkDocData = Marshal.GetIUnknownForObject(newEditor);
            pbstrEditorCaption = string.Empty;
            return VSConstants.S_OK;
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EditorProperties"/> class.
 /// </summary>
 /// <param name="editor">
 /// The editor.
 /// </param>
 public EditorProperties(EditorPane editor)
 {
     this.editor = editor;
 }