public virtual int CreateEditorInstance(uint grfCreateDoc, string pszMkDocument, string pszPhysicalView, IVsHierarchy pvHier, uint itemid, IntPtr punkDocDataExisting, out IntPtr ppunkDocView, out IntPtr ppunkDocData, out string pbstrEditorCaption, out Guid pguidCmdUI, out int pgrfCDW) { ppunkDocData = IntPtr.Zero; ppunkDocView = IntPtr.Zero; pbstrEditorCaption = ""; pguidCmdUI = new Guid("{00000000-0000-0000-e4e7-120000008400}"); pgrfCDW = 0; // Validate inputs if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0) { return(VSErr.E_INVALIDARG); } VSEditorControl form = CreateForm(); object doc; object pane; GetService <IAnkhDocumentHostService>().ProvideEditor(form, FactoryId, out doc, out pane); ppunkDocView = Marshal.GetIUnknownForObject(pane); ppunkDocData = Marshal.GetIUnknownForObject(doc); pbstrEditorCaption = form.Text; return(VSErr.S_OK); }
/// <summary> /// Creates the editor. /// </summary> /// <param name="fullPath">The full path.</param> /// <param name="form">The form.</param> /// <returns></returns> public IVsWindowFrame CreateEditor(string fullPath, VSEditorControl form) { if (string.IsNullOrEmpty(fullPath)) { throw new ArgumentNullException("fullPath"); } else if (form == null) { throw new ArgumentNullException("form"); } else if (form.Context == null) { throw new ArgumentException("Specified form doesn't have a context"); } _forms.Push(form); IVsUIHierarchy hier; uint id; IVsWindowFrame frame; VsShellUtilities.OpenDocumentWithSpecificEditor(Context, fullPath, new Guid(AnkhId.DynamicEditorId), VSConstants.LOGVIEWID_Primary, out hier, out id, out frame); if (_forms.Contains(form)) { _forms.Pop(); throw new InvalidOperationException("Can't create dynamic editor (Already open?)"); } GetService <IAnkhDocumentHostService>().InitializeEditor(form, hier, frame, id); return(frame); }
public void ProvideEditor(VSEditorControl form, Guid factoryId, out object doc, out object pane) { VSDocumentInstance dc = new VSDocumentInstance(Context, factoryId); pane = new VSDocumentFormPane(Context, dc, form); doc = dc; }
public void InitializeEditor(VSEditorControl form, IVsUIHierarchy hier, IVsWindowFrame frame, uint docid) { VSDocumentFormPane pane = null; object value; if (VSErr.Succeeded(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out value))) { pane = value as VSDocumentFormPane; } if (pane != null) { ((IVSEditorControlInit)form).InitializedForm(hier, docid, frame, pane.Host); } }
public VSDocumentFormPane(IAnkhServiceProvider context, VSDocumentInstance instance, VSEditorControl form) : base(context) { if (context == null) { throw new ArgumentNullException("context"); } else if (instance == null) { throw new ArgumentNullException("instance"); } else if (form == null) { throw new ArgumentNullException("form"); } _context = context; _instance = instance; _form = form; _host = new VSDocumentHost(this); }
public VSDocumentFormPane(IAnkhServiceProvider context, VSDocumentInstance instance, FrameworkElement host) : base(context) { if (context == null) { throw new ArgumentNullException("context"); } else if (instance == null) { throw new ArgumentNullException("instance"); } else if (host == null) { throw new ArgumentNullException("host"); } _context = context; _instance = instance; _form = null; Content = host; _host = new VSDocumentHost(this); }
void InitializeDocumentForm(VSEditorControl documentForm) { _inDocumentForm = true; Init(documentForm.Context, false); documentForm.AddCommandTarget(_nativeWindow); }