Exemple #1
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);
            }
        }
        /// <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);
        }
Exemple #3
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);
        }
        /// <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);
        }
Exemple #5
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;
        }