Inheritance: Microsoft.VisualStudio.Shell.Package, IVsInstalledProduct
Example #1
0
 /// <summary>
 /// Default constructor of the package.
 /// Inside this method you can place any initialization code that does not require
 /// any Visual Studio service because at this point the package object is created but
 /// not sited yet inside Visual Studio environment. The place to do all the other
 /// initialization is the Initialize method.
 /// </summary>
 public MySqlDataProviderPackage() : base()
 {
     if (Instance != null)
     {
         throw new Exception("Creating second instance of package");
     }
     Instance = this;
     Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
 }
Example #2
0
        private void OpenEditor()
        {
            IVsUIShellOpenDocument shell =
                MySqlDataProviderPackage.GetGlobalService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument;

            IVsWindowFrame winFrame = null;

            object editor     = GetEditor();
            object coreEditor = editor;

            editorGuid = editor.GetType().GUID;
            if (editor is VSCodeEditor)
            {
                coreEditor = (editor as VSCodeEditor).CodeWindow;
            }

            IntPtr viewPunk = Marshal.GetIUnknownForObject(coreEditor);
            IntPtr dataPunk = Marshal.GetIUnknownForObject(this);
            Guid   viewGuid = VSConstants.LOGVIEWID_TextView;

            // Initialize IDE editor infrastracture
            int result = shell.InitializeEditorInstance(
                (uint)0,                                // Initialization flags. We need default behavior here
                viewPunk,                               // View object reference (should implement IVsWindowPane)
                dataPunk,                               // Docuemnt object reference (should implement IVsPersistDocData)
                Moniker,                                // Document moniker
                ref editorGuid,                         // GUID of the editor type
                null,                                   // Name of the physical view. We use default
                ref viewGuid,                           // GUID identifying the logical view.
                null,                                   // Initial caption defined by the document owner. Will be initialized by the editor later
                null,                                   // Initial caption defined by the document editor. Will be initialized by the editor later
                // Pointer to the IVsUIHierarchy interface of the project that contains the document
                HierarchyAccessor.Hierarchy,
                (uint)ItemId,                           // UI hierarchy item identifier of the document in the project system
                IntPtr.Zero,                            // Pointer to the IUnknown interface of the document data object if the document data object already exists in the running document table
                // Project-specific service provider.
                HierarchyAccessor.ServiceProvider as Microsoft.VisualStudio.OLE.Interop.IServiceProvider,
                ref commandGroupGuid,                   // Command UI GUID of the commands to display for this editor.
                out winFrame                            // The window frame that contains the editor
                );

            Debug.Assert(winFrame != null &&
                         ErrorHandler.Succeeded(result), "Failed to initialize editor");

            // if our editor is a text buffer then hook up our language service
            //if (editor is TextBufferEditor)
            //{
            //    // now we tell our text buffer what language service to use
            //    Guid langSvcGuid = typeof(MySqlLanguageService).GUID;
            //    (editor as TextBufferEditor).TextBuffer.SetLanguageServiceID(ref langSvcGuid);
            //}

            winFrame.Show();
        }
Example #3
0
 /// <summary>
 /// Default constructor of the package.
 /// Inside this method you can place any initialization code that does not require 
 /// any Visual Studio service because at this point the package object is created but 
 /// not sited yet inside Visual Studio environment. The place to do all the other 
 /// initialization is the Initialize method.
 /// </summary>
 public MySqlDataProviderPackage()
   : base()
 {
   if (Instance != null)
     throw new Exception("Creating second instance of package");
   Instance = this;
   Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
 }