コード例 #1
0
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="configIn">The configuration in.</param>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        public void AssociateWithNewProject(ISonarConfiguration configIn, Resource project, string workingDir, ISourceControlProvider provider, IIssueTrackerPlugin sourcePlugin)
        {
            this.sourceDir         = workingDir;
            this.associatedProject = project;
            this.config            = configIn;

            if (this.CommandText.Equals("Add to Existent Plan"))
            {
                Application.Current.Dispatcher.Invoke(
                    delegate
                {
                    this.SubItems.Clear();

                    foreach (var item in this.rest.GetAvailableActionPlan(this.config, project.Key))
                    {
                        var menu = new PlanMenu(this.rest, this.model, this.manager, false)
                        {
                            CommandText = item.Name, IsEnabled = true
                        };
                        menu.AssociateWithNewProject(configIn, project, workingDir, provider, sourcePlugin);
                        this.SubItems.Add(menu);
                    }
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlanMenu" /> class.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="registerPool">if set to <c>true</c> [register pool].</param>
        private PlanMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, PlanMenu parent = null, bool registerPool = true)
        {
            this.parent  = parent;
            this.manager = manager;
            this.model   = model;
            this.rest    = rest;

            this.ExecuteCommand = new RelayCommand(this.OnPlanCommand);
            this.SubItems       = new ObservableCollection <IMenuItem>();

            if (registerPool)
            {
                AssociationModel.RegisterNewModelInPool(this);
            }
        }
コード例 #3
0
        /// <summary>
        /// The make menu.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="manager">The manager.</param>
        /// <returns>
        /// The <see cref="IMenuItem" />.
        /// </returns>
        public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager)
        {
            var topLel = new PlanMenu(rest, model, manager)
            {
                CommandText = "Plan", IsEnabled = false
            };

            topLel.SubItems.Add(new PlanMenu(rest, model, manager)
            {
                CommandText = "Add to Existent Plan", IsEnabled = false
            });
            topLel.SubItems.Add(new PlanMenu(rest, model, manager)
            {
                CommandText = "Unplan", IsEnabled = true
            });
            topLel.SubItems.Add(new PlanMenu(rest, model, manager)
            {
                CommandText = "Associate to new plan", IsEnabled = true
            });
            return(topLel);
        }
コード例 #4
0
        /// <summary>
        /// Reloads the plan data.
        /// </summary>
        /// <param name="parentMenu">The parent menu.</param>
        private void ReloadPlanData(PlanMenu parentMenu)
        {
            foreach (var item in parentMenu.SubItems)
            {
                if (item.CommandText.Equals("Add to Existent Plan"))
                {
                    Application.Current.Dispatcher.Invoke(
                        delegate
                    {
                        item.SubItems.Clear();

                        foreach (var plan in this.rest.GetAvailableActionPlan(this.config, this.associatedProject.Key))
                        {
                            var menu = new PlanMenu(this.rest, this.model, this.manager, null, false)
                            {
                                CommandText = plan.Name, IsEnabled = true
                            };
                            menu.AssociateWithNewProject(this.config, this.associatedProject, this.sourceDir, this.provider, this.sourcePlugin);
                            item.SubItems.Add(menu);
                        }
                    });
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="configIn">The configuration in.</param>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        public void AssociateWithNewProject(ISonarConfiguration configIn, Resource project, string workingDir, ISourceControlProvider provider, IIssueTrackerPlugin sourcePlugin)
        {
            this.sourceDir = workingDir;
            this.associatedProject = project;
            this.config = configIn;

            if (this.CommandText.Equals("Add to Existent Plan"))
            {
                Application.Current.Dispatcher.Invoke(
                    delegate
                    {
                        this.SubItems.Clear();

                        foreach (var item in this.rest.GetAvailableActionPlan(this.config, project.Key))
                        {
                            var menu = new PlanMenu(this.rest, this.model, this.manager, false) { CommandText = item.Name, IsEnabled = true };
                            menu.AssociateWithNewProject(configIn, project, workingDir, provider, sourcePlugin);
                            this.SubItems.Add(menu);
                        }
                    });
            }
        }
コード例 #6
0
        /// <summary>
        /// The make menu.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="manager">The manager.</param>
        /// <returns>
        /// The <see cref="IMenuItem" />.
        /// </returns>
        public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager)
        {
            var topLel = new PlanMenu(rest, model, manager) { CommandText = "Plan", IsEnabled = false };

            topLel.SubItems.Add(new PlanMenu(rest, model, manager) { CommandText = "Add to Existent Plan", IsEnabled = false });
            topLel.SubItems.Add(new PlanMenu(rest, model, manager) { CommandText = "Unplan", IsEnabled = true });
            topLel.SubItems.Add(new PlanMenu(rest, model, manager) { CommandText = "Associate to new plan", IsEnabled = true });
            return topLel;
        }
コード例 #7
0
        /// <summary>
        /// Reloads the plan data.
        /// </summary>
        /// <param name="parentMenu">The parent menu.</param>
        private void ReloadPlanData(PlanMenu parentMenu)
        {
            foreach (var item in parentMenu.SubItems)
            {
                if (item.CommandText.Equals("Add to Existent Plan"))
                {
                    Application.Current.Dispatcher.Invoke(
                        delegate
                        {
                            item.SubItems.Clear();

                            foreach (var plan in this.rest.GetAvailableActionPlan(this.config, this.associatedProject.Key))
                            {
                                var menu = new PlanMenu(this.rest, this.model, this.manager, null, false) { CommandText = plan.Name, IsEnabled = true };
                                menu.AssociateWithNewProject(this.config, this.associatedProject, this.sourceDir, this.provider, this.sourcePlugin);
                                item.SubItems.Add(menu);
                            }
                        });
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlanMenu" /> class.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="registerPool">if set to <c>true</c> [register pool].</param>
        private PlanMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, PlanMenu parent = null, bool registerPool = true)
        {
            this.parent = parent;
            this.manager = manager;
            this.model = model;
            this.rest = rest;

            this.ExecuteCommand = new RelayCommand(this.OnPlanCommand);
            this.SubItems = new ObservableCollection<IMenuItem>();

            if (registerPool)
            {
                AssociationModel.RegisterNewModelInPool(this);
            }
        }