/// <summary> /// Initializes a new instance of the <see cref="MySqlHybridScriptEditor"/> class. /// </summary> /// <param name="sp">The service provider.</param> /// <param name="pane">The pane.</param> /// <param name="scriptType">Indicates the script type.</param> internal MySqlHybridScriptEditor(ServiceProvider sp, MySqlHybridScriptEditorPane pane, ScriptLanguageType scriptType = ScriptLanguageType.JavaScript) : this() { ScriptLanguageType = scriptType; ConnectionInfoToolStripDropDownButton.Image = scriptType == ScriptLanguageType.JavaScript ? Resources.js_id : Resources.py_id; SetBaseShellConsoleEditorPromptString(); Pane = pane; ServiceProvider = sp; CodeEditor.Init(sp, this); if (Package == null) { return; } SetConnection(Package.SelectedMySqlConnection, Package.SelectedMySqlConnectionName); }
int IVsEditorFactory.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) { string s; pvHier.GetCanonicalName(itemid, out s); pgrfCdw = 0; LastDocumentPath = pszMkDocument; pguidCmdUi = VSConstants.GUID_TextEditorFactory; ppunkDocData = IntPtr.Zero; ppunkDocView = IntPtr.Zero; WindowPane editor; FileInfo fileInfo = new FileInfo(LastDocumentPath); if (fileInfo.Extension.ToLower().Equals(".mysql")) { editor = new SqlEditorPane(_serviceProvider, this); } else { ScriptLanguageType scriptType = ScriptLanguageType.JavaScript; if (fileInfo.Extension.ToLower().Equals(".mypy")) { scriptType = ScriptLanguageType.Python; } editor = new MySqlHybridScriptEditorPane(_serviceProvider, this, scriptType); } if (editor.Window != null) { ppunkDocData = Marshal.GetIUnknownForObject(editor.Window); ppunkDocView = Marshal.GetIUnknownForObject(editor); } pbstrEditorCaption = ""; return(VSConstants.S_OK); }