コード例 #1
0
        private async System.Threading.Tasks.Task InitializeAsyncCommands()
        {
            if (null == CompileCommand.Instance)
            {
                await CompileCommand.InitializeAsync(mCommandsController, mErrorWindow, mOutputController, this, CommandSet, CommandIds.kCompileId);
            }

            if (null == TidyCommand.Instance)
            {
                await TidyCommand.InitializeAsync(mCommandsController, mErrorWindow, mOutputController, this, CommandSet, CommandIds.kTidyId);

                await TidyCommand.InitializeAsync(mCommandsController, mErrorWindow, mOutputController, this, CommandSet, CommandIds.kTidyFixId);
            }

            if (null == ClangFormatCommand.Instance)
            {
                await ClangFormatCommand.InitializeAsync(mCommandsController, mErrorWindow, mOutputController, this, CommandSet, CommandIds.kClangFormat);
            }

            if (null == StopClang.Instance)
            {
                await StopClang.InitializeAsync(mCommandsController, mErrorWindow, mOutputController, this, CommandSet, CommandIds.kStopClang);
            }

            if (null == SettingsCommand.Instance)
            {
                await SettingsCommand.InitializeAsync(this, CommandSet, CommandIds.kSettingsId);
            }
        }
コード例 #2
0
        public async System.Threading.Tasks.Task InitializeAsyncCommands(AsyncPackage aAsyncPackage,
                                                                         ErrorWindowController aErrorController, OutputWindowController aOutputWindowController)
        {
            if (null == CompileCommand.Instance)
            {
                await CompileCommand.InitializeAsync(this, aErrorController, aOutputWindowController, aAsyncPackage, mCommandSet, CommandIds.kCompileId);
            }

            if (null == TidyCommand.Instance)
            {
                await TidyCommand.InitializeAsync(this, aErrorController, aOutputWindowController, aAsyncPackage, mCommandSet, CommandIds.kTidyId);

                await TidyCommand.InitializeAsync(this, aErrorController, aOutputWindowController, aAsyncPackage, mCommandSet, CommandIds.kTidyFixId);
            }

            if (null == ClangFormatCommand.Instance)
            {
                await ClangFormatCommand.InitializeAsync(this, aErrorController, aOutputWindowController, aAsyncPackage, mCommandSet, CommandIds.kClangFormat);
            }

            if (null == StopClang.Instance)
            {
                await StopClang.InitializeAsync(this, aErrorController, aOutputWindowController, aAsyncPackage, mCommandSet, CommandIds.kStopClang);
            }

            if (null == SettingsCommand.Instance)
            {
                await SettingsCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kSettingsId);
            }
        }
コード例 #3
0
        public async Task InitializeCommandsAsync(AsyncPackage aAsyncPackage)
        {
            if (CompileCommand.Instance == null)
            {
                await CompileCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kCompileId);

                await CompileCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kCompileToolbarId);
            }

            if (TidyCommand.Instance == null)
            {
                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyId);

                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyToolbarId);

                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyFixId);

                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyFixToolbarId);
            }

            if (FormatCommand.Instance == null)
            {
                await FormatCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kClangFormat);

                await FormatCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kClangFormatToolbarId);
            }

            if (IgnoreFormatCommand.Instance == null)
            {
                await IgnoreFormatCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kIgnoreFormatId);
            }

            if (IgnoreCompileCommand.Instance == null)
            {
                await IgnoreCompileCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kIgnoreCompileId);
            }

            if (StopCommand.Instance == null)
            {
                await StopCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kStopClang);
            }

            if (SettingsCommand.Instance == null)
            {
                await SettingsCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kSettingsId);
            }

            if (TidyConfigCommand.Instance == null)
            {
                await TidyConfigCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kITidyExportConfigId);
            }

            if (Logout.Instance == null)
            {
                await Logout.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kLogoutId);
            }
        }
コード例 #4
0
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async System.Threading.Tasks.Task InitializeAsync(CommandsController aCommandsController,
                                                                        ErrorWindowController aErrorWindow, OutputWindowController aOutputWindow, AsyncPackage aPackage, Guid aGuid, int aId)
        {
            // Switch to the main thread - the call to AddCommand in CompileCommand's constructor requires
            // the UI thread.
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(aPackage.DisposalToken);

            OleMenuCommandService commandService = await aPackage.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService;

            Instance = new CompileCommand(commandService, aCommandsController, aErrorWindow, aOutputWindow, aPackage, aGuid, aId);
        }
コード例 #5
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            TidyCommand TidyCmd = new TidyCommand(this, CommandSet, CommandIds.kTidyId);

            CompileCommand CompileCmd = new CompileCommand(this, CommandSet, CommandIds.kCompileId);

            StopClang stopClang = new StopClang(this, CommandSet, CommandIds.kStopClang);

            SettingsCommand SettingsCmd = new SettingsCommand(this, CommandSet, CommandIds.kSettingsId);
        }
コード例 #6
0
        public async Task InitializeCommandsAsync(AsyncPackage aAsyncPackage)
        {
            if (CompileCommand.Instance == null)
            {
                await CompileCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kCompileId);

                await CompileCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kCompileToolbarId);
            }

            if (TidyCommand.Instance == null)
            {
                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyId);

                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyToolbarId);

                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyFixId);

                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyFixToolbarId);
            }

            if (FormatCommand.Instance == null)
            {
                await FormatCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kClangFormat);

                await FormatCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kClangFormatToolbarId);
            }

            if (IgnoreFormatCommand.Instance == null)
            {
                await IgnoreFormatCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kIgnoreFormatId);
            }

            if (IgnoreCompileCommand.Instance == null)
            {
                await IgnoreCompileCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kIgnoreCompileId);
            }

            if (StopCommand.Instance == null)
            {
                await StopCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kStopClang);
            }

            if (JsonCompilationDatabaseCommand.Instance == null)
            {
                await JsonCompilationDatabaseCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kJsonCompilationDatabase);
            }

            if (SettingsCommand.Instance == null)
            {
                await SettingsCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kSettingsId);
            }
        }
コード例 #7
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            mDte = (DTE2)GetService(typeof(DTE));
            mDte.Events.BuildEvents.OnBuildBegin +=
                new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin);

            string edition = mDte.Edition;

            mVsVersions.TryGetValue(mDte.Version, out string version);
            mCommandsController = new CommandsController(this, mDte);

            TidyCommand.Initialize(this, mDte, edition, version, mCommandsController);
            CompileCommand.Initialize(this, mDte, edition, version, mCommandsController);
            SettingsCommand.Initialize(this);
        }
コード例 #8
0
        public async System.Threading.Tasks.Task InitializeAsyncCommands(AsyncPackage aAsyncPackage)
        {
            if (null == CompileCommand.Instance)
            {
                await CompileCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kCompileId);
            }

            if (null == TidyCommand.Instance)
            {
                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyId);

                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyFixId);

                await TidyCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kTidyFixMenuId);
            }

            if (null == ClangFormatCommand.Instance)
            {
                await ClangFormatCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kClangFormat);
            }

            if (IgnoreFormatCommand.Instance == null)
            {
                await IgnoreFormatCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kIgnoreFormatId);
            }

            if (IgnoreCompileCommand.Instance == null)
            {
                await IgnoreCompileCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kIgnoreCompileId);
            }

            if (null == StopClang.Instance)
            {
                await StopClang.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kStopClang);
            }

            if (null == SettingsCommand.Instance)
            {
                await SettingsCommand.InitializeAsync(this, aAsyncPackage, mCommandSet, CommandIds.kSettingsId);
            }
        }
コード例 #9
0
        private void InitializeCommands()
        {
            if (null == mCompileCmd)
            {
                mCompileCmd = new CompileCommand(mCommandsController, mSolution, mDte, this, CommandSet, CommandIds.kCompileId);
            }

            if (null == mTidyCmd)
            {
                mTidyCmd = new TidyCommand(mCommandsController, mSolution, mDte, this, CommandSet, CommandIds.kTidyId);
            }

            if (null == mClangFormatCmd)
            {
                mClangFormatCmd = new ClangFormatCommand(mCommandsController, mSolution, mDte, this, CommandSet, CommandIds.kClangFormat);
            }

            if (null == mStopClangCmd)
            {
                mStopClangCmd = new StopClang(mCommandsController, mSolution, mDte, this, CommandSet, CommandIds.kStopClang);
            }
        }
コード例 #10
0
        public int OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
        {
            //Load the rest of the commands when a solution is loaded

            if (null == mTidyCmd)
            {
                mTidyCmd = new TidyCommand(this, CommandSet, CommandIds.kTidyId);
            }

            if (null == mCompileCmd)
            {
                mCompileCmd = new CompileCommand(this, CommandSet, CommandIds.kCompileId);
            }

            if (null == mStopClang)
            {
                mStopClang = new StopClang(this, CommandSet, CommandIds.kStopClang);
            }

            var generalOptions = (GeneralOptions)this.GetDialogPage(typeof(GeneralOptions));
            var currentVersion = GetPackageVersion();

            if (0 != string.Compare(generalOptions.Version, currentVersion))
            {
                var           dte           = GetService(typeof(DTE)) as DTE2;
                OutputManager outputManager = new OutputManager(dte);
                outputManager.Show();
                outputManager.AddMessage($"🎉\tClang Power Tools was upgraded to v{currentVersion}\n" +
                                         $"\tCheck out what's new at http://www.clangpowertools.com/CHANGELOG");

                generalOptions.Version = currentVersion;
                generalOptions.SaveSettingsToStorage();
            }

            return(VSConstants.S_OK);
        }
コード例 #11
0
 /// <summary>
 /// Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(Package aPackage, DTE2 aDte, string aEdition,
                               string aVersion, CommandsController aCommandsController)
 {
     Instance = new CompileCommand(aPackage, aDte, aEdition, aVersion, aCommandsController);
 }