Issue tracker menus.
Inheritance: IMenuItem
Example #1
0
        /// <summary>
        /// The make menu.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="translator">The translator.</param>
        /// <returns>
        /// The <see cref="IMenuItem" />.
        /// </returns>
        public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, ISQKeyTranslator translator, IList <IIssueTrackerPlugin> plugins)
        {
            var topLel = new IssueTrackerMenu(rest, model, manager, translator, null)
            {
                CommandText = "Issue Tracker", IsEnabled = false
            };

            foreach (var plugin in plugins)
            {
                var topLevelPlugin = new IssueTrackerMenu(rest, model, manager, translator, null)
                {
                    CommandText = plugin.GetPluginDescription().Name, IsEnabled = false
                };
                topLevelPlugin.SubItems.Add(new IssueTrackerMenu(rest, model, manager, translator, plugin)
                {
                    CommandText = "new issue and attach", IsEnabled = true
                });
                topLevelPlugin.SubItems.Add(new IssueTrackerMenu(rest, model, manager, translator, plugin)
                {
                    CommandText = "attach to existent", IsEnabled = true
                });
                topLel.SubItems.Add(topLevelPlugin);
            }

            return(topLel);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IssueTrackerMenu" /> class.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="registerPool">if set to <c>true</c> [register pool].</param>
        private IssueTrackerMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, ISQKeyTranslator translator, IssueTrackerMenu parent = null, bool registerPool = true)
        {
            this.translator = translator;
            this.manager    = manager;
            this.model      = model;
            this.rest       = rest;
            this.parent     = parent;

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

            if (registerPool)
            {
                AssociationModel.RegisterNewModelInPool(this);
            }
        }
        /// <summary>
        /// The make menu.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="translator">The translator.</param>
        /// <returns>
        /// The <see cref="IMenuItem" />.
        /// </returns>
        public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, ISQKeyTranslator translator)
        {
            var topLel = new IssueTrackerMenu(rest, model, manager, translator)
            {
                CommandText = "Issue Tracker", IsEnabled = false
            };

            topLel.SubItems.Add(new IssueTrackerMenu(rest, model, manager, translator)
            {
                CommandText = "new issue and attach", IsEnabled = true
            });
            topLel.SubItems.Add(new IssueTrackerMenu(rest, model, manager, translator)
            {
                CommandText = "attach to existent", IsEnabled = true
            });
            return(topLel);
        }
        /// <summary>
        /// Generates the sub menus.
        /// </summary>
        /// <param name="id">The identifier.</param>
        private void GenerateSubMenus(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return;
            }

            foreach (var item in this.SubItems)
            {
                if (item.CommandText.Equals(id))
                {
                    return;
                }
            }

            var menu = new IssueTrackerMenu(this.rest, this.model, this.manager, this.translator, this, false)
            {
                CommandText = id,
                IsEnabled   = false
            };

            menu.UpdateServices(this.vshelper, null, null);
            menu.AssociateWithNewProject(this.config, this.associatedProject, this.sourceDir, this.sourceModel, this.issueTrackerPlugin);

            var subMenu = new IssueTrackerMenu(this.rest, this.model, this.manager, this.translator, menu, false)
            {
                CommandText = "show info", IsEnabled = true
            };

            subMenu.UpdateServices(this.vshelper, null, null);
            subMenu.AssociateWithNewProject(this.config, this.associatedProject, this.sourceDir, this.sourceModel, this.issueTrackerPlugin);

            var subMenu2 = new IssueTrackerMenu(this.rest, this.model, this.manager, this.translator, menu, false)
            {
                CommandText = "attach", IsEnabled = true
            };

            subMenu2.UpdateServices(this.vshelper, null, null);
            subMenu2.AssociateWithNewProject(this.config, this.associatedProject, this.sourceDir, this.sourceModel, this.issueTrackerPlugin);

            menu.SubItems.Add(subMenu);
            menu.SubItems.Add(subMenu2);

            this.SubItems.Add(menu);
        }
 /// <summary>
 /// The make menu.
 /// </summary>
 /// <param name="rest">The rest.</param>
 /// <param name="model">The model.</param>
 /// <param name="manager">The manager.</param>
 /// <param name="translator">The translator.</param>
 /// <returns>
 /// The <see cref="IMenuItem" />.
 /// </returns>
 public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, ISQKeyTranslator translator)
 {
     var topLel = new IssueTrackerMenu(rest, model, manager, translator) { CommandText = "Issue Tracker", IsEnabled = false };
     topLel.SubItems.Add(new IssueTrackerMenu(rest, model, manager, translator) { CommandText = "new issue and attach", IsEnabled = true });
     topLel.SubItems.Add(new IssueTrackerMenu(rest, model, manager, translator) { CommandText = "attach to existent", IsEnabled = true });
     return topLel;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IssueTrackerMenu" /> class.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="registerPool">if set to <c>true</c> [register pool].</param>
        private IssueTrackerMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, ISQKeyTranslator translator, IssueTrackerMenu parent = null, bool registerPool = true)
        {
            this.translator = translator;
            this.manager = manager;
            this.model = model;
            this.rest = rest;
            this.parent = parent;

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

            if (registerPool)
            {
                AssociationModel.RegisterNewModelInPool(this);
            }
        }
        /// <summary>
        /// Generates the sub menus.
        /// </summary>
        /// <param name="id">The identifier.</param>
        private void GenerateSubMenus(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return;
            }

            foreach (var item in this.SubItems)
            {
                if (item.CommandText.Equals(id))
                {
                    return;
                }
            }

            var menu = new IssueTrackerMenu(this.rest, this.model, this.manager, this.translator, this, false)
            {
                CommandText = id,
                IsEnabled = false
            };

            menu.UpdateServices(this.vshelper, null, null);
            menu.AssociateWithNewProject(this.config, this.associatedProject, this.sourceDir, this.sourceModel, this.issueTrackerPlugin);

            var subMenu = new IssueTrackerMenu(this.rest, this.model, this.manager, this.translator, menu, false) { CommandText = "show info", IsEnabled = true };
            subMenu.UpdateServices(this.vshelper, null, null);
            subMenu.AssociateWithNewProject(this.config, this.associatedProject, this.sourceDir, this.sourceModel, this.issueTrackerPlugin);

            var subMenu2 = new IssueTrackerMenu(this.rest, this.model, this.manager, this.translator, menu, false) { CommandText = "attach", IsEnabled = true };
            subMenu2.UpdateServices(this.vshelper, null, null);
            subMenu2.AssociateWithNewProject(this.config, this.associatedProject, this.sourceDir, this.sourceModel, this.issueTrackerPlugin);

            menu.SubItems.Add(subMenu);
            menu.SubItems.Add(subMenu2);

            this.SubItems.Add(menu);
        }