コード例 #1
0
        /// <summary>
        /// Update the UI representations of the build tools status.
        /// </summary>
        public void UpdateBuildToolStatus()
        {
            ModuleProxy moduleProxy = ModuleProxy.GetInstance();

            if (moduleProxy.Module != null)
            {
                moduleProxy.Module.UpdateBuildToolStatus();
            }
        }
コード例 #2
0
ファイル: Module.cs プロジェクト: watchsnow/QuickSharp
        private void ActivatePlugin()
        {
            ModuleProxy.GetInstance().Module = this;

            _applicationManager = ApplicationManager.GetInstance();
            _applicationStorage = ApplicationStorage.GetInstance();

            _applicationManager.RegisterOptionsPageFactory(
                delegate { return(new BuildToolOptionsPage()); });

            if (!_applicationManager.ClientProfile.HaveFlag(
                    ClientFlags.BuildToolsDisableBuildSettingsPage))
            {
                _applicationManager.RegisterOptionsPageFactory(
                    delegate { return(new BuildSettingsOptionsPage()); });
            }

            _applicationManager.DocumentFilterHandlers.Add(
                GetSourceFilesFilter);

            #region UI Elements

            bool disableCompilerUI = _applicationManager.ClientProfile.
                                     HaveFlag(ClientFlags.BuildToolsDisableCompilerUI);

            _output = _applicationManager.GetDockedForm(
                QuickSharp.Output.Constants.DOCKED_FORM_KEY)
                      as OutputForm;

            /* Menu items */

            _toolsMenuCompile = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_COMPILE,
                Resources.MainToolsMenuCompile,
                Resources.Compile,
                Keys.Shift | Keys.F5, null, UI_TOOLS_MENU_COMPILE_Click);

            _toolsMenuCompileAll = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_COMPILE_ALL,
                Resources.MainToolsMenuCompileAll,
                null,
                Keys.F6, null, UI_TOOLS_MENU_COMPILE_ALL_Click,
                true);

            _toolsMenuRun = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_RUN,
                Resources.MainToolsMenuRun,
                Resources.Run,
                Keys.Control | Keys.F5, null, UI_TOOLS_MENU_RUN_Click);

            if (disableCompilerUI)
            {
                _toolsMenuRun.Tag = new ToolStripItemTag {
                    IncludeSeparator = true
                }
            }
            ;

            ToolStripMenuItem toolsMenu = _mainForm.GetMenuItemByName(
                QuickSharp.Core.Constants.UI_TOOLS_MENU);

            if (!disableCompilerUI)
            {
                toolsMenu.DropDownItems.Insert(0, _toolsMenuCompileAll);
                toolsMenu.DropDownItems.Insert(0, _toolsMenuCompile);
            }

            toolsMenu.DropDownItems.Insert(0, _toolsMenuRun);
            toolsMenu.DropDownOpening +=
                new EventHandler(ToolsMenu_DropDownOpening);

            /* Toolbar */

            _toolbarCompile = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_COMPILE,
                Resources.ToolbarCompile,
                Resources.Compile, UI_TOOLBAR_COMPILE_Click,
                true);
            _toolbarCompile.Enabled = false;
            _toolbarCompileSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_COMPILE_SELECT,
                UI_TOOLBAR_COMPILE_SELECT_Click);
            _toolbarCompileSelect.Enabled          = false;
            _toolbarCompileSelect.DropDownOpening +=
                new EventHandler(ToolbarCompileSelect_DropDownOpening);

            _toolbarRun = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_RUN,
                Resources.ToolbarRun,
                Resources.Run, UI_TOOLBAR_RUN_Click);

            if (disableCompilerUI)
            {
                _toolbarRun.Tag = new ToolStripItemTag {
                    IncludeSeparator = true
                }
            }
            ;

            _toolbarRun.Enabled = false;
            _toolbarRunSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_RUN_SELECT,
                UI_TOOLBAR_RUN_SELECT_Click);
            _toolbarRunSelect.Enabled          = false;
            _toolbarRunSelect.DropDownOpening +=
                new EventHandler(ToolbarRunSelect_DropDownOpening);

            _toolbarPin = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_PIN,
                Resources.ToolbarPinFile,
                Resources.Pin, UI_TOOLBAR_PIN_Click,
                true);
            _toolbarPin.Enabled = false;
            _toolbarPinSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_PIN_SELECT,
                UI_TOOLBAR_PIN_SELECT_Click);
            _toolbarPinSelect.Enabled = false;

            if (!disableCompilerUI)
            {
                _mainForm.MainToolbar.Items.Add(_toolbarCompile);
                _mainForm.MainToolbar.Items.Add(_toolbarCompileSelect);
            }

            _mainForm.MainToolbar.Items.Add(_toolbarRun);
            _mainForm.MainToolbar.Items.Add(_toolbarRunSelect);
            _mainForm.MainToolbar.Items.Add(_toolbarPin);
            _mainForm.MainToolbar.Items.Add(_toolbarPinSelect);

            #endregion

            _mainForm.ClientWindow.ActiveDocumentChanged +=
                new EventHandler(MainForm_ActiveDocumentChanged);

            _buildToolManager = BuildToolManager.GetInstance();
            _buildToolManager.LoadSettings();
            _buildToolManager.LoadTools();
            _buildToolManager.BuildTools.SortTools();
            _buildToolManager.LoadPinnedFiles();

            _mainForm.FormClosed +=
                new FormClosedEventHandler(MainForm_FormClosed);

            _applicationManager.FileSystemChange +=
                new MessageHandler(UpdatePinFileStatus);

            PluginManager.GetInstance().PluginPostActivate +=
                new MessageHandler(PostActivationHandler);
        }