/// <summary>Iinitialize the plug in.</summary>
        public override void InitializePlugIn()
        {
            Services.RegisterSingletonComponent <IDatabaseInspector, DatabaseInspectorForm>("DatabaseInspector");
            Services.RegisterComponent <FindObjectForm>("FindObjectForm");

            IHostWindow hostWindow = Services.HostWindow;

            hostWindow.AddPluginCommand <ShowDatabaseInspectorCommand>();
            CommandManager.GetCommandInstance <ShowDatabaseInspectorCommand>().Execute();

            ToolStripMenuItem editMenu = hostWindow.GetMenuItem("edit");

            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowFindObjectFormCommand>());

            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateSelectStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateSelectCountStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateInsertStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateUpdateStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateDeleteStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CopyTableNameCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <TruncateTableCommand>());

            hostWindow.DatabaseInspector.ColumnMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <LocateFkReferenceColumnCommand>());

            // todo: bug - the opening event is not firing....
            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(hostWindow.DatabaseInspector.ColumnMenu);
        }
Esempio n. 2
0
        /// <summary>Iinitialize the plug in.</summary>
        public override void InitializePlugIn()
        {
            Services.RegisterComponent <DbConnectionsForm>("DbConnectionsForm");
            ToolStripMenuItem editMenu = Services.HostWindow.GetMenuItem("edit");

            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <EditConnectionsFormCommand>());
            Services.HostWindow.AddToolStripCommand <EditConnectionsFormCommand>(null);
        }
        /// <summary>Iinitialize the plug in.</summary>
        public override void InitializePlugIn()
        {
            Services.RegisterComponent <IViewTable, ViewTableForm>("ViewTableForm");

            // the DB inspector may not be present
            if (Services.HostWindow.DatabaseInspector != null)
            {
                Services.HostWindow.DatabaseInspector.TableMenu.Items.Insert(
                    0, CommandControlBuilder.CreateToolStripMenuItem <ViewTableFromInspectorCommand>());
            }

            Services.HostWindow.AddPluginCommand <ViewTableFormCommand>();
        }
Esempio n. 4
0
        /// <summary>The add tool strip seperator.</summary>
        /// <param name="index">The index.</param>
        public void AddToolStripSeperator(int?index)
        {
            ToolStripSeparator item = CommandControlBuilder.CreateToolStripMenuItemSeparator();

            if (index == null)
            {
                toolStripConnection.Items.Add(item);
            }
            else
            {
                toolStripConnection.Items.Insert(index.Value, item);
            }
        }
Esempio n. 5
0
        /// <summary>The add tool strip command.</summary>
        /// <param name="index">The index.</param>
        /// <typeparam name="TCommand"></typeparam>
        public void AddToolStripCommand <TCommand>(int?index) where TCommand : ICommand, new()
        {
            ToolStripButton item = CommandControlBuilder.CreateToolStripButton <TCommand>();

            if (index == null)
            {
                toolStripConnection.Items.Add(item);
            }
            else
            {
                toolStripConnection.Items.Insert(index.Value, item);
            }
        }
Esempio n. 6
0
        /// <summary>Initializes a new instance of the <see cref="BasicEditor"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="settings">The settings.</param>
        public BasicEditor(IApplicationServices services, IApplicationSettings settings)
            : this()
        {
            _services = services;
            _settings = settings;

            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveFileCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseActiveWindowCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseAllWindowsCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CopyQueryEditorFileNameCommand>());

            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(formContextMenuStrip);
        }
Esempio n. 7
0
        /// <summary>Initializes a new instance of the <see cref="TemplateEditorForm"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="hostWindow">The host window.</param>
        public TemplateEditorForm(IApplicationServices services, IHostWindow hostWindow)
        {
            InitializeComponent();
            txtEdit.Document.DocumentChanged += DocumentDocumentChanged;
            _services   = services;
            _hostWindow = hostWindow;

            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveFileCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseActiveWindowCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseAllWindowsCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CopyQueryEditorFileNameCommand>());

            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(formContextMenuStrip);
        }
Esempio n. 8
0
        /// <summary>Initializes a new instance of the <see cref="QueryForm"/> class.</summary>
        public QueryForm()
        {
            InitializeComponent();

            txtQuery.ContextMenuStrip = contextMenuStripQuery;
            LoadHighlightingProvider();
            //txtQuery.Document.DocumentChanged += DocumentDocumentChanged;
            txtQuery.Document.ModifiedChanged += Document_ModifiedChanged;

            contextMenuStripQuery.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <ExecuteTaskCommand>());
            contextMenuStripQuery.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CancelTaskCommand>());

            editorContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveFileCommand>());
            editorContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            editorContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseActiveWindowCommand>());
            editorContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseAllWindowsCommand>());
            editorContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CopyQueryEditorFileNameCommand>());

            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(editorContextMenuStrip);
        }
        /// <summary>Iinitialize the plug in.</summary>
        public override void InitializePlugIn()
        {
            Services.RegisterComponent <GoToLineForm>();

            ToolStripMenuItem editMenu = Services.HostWindow.GetMenuItem("edit");

            // add the find to the plugins menu
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowFindTextFormCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <FindNextStringCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ReplaceStringCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowGoToLineFormCommand>());

            // get the new item and make in invisible - the shortcut key is still available etc ;-)
            ToolStripItem item = editMenu.DropDownItems["FindNextStringCommandToolStripMenuItem"];

            item.Visible = false;
            item         = editMenu.DropDownItems["ReplaceStringCommandToolStripMenuItem"];
            item.Visible = false;

            // append the button the the toolbar items
            Services.HostWindow.AddToolStripSeperator(null);
            Services.HostWindow.AddToolStripCommand <ShowFindTextFormCommand>(null);
        }
Esempio n. 10
0
        /// <summary>Iinitialize the plug in.</summary>
        public override void InitializePlugIn()
        {
            //Services.RegisterSingletonComponent<IDatabaseInspector, DatabaseInspectorForm>("DatabaseInspector");
            Services.RegisterComponent <IDatabaseInspector, DatabaseInspectorForm>();
            //var builder = new ContainerBuilder();
            ////builder.Register(c=>new DatabaseInspectorForm(c.Resolve<IApplicationServices>(),c.Resolve<IHostWindow>()));

            //builder.RegisterType<DatabaseInspectorForm>().As<IDatabaseInspector>().WithParameters(
            //new[] { new ResolvedParameter((p,c)=>p.ParameterType == typeof(IApplicationServices),(p,c)=>c.Resolve<IApplicationServices>()),
            //        new ResolvedParameter((p,c)=>p.ParameterType == typeof(IHostWindow),(p,c)=>c.Resolve<IHostWindow>())
            //    });

            //builder.Update(Services.Container);
            //Services.RegisterComponent<FindObjectForm>("FindObjectForm");
            Services.RegisterComponent <FindObjectForm>();
            IHostWindow hostWindow = Services.HostWindow;

            hostWindow.AddPluginCommand <ShowDatabaseInspectorCommand>();
            CommandManager.GetCommandInstance <ShowDatabaseInspectorCommand>().Execute();

            ToolStripMenuItem editMenu = hostWindow.GetMenuItem("edit");

            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowFindObjectFormCommand>());

            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateSelectStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateSelectCountStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateInsertStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateUpdateStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateDeleteStatementCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CopyTableNameCommand>());
            hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <TruncateTableCommand>());

            hostWindow.DatabaseInspector.ColumnMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <LocateFkReferenceColumnCommand>());

            // todo: bug - the opening event is not firing....
            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(hostWindow.DatabaseInspector.ColumnMenu);
        }
Esempio n. 11
0
        /// <summary>Iinitialize the plug in.</summary>
        public override void InitializePlugIn()
        {
            IApplicationServices services   = Services;
            IHostWindow          hostWindow = services.HostWindow;

            services.RegisterSingletonComponent <ICompletionProvider, NullCompletionProvider>("CompletionProvider");

            services.RegisterEditor <BasicEditor>(new FileEditorDescriptor("Default text editor", "default-editor"));
            services.RegisterEditor <QueryForm>(new FileEditorDescriptor("SQL Editor", "sql-editor", "sql"));
            services.RegisterEditor <BasicCSharpEditor>(new FileEditorDescriptor("C# Editor", "cs-editor", "cs"));
            services.RegisterEditor <BasicVbNetEditor>(new FileEditorDescriptor("VB/VB.NET Editor", "vb-editor", "vb"));
            services.RegisterEditor <BasicXmlEditor>(new FileEditorDescriptor("XML Editor", "xml-editor", "xml"));
            services.RegisterEditor <BasicHtmlEditor>(new FileEditorDescriptor("HTML Editor", "htm-editor", "htm", "html"));
            services.RegisterEditor <BasicEditor>(new FileEditorDescriptor("Text Editor", "txt-editor", "txt"));

            services.RegisterComponent <NewFileForm>("NewFileForm");
            services.RegisterComponent <OptionsForm>("OptionsForm");
            services.RegisterSingletonComponent <IMostRecentFilesService, MostRecentFilesService>("MostRecentFilesService");
            services.RegisterConfigurationObject <CoreMiniSqlQueryConfiguration>();

            ToolStripMenuItem fileMenu  = hostWindow.GetMenuItem("File");
            ToolStripMenuItem editMenu  = hostWindow.GetMenuItem("edit");
            ToolStripMenuItem queryMenu = hostWindow.GetMenuItem("query");
            ToolStripMenuItem helpMenu  = hostWindow.GetMenuItem("help");

            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <NewQueryFormCommand>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <NewFileCommand>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenFileCommand>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveFileCommand>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveFileAsCommand>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseActiveWindowCommand>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <PrintCommand>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile1Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile2Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile3Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile4Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile5Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile6Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile7Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile8Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile9Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile10Command>());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ExitApplicationCommand>());

            queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ExecuteTaskCommand>());
            queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <CancelTaskCommand>());
            queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveResultsAsDataSetCommand>());
            queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <RefreshDatabaseConnectionCommand>());
            queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseDatabaseConnectionCommand>());
            queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <DisplayDbModelDependenciesCommand>());

            // editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem<DuplicateLineCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <PasteAroundSelectionCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ConvertTextToLowerCaseCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ConvertTextToUpperCaseCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ConvertTextToTitleCaseCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SetLeftPasteAroundSelectionCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SetRightPasteAroundSelectionCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowOptionsFormCommand>());
            editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenConnectionFileCommand>());

            // get the new item and make in invisible - the shortcut key is still available etc ;-)
            ToolStripItem item = editMenu.DropDownItems["SetLeftPasteAroundSelectionCommandToolStripMenuItem"];

            item.Visible = false;
            item         = editMenu.DropDownItems["SetRightPasteAroundSelectionCommandToolStripMenuItem"];
            item.Visible = false;


            helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowHelpCommand>());
            helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowWebPageCommand>());
            helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowDiscussionsWebPageCommand>());
            helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <EmailAuthorCommand>());
            helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowAboutCommand>());

            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(hostWindow.Instance.MainMenuStrip);

            // toolstrip
            hostWindow.AddToolStripCommand <NewQueryFormCommand>(0);
            hostWindow.AddToolStripCommand <OpenFileCommand>(1);
            hostWindow.AddToolStripCommand <SaveFileCommand>(2);
            hostWindow.AddToolStripSeperator(3);
            hostWindow.AddToolStripCommand <ExecuteTaskCommand>(4);
            hostWindow.AddToolStripCommand <CancelTaskCommand>(5);
            hostWindow.AddToolStripSeperator(6);
            hostWindow.AddToolStripSeperator(null);
            hostWindow.AddToolStripCommand <RefreshDatabaseConnectionCommand>(null);

            hostWindow.AddPluginCommand <InsertGuidCommand>();

            ConfigureMostRecentFileList(services);

            // watch tool strip enabled properties
            // by simply iterating each one every second or so we avoid the need to track via events
            _timer          = new Timer();
            _timer.Interval = 1000;
            _timer.Tick    += TimerTick;
            _timer.Enabled  = true;
        }
Esempio n. 12
0
 /// <summary>The add plugin command.</summary>
 /// <typeparam name="TCommand"></typeparam>
 public void AddPluginCommand <TCommand>() where TCommand : ICommand, new()
 {
     pluginsMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <TCommand>());
 }
Esempio n. 13
0
 public override void InitializePlugIn()
 {
     Services.HostWindow.QueueInspector.QueueMenu.Items.Add(
         CommandControlBuilder.CreateToolStripMenuItem <GenerateQueueMessageReportCommand>());
 }