Example #1
0
        public override int CreateEditorInstance(
            uint grfCreateDoc,
            string pszMkDocument,
            string pszPhysicalView,
            IVsHierarchy pvHier,
            uint itemid,
            System.IntPtr punkDocDataExisting,
            out System.IntPtr ppunkDocView,
            out System.IntPtr ppunkDocData,
            out string pbstrEditorCaption,
            out Guid pguidCmdUI,
            out int pgrfCDW)
        {
            if (CalledFromVulcanDLL())
            {
                IVsEditorFactory factory = GetVulcanFactory("VulcanVSPackage.VODBServerEditorFactory", pszMkDocument) as IVsEditorFactory;
                if (factory != null)
                {
                    return(factory.CreateEditorInstance(grfCreateDoc, pszMkDocument, pszPhysicalView, pvHier, itemid, punkDocDataExisting,
                                                        out ppunkDocView, out ppunkDocData, out pbstrEditorCaption, out pguidCmdUI, out pgrfCDW));
                }
            }
            // Initialize to null
            ppunkDocView       = IntPtr.Zero;
            ppunkDocData       = IntPtr.Zero;
            pguidCmdUI         = GuidStrings.guidVODbServerEditorFactory;
            pgrfCDW            = 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 editor = new VOServerEditorPane(editorPackage);


            ppunkDocView       = Marshal.GetIUnknownForObject(editor);
            ppunkDocData       = Marshal.GetIUnknownForObject(editor);
            pbstrEditorCaption = "";

            return(VSConstants.S_OK);
        }
 public int GetStandardEditorFactory(uint dwReserved, ref Guid pguidEditorType, string pszMkDocument, ref Guid rguidLogicalView, out string pbstrPhysicalView, out IVsEditorFactory ppEF) {
     throw new NotImplementedException();
 }
 public int GetStandardEditorFactory(uint dwReserved, ref Guid pguidEditorType, string pszMkDocument, ref Guid rguidLogicalView, out string pbstrPhysicalView, out IVsEditorFactory ppEF)
 {
     throw new Exception("The method or operation is not implemented.");
 }
        internal void RegisterEditor([NotNull] IVsEditorFactory factory)
        {
            Debug.ArgumentNotNull(factory, nameof(factory));

            RegisterEditorFactory(factory);
        }
 public int GetStandardEditorFactory(uint dwReserved, ref Guid pguidEditorType, string pszMkDocument, ref Guid rguidLogicalView, out string pbstrPhysicalView, out IVsEditorFactory ppEF)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// The get standard editor factory.
 /// </summary>
 /// <param name="dwReserved">
 /// The dw reserved.
 /// </param>
 /// <param name="pguidEditorType">
 /// The pguid editor type.
 /// </param>
 /// <param name="pszMkDocument">
 /// The psz mk document.
 /// </param>
 /// <param name="rguidLogicalView">
 /// The rguid logical view.
 /// </param>
 /// <param name="pbstrPhysicalView">
 /// The pbstr physical view.
 /// </param>
 /// <param name="ppEF">
 /// The pp ef.
 /// </param>
 /// <returns>
 /// The get standard editor factory.
 /// </returns>
 /// <exception cref="Exception">
 /// </exception>
 public int GetStandardEditorFactory(uint dwReserved, ref Guid pguidEditorType, string pszMkDocument, ref Guid rguidLogicalView, out string pbstrPhysicalView, out IVsEditorFactory ppEF)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Example #7
0
        /// <include file='doc\Package.uex' path='docs/doc[@for="Package.RegisterEditorFactory"]/*' />
        /// <devdoc>
        /// Registers this editor factory with Visual Studio.
        /// If you are providing an editor factory, you should register
        /// it by overriding the Initialize method. Call 
        /// base.Initialize first, and then call RegisterEditorFactory
        /// for each editor factory.  There is no need to unregister
        /// an editor factory as Package will handle this for you.
        /// Also, if your editor factory is IDisposable, it will be
        /// disposed when it is unregistered.
        /// </devdoc>
        protected void RegisterEditorFactory(IVsEditorFactory factory) {
            IVsRegisterEditors registerEditors = GetService(typeof(SVsRegisterEditors)) as IVsRegisterEditors;
            if (registerEditors == null) {
                throw new InvalidOperationException(SR.GetString(SR.Package_MissingService, typeof(SVsRegisterEditors).FullName));
            }

            uint cookie;
            Guid riid = factory.GetType().GUID;

            NativeMethods.ThrowOnFailure( registerEditors.RegisterEditor(ref riid, factory, out cookie) );

            if (_editorFactories == null) {
                _editorFactories = new Hashtable();
            }

            _editorFactories[factory] = cookie;
        }