private void ActivatePlugin() { DocumentType documentTypeHtml = new DocumentType(Constants.DOCUMENT_TYPE_HTML); DocumentType documentTypeHtm = new DocumentType(Constants.DOCUMENT_TYPE_HTM); DocumentType documentTypeCss = new DocumentType(Constants.DOCUMENT_TYPE_CSS); DocumentManager documentManager = DocumentManager.GetInstance(); documentManager.RegisterDocumentLanguage( documentTypeHtml, Constants.SCINTILLA_LANGUAGE_HTML); documentManager.RegisterDocumentLanguage( documentTypeHtm, Constants.SCINTILLA_LANGUAGE_HTML); documentManager.RegisterDocumentLanguage( documentTypeCss, Constants.SCINTILLA_LANGUAGE_CSS); ApplicationManager applicationManager = ApplicationManager.GetInstance(); OpenDocumentHandler openHandler = applicationManager.GetOpenDocumentHandler( QuickSharp.TextEditor.Constants.DOCUMENT_TYPE_TXT); if (openHandler != null) { applicationManager.RegisterOpenDocumentHandler( documentTypeHtml, openHandler); applicationManager.RegisterOpenDocumentHandler( documentTypeHtm, openHandler); applicationManager.RegisterOpenDocumentHandler( documentTypeCss, openHandler); } /* * Add to the non-source tools list (create if necessary). */ ApplicationStorage appStore = ApplicationStorage.GetInstance(); List <String> nonToolSourceTypes = appStore.Get( Constants.APP_STORE_KEY_NON_TOOL_SOURCE_TYPES, typeof(List <String>)) as List <String>; if (nonToolSourceTypes != null) { nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_HTML); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_HTM); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_CSS); } }
private void ActivatePlugin() { ModuleProxy.GetInstance().Module = this; _applicationManager = ApplicationManager.GetInstance(); _pluginManager = PluginManager.GetInstance(); _sqlConnectionManager = SqlConnectionManager.GetInstance(); _sqlConnectionManager.Load(); /* * Enable SqlMetal/DMBL extract features if client flag set. */ bool enableSqlMetal = _applicationManager.ClientProfile.HaveFlag( ClientFlags.SqlManagerEnableDbmlExtract); _output = _applicationManager.GetDockedForm( QuickSharp.Output.Constants.DOCKED_FORM_KEY) as OutputForm; _toolsMenuRunQuery = MenuTools.CreateMenuItem( Constants.UI_TOOLS_MENU_RUN_QUERY, Resources.MainToolsMenuRunQuery, Resources.RunQuery, Keys.F5, null, UI_TOOLBAR_RUN_SQL_QUERY_Click, true); ToolStripMenuItem toolsMenu = _mainForm.GetMenuItemByName( QuickSharp.Core.Constants.UI_TOOLS_MENU); int index = toolsMenu.DropDownItems.IndexOfKey( QuickSharp.Core.Constants.UI_TOOLS_MENU_OPTIONS); /* * If menu not found insert at the top. */ if (index == -1) { index = 0; } toolsMenu.DropDownItems.Insert(index, _toolsMenuRunQuery); /* * Create toolbar buttons. */ _toolbarSqlConnection = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SQL_CONNECTION, Resources.ToolbarSqlConnection, Resources.SqlConnection, UI_TOOLBAR_SQL_CONNECTION_Click, true); _toolbarSqlConnection.ToolTipText = Resources.ToolbarActivateConnection; _toolbarSqlConnectionSelect = MenuTools.CreateToolbarDropDownButton( Constants.UI_TOOLBAR_SQL_CONNECTION_SELECT, null); _toolbarSqlConnectionSelect.DropDownOpening += new EventHandler( ToolbarSqlConnectionSelect_DropDownOpening); _toolbarSqlRunQuery = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SQL_RUN_QUERY, Resources.ToolbarSqlRunQuery, Resources.RunQuery, UI_TOOLBAR_RUN_SQL_QUERY_Click); _toolbarSqlExtractDbml = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SQL_EXTRACT_DBML, Resources.ToolbarSqlExtractDbml, Resources.ExtractDbml, UI_TOOLBAR_SQL_EXTRACT_DBML_Click); _mainForm.MainToolbar.Items.Add(_toolbarSqlConnection); _mainForm.MainToolbar.Items.Add(_toolbarSqlConnectionSelect); _mainForm.MainToolbar.Items.Add(_toolbarSqlRunQuery); if (enableSqlMetal) { _mainForm.MainToolbar.Items.Add(_toolbarSqlExtractDbml); } _mainForm.FormClosing += new FormClosingEventHandler(MainForm_FormClosing); _mainForm.ClientWindow.ActiveDocumentChanged += new EventHandler(ClientWindow_ActiveDocumentChanged); _applicationManager.RegisterOptionsPageFactory( delegate { return(new SqlConnectionsOptionsPage()); }); if (enableSqlMetal) { _applicationManager.RegisterOptionsPageFactory( delegate { return(new SqlMetalOptionsPage()); }); } _applicationManager.FileSystemChange += new MessageHandler(UpdateUI); /* * We don't have any build tools but we want SQL files * recognised as source files. Register with the * non-tool source files list in the application store. */ ApplicationStorage appStore = ApplicationStorage.GetInstance(); /* * We have no dependency on the BuildTools plugin so we * can't assume the non-tool source list has been created. * Use the Get method to create the list if it doesn't exist. */ List <String> nonToolSourceTypes = appStore.Get( Constants.APP_STORE_KEY_NON_TOOL_SOURCE_TYPES, typeof(List <String>)) as List <String>; if (nonToolSourceTypes != null) { nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_SQL); } UpdateUI(); }
private void ActivatePlugin() { /* * Register the document types. */ DocumentManager documentManager = DocumentManager.GetInstance(); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASAX, Constants.SCINTILLA_LANGUAGE_ASPX); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASCX, Constants.SCINTILLA_LANGUAGE_ASPX); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASHX, Constants.SCINTILLA_LANGUAGE_CS); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASMX, Constants.SCINTILLA_LANGUAGE_CS); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASPX, Constants.SCINTILLA_LANGUAGE_ASPX); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_MASTER, Constants.SCINTILLA_LANGUAGE_ASPX); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_CONFIG, Constants.SCINTILLA_LANGUAGE_XML); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_SITEMAP, Constants.SCINTILLA_LANGUAGE_XML); /* * Define the document handlers. */ ApplicationManager applicationManager = ApplicationManager.GetInstance(); OpenDocumentHandler openHandler = applicationManager.GetOpenDocumentHandler( QuickSharp.TextEditor.Constants.DOCUMENT_TYPE_TXT); if (openHandler != null) { applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASAX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASCX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASHX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASMX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASPX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_MASTER, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_CONFIG, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_SITEMAP, openHandler); } /* * We don't have any build tools but we want ASP.NET files * recognised as source files. Register with the * non-tool source files list in the application store. */ ApplicationStorage appStore = ApplicationStorage.GetInstance(); /* * We have no dependency on the BuildTools plugin so we * can't assume the non-tool source list has been created. * Use the Get method to create the list if it doesn't exist. */ List <String> nonToolSourceTypes = appStore.Get( Constants.APP_STORE_KEY_NON_TOOL_SOURCE_TYPES, typeof(List <String>)) as List <String>; if (nonToolSourceTypes != null) { nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASAX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASCX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASHX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASMX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASPX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_CONFIG); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_MASTER); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_SITEMAP); } }