/// <summary>
        /// The create row context menu.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="translator">The translator.</param>
        /// <returns>
        /// The
        /// <see><cref>ObservableCollection</cref></see>
        /// .
        /// </returns>
        private ObservableCollection <IMenuItem> CreateRowContextMenu(ISonarRestService service, ISQKeyTranslator translator, IList <IIssueTrackerPlugin> issuetracketplugins)
        {
            var menu = new ObservableCollection <IMenuItem>
            {
                ChangeStatusMenu.MakeMenu(service, this.IssuesGridView, this.notificationMan),
                OpenResourceMenu.MakeMenu(service, this.IssuesGridView),
                SourceControlMenu.MakeMenu(service, this.IssuesGridView, this.notificationMan, translator),
                IssueTrackerMenu.MakeMenu(service, this.IssuesGridView, this.notificationMan, translator, issuetracketplugins),
                AssignMenu.MakeMenu(service, this.IssuesGridView, this.notificationMan),
                AssignTagMenu.MakeMenu(service, this.IssuesGridView, this.notificationMan),
                SetExclusionsMenu.MakeMenu(service, this.IssuesGridView, this.notificationMan, translator, this.analyser),
                SetSqaleMenu.MakeMenu(service, this.IssuesGridView, this.notificationMan, translator, this.analyser)
            };

            return(menu);
        }
Exemplo n.º 2
0
        /// <summary>
        /// The associate project to solution.
        /// </summary>
        /// <param name="solutionName">The solution Name.</param>
        /// <param name="solutionPath">The solution Path.</param>
        /// <param name="availableProjects">The available projects.</param>
        public void AssociateProjectToSolution(
            string solutionName,
            string solutionPath,
            ICollection <Resource> availableProjects,
            ISourceControlProvider sourceControl)
        {
            var solution = solutionName;

            if (string.IsNullOrEmpty(solution))
            {
                return;
            }

            if (!solution.ToLower().EndsWith(".sln"))
            {
                solution += ".sln";
            }

            try
            {
                this.StartAutoAssociation(solution, solutionPath, availableProjects, sourceControl);

                if (this.IsAssociated)
                {
                    this.CreateConfiguration(Path.Combine(solutionPath, "sonar-project.properties"));
                    this.InitiateAssociationToSonarProject(sourceControl);
                    var mainProject = SetExclusionsMenu.GetMainProject(this.AssociatedProject, this.model.AvailableProjects);
                    var exclusions  = this.sonarService.GetExclusions(AuthtenticationHelper.AuthToken, mainProject);
                    this.model.LocaAnalyser.UpdateExclusions(exclusions);
                }
            }
            catch (Exception ex)
            {
                this.AssociatedProject = null;
                this.IsAssociated      = false;
                this.model.StatusMessageAssociation = "Could not associate to project when solution was open: " + ex.Message;
            }
        }