/// <summary> /// Installs the tools. /// </summary> /// <param name="cxxwrapper">The cxx wrapper.</param> private void InstallTools(string cxxwrapper) { bool canInstall = QuestionUser.GetInput("this will install any third party tools using Chocolatey, elevated rights will be requested. Do you want to proceed?"); if (canInstall) { using (var process = new Process()) { process.StartInfo.RedirectStandardOutput = true; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.FileName = cxxwrapper; process.StartInfo.Arguments = "/i"; process.Start(); process.WaitForExit(); } } else { MessageDisplayBox.DisplayMessage( "External tools have not been installed.", "Tools will be installed when the wrapper for preview and full analysis runs. " + "If you dont have permissions, the recommended way is to define tools paths in a configuration file in your home folder.", helpurl: "https://github.com/jmecsoftware/sonar-cxx-msbuild-tasks#using-the-wrapper-behind-proxy-or-were-admin-rights-are-not-available"); } }
/// <summary> /// Called when [save search command]. /// </summary> private void OnSaveSearchCommand() { var search = this.GetCurrentSearch(); if (this.SelectedSearch != null) { var data = QuestionUser.GetInput("You will overwrite " + this.SelectedSearch + ", are you Sure?"); if (data) { search.Name = this.SelectedSearch; this.savedSearchModel.SaveSearch(search); } } else { this.OnSaveAsSearchCommand(); } }
/// <summary> /// The on associate command. /// </summary> private void OnPlanCommand() { try { if (this.CommandText.Equals("Associate to new plan")) { var availablePlans = this.rest.GetAvailableActionPlan(this.config, this.associatedProject.Key); var newPlan = PromptUserForNewPlan.Prompt(availablePlans); if (newPlan == null) { return; } foreach (var existentPlan in availablePlans) { if (existentPlan.Name.Equals(newPlan)) { var associatedWithExistent = QuestionUser.GetInput("Plan exists already, do you want to associate with current plan?"); if (associatedWithExistent) { var replies = this.rest.PlanIssues(this.config, this.model.SelectedItems, existentPlan.Key.ToString()); foreach (var itemreply in replies) { this.manager.ReportMessage(new Message() { Data = "Plan Operation Result: " + itemreply.Key + " : " + itemreply.Value }); } } return; } } try { var plan = this.rest.CreateNewPlan(this.config, this.associatedProject.Key, newPlan); var replies = this.rest.PlanIssues(this.config, this.model.SelectedItems, plan.Key.ToString()); foreach (var itemreply in replies) { manager.ReportMessage(new Message() { Data = "Plan Operation Result: " + itemreply.Key + " : " + itemreply.Value }); } } catch (Exception ex) { UserExceptionMessageBox.ShowException("Cannot Create Plan, Make sure you have permissions", ex); } } else { if (this.CommandText.Equals("Unplan")) { var replies = this.rest.UnPlanIssues(this.config, this.model.SelectedItems); foreach (var itemreply in replies) { this.manager.ReportMessage(new Message() { Data = "Unplan Operation Result: " + itemreply.Key + " : " + itemreply.Value }); } } else { var plans = this.rest.GetAvailableActionPlan(this.config, this.associatedProject.Key); foreach (var plan in plans) { if (plan.Name.Equals(this.CommandText)) { var replies = this.rest.PlanIssues(this.config, this.model.SelectedItems, plan.Key.ToString()); foreach (var itemreply in replies) { this.manager.ReportMessage(new Message() { Data = "Plan Operation Result: " + itemreply.Key + " : " + itemreply.Value }); } return; } } } } } catch (Exception ex) { UserExceptionMessageBox.ShowException("Cannot Perform Operation in Plan: " + ex.Message + " please check vs output log for detailed information", ex); } }