/// <summary>
        /// Initializes a new instance of the <see cref="IssuesSearchViewModel" /> class.
        /// </summary>
        /// <param name="searchModel">The search model.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="restService">The rest service.</param>
        /// <param name="translator">The translator.</param>
        public IssuesSearchViewModel(
            IssuesSearchModel searchModel,
            INotificationManager notificationManager,
            IConfigurationHelper configurationHelper,
            ISonarRestService restService,
            ISQKeyTranslator translator)
        {
            this.notificationManager = notificationManager;
            this.configurationHelper = configurationHelper;
            this.searchModel         = searchModel;
            this.Header = "Issues Search";
            this.AvailableActionPlans = new ObservableCollection <SonarActionPlan>();
            this.UsersList            = new ObservableCollection <User>();
            this.IssuesGridView       = new IssueGridViewModel(true, "SearchView", false, configurationHelper, restService, notificationManager, translator);
            this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout;
            this.SizeOfFlyout = 0;

            this.InitCommanding();

            this.ForeGroundColor   = Colors.Black;
            this.BackGroundColor   = Colors.White;
            this.CreatedBeforeDate = DateTime.Now;
            this.CreatedSinceDate  = DateTime.Now;

            SonarQubeViewModel.RegisterNewViewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerViewModel" /> class.
        /// </summary>
        /// <param name="vsenvironmenthelper">The vsenvironmenthelper.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="restservice">The restservice.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="translator">The translator.</param>
        public ServerViewModel(
            IVsEnvironmentHelper vsenvironmenthelper,
            IConfigurationHelper configurationHelper,
            ISonarRestService restservice,
            INotificationManager notificationManager,
            ISQKeyTranslator translator)
        {
            this.notificationMan     = notificationManager;
            this.vsenvironmenthelper = vsenvironmenthelper;
            this.configurationHelper = configurationHelper;
            this.restservice         = restservice;

            this.Header = "Server Analysis";
            this.AvailableActionPlans = new ObservableCollection <SonarActionPlan>();
            this.AlreadyOpenDiffs     = new SortedSet <string>();
            this.IssuesGridView       = new IssueGridViewModel(true, "ServerView", true, this.configurationHelper, this.restservice, this.notificationMan, translator);
            this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout;
            this.InitCommanding();

            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;
            this.SizeOfFlyout    = 0;
            // register model
            AssociationModel.RegisterNewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalViewModel" /> class.
        /// </summary>
        /// <param name="pluginsIn">The plugins in. TODO they must be also updatetable</param>
        /// <param name="service">The service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="translator">The translator.</param>
        public LocalViewModel(
            List <IAnalysisPlugin> pluginsIn,
            ISonarRestService service,
            IConfigurationHelper configurationHelper,
            INotificationManager notificationManager,
            ISQKeyTranslator translator)
        {
            this.keyTranslator       = translator;
            this.notificationManager = notificationManager;
            this.restService         = service;
            this.configurationHelper = configurationHelper;

            this.plugins        = pluginsIn;
            this.Header         = "Local Analysis";
            this.IssuesGridView = new IssueGridViewModel(false, "LocalView", false, this.configurationHelper, service, notificationManager, translator);
            this.OuputLogLines  = new PaginatedObservableCollection <string>(300);
            this.AllLog         = new List <string>();

            this.InitCommanding();
            this.InitFileAnalysis();

            this.localAnalyserModule                           = new SonarLocalAnalyser(this.plugins, this.restService, this.configurationHelper, this.notificationManager);
            this.localAnalyserModule.StdOutEvent              += this.UpdateOutputMessagesFromPlugin;
            this.localAnalyserModule.LocalAnalysisCompleted   += this.UpdateLocalIssues;
            this.localAnalyserModule.AssociateCommandCompeted += this.UpdateAssociateCommand;

            this.ShowFlyouts  = false;
            this.SizeOfFlyout = 0;

            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;

            // register model
            AssociationModel.RegisterNewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IssuesSearchViewModel" /> class.
        /// </summary>
        /// <param name="searchModel">The search model.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="restService">The rest service.</param>
        /// <param name="translator">The translator.</param>
        public IssuesSearchViewModel(
            IssuesSearchModel searchModel,
            INotificationManager notificationManager,
            IConfigurationHelper configurationHelper,
            ISonarRestService restService,
            ISQKeyTranslator translator)
        {
            this.notificationManager = notificationManager;
            this.configurationHelper = configurationHelper;
            this.searchModel = searchModel;
            this.Header = "Issues Search";
            this.AvailableActionPlans = new ObservableCollection<SonarActionPlan>();
            this.UsersList = new ObservableCollection<User>();
            this.IssuesGridView = new IssueGridViewModel(true, "SearchView", false, configurationHelper, restService, notificationManager, translator);
            this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout;
            this.SizeOfFlyout = 0;

            this.InitCommanding();

            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;
            this.CreatedBeforeDate = DateTime.Now;
            this.CreatedSinceDate = DateTime.Now;

            SonarQubeViewModel.RegisterNewViewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IssuesSearchViewModel" /> class.
        /// </summary>
        /// <param name="searchModel">The search model.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="restService">The rest service.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="analyser">The analyser.</param>
        public IssuesSearchViewModel(
            IssuesSearchModel searchModel,
            INotificationManager notificationManager,
            IConfigurationHelper configurationHelper,
            ISonarRestService restService,
            ISQKeyTranslator translator,
            ISonarLocalAnalyser analyser,
            IList <IIssueTrackerPlugin> plugins)
        {
            this.restService         = restService;
            this.notificationManager = notificationManager;
            this.configurationHelper = configurationHelper;
            this.searchModel         = searchModel;
            this.Header            = "Issues Search";
            this.AvailableProjects = new List <Resource>();
            this.AssigneeList      = new ObservableCollection <User>();
            this.AvailableSearches = new ObservableCollection <string>();
            this.IssuesGridView    = new IssueGridViewModel("SearchView", false, configurationHelper, restService, notificationManager, translator);
            this.savedSearchModel  = new SearchModel(this.AvailableSearches);
            this.IssuesGridView.ContextMenuItems     = this.CreateRowContextMenu(restService, translator, analyser, plugins);
            this.IssuesGridView.ShowContextMenu      = true;
            this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout;
            this.SizeOfFlyout = 0;
            this.InitCommanding();

            this.ForeGroundColor   = Colors.Black;
            this.BackGroundColor   = Colors.White;
            this.CreatedBeforeDate = DateTime.Now;
            this.CreatedSinceDate  = DateTime.Now;

            SonarQubeViewModel.RegisterNewViewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerViewModel" /> class.
        /// </summary>
        /// <param name="vsenvironmenthelper">The vsenvironmenthelper.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="restservice">The restservice.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="analyser">The analyser.</param>
        public ServerViewModel(
            IVsEnvironmentHelper vsenvironmenthelper,
            IConfigurationHelper configurationHelper,
            ISonarRestService restservice,
            INotificationManager notificationManager,
            ISQKeyTranslator translator,
            ISonarLocalAnalyser analyser,
            IList <IIssueTrackerPlugin> issuetracketplugins)
        {
            this.analyser            = analyser;
            this.notificationMan     = notificationManager;
            this.vsenvironmenthelper = vsenvironmenthelper;
            this.configurationHelper = configurationHelper;
            this.restservice         = restservice;

            this.Header           = "Server Analysis";
            this.AlreadyOpenDiffs = new SortedSet <string>();
            this.IssuesGridView   = new IssueGridViewModel("ServerView", true, this.configurationHelper, this.restservice, this.notificationMan, translator);
            this.IssuesGridView.ContextMenuItems     = this.CreateRowContextMenu(restservice, translator, issuetracketplugins);
            this.IssuesGridView.ShowContextMenu      = true;
            this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout;
            this.InitCommanding();

            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;
            this.SizeOfFlyout    = 0;
            // register model
            AssociationModel.RegisterNewModelInPool(this);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IssuesSearchModel" /> class.
 /// </summary>
 /// <param name="configurationHelper">The configuration helper.</param>
 /// <param name="restService">The rest service.</param>
 /// <param name="manager">The manager.</param>
 /// <param name="translator">The translator.</param>
 public IssuesSearchModel(
     IConfigurationHelper configurationHelper,
     ISonarRestService restService,
     INotificationManager manager,
     ISQKeyTranslator translator)
 {
     this.keyTranslator         = translator;
     this.notificationmanager   = manager;
     this.configurationHelper   = configurationHelper;
     this.restService           = restService;
     this.issuesSearchViewModel = new IssuesSearchViewModel(this, manager, this.configurationHelper, restService, translator);
     AssociationModel.RegisterNewModelInPool(this);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SourceControlMenu" /> 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>
        public SourceControlMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, ISQKeyTranslator translator)
        {
            this.rest      = rest;
            this.model     = model;
            this.manager   = manager;
            this.tranlator = translator;

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

            // register menu for data sync
            AssociationModel.RegisterNewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SourceControlMenu" /> 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>
        public SourceControlMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, ISQKeyTranslator translator)
        {
            this.rest = rest;
            this.model = model;
            this.manager = manager;
            this.tranlator = translator;

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

            // register menu for data sync
            AssociationModel.RegisterNewModelInPool(this);
        }
        /// <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>
 /// Initializes a new instance of the <see cref="IssuesSearchModel" /> class.
 /// </summary>
 /// <param name="configurationHelper">The configuration helper.</param>
 /// <param name="restService">The rest service.</param>
 /// <param name="manager">The manager.</param>
 /// <param name="translator">The translator.</param>
 /// <param name="analyser">The analyser.</param>
 public IssuesSearchModel(
     IConfigurationHelper configurationHelper,
     ISonarRestService restService,
     INotificationManager manager,
     ISQKeyTranslator translator,
     ISonarLocalAnalyser analyser,
     IList <IIssueTrackerPlugin> issuetrackerplugins)
 {
     this.keyTranslator         = translator;
     this.notificationmanager   = manager;
     this.configurationHelper   = configurationHelper;
     this.restService           = restService;
     this.issuesSearchViewModel = new IssuesSearchViewModel(this, manager, this.configurationHelper, restService, translator, analyser, issuetrackerplugins);
     this.restSourceModel       = new RestSourceControlModel(manager, restService);
     AssociationModel.RegisterNewModelInPool(this);
 }
Exemplo n.º 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssociationModel" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="service">The service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="pluginManager">The plugin manager.</param>
        /// <param name="model">The model.</param>
        public AssociationModel(
            INotificationManager logger,
            ISonarRestService service,
            IConfigurationHelper configurationHelper,
            ISQKeyTranslator translator,
            IPluginManager pluginManager,
            SonarQubeViewModel model)
        {
            this.keyTranslator       = translator;
            this.pluginManager       = pluginManager;
            this.model               = model;
            this.configurationHelper = configurationHelper;
            this.logger              = logger;
            this.sonarService        = service;

            // start view model
            this.associationViewModel = new AssociationViewModel(this);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssociationModel" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="service">The service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="pluginManager">The plugin manager.</param>
        /// <param name="model">The </param>
        public AssociationModel(
            INotificationManager logger,
            ISonarRestService service,
            IConfigurationHelper configurationHelper,
            ISQKeyTranslator translator,
            IPluginManager pluginManager,
            SonarQubeViewModel model,
            ISonarLocalAnalyser localAnalyeser,
            string vsVersion)
        {
            this.vsVersion           = vsVersion;
            this.keyTranslator       = translator;
            this.pluginManager       = pluginManager;
            this.model               = model;
            this.configurationHelper = configurationHelper;
            this.logger              = logger;
            this.sonarService        = service;
            this.localAnalyserModule = localAnalyeser;

            this.localAnalyserModule.AssociateCommandCompeted += this.LocalAssociationCompleted;
        }
        /// <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 SourceControlMenu(rest, model, manager, translator) { CommandText = "Source Control", IsEnabled = false };

            topLel.SubItems.Add(new SourceControlMenu(rest, model, manager, translator) { CommandText = "assign to committer", IsEnabled = true });
            topLel.SubItems.Add(new SourceControlMenu(rest, model, manager, translator) { CommandText = "show commit message", IsEnabled = true });
            return topLel;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SonarQubeViewModel" /> class. Plugins are initialized in InitModelFromPackageInitialization below
        /// </summary>
        /// <param name="vsverionIn">The vs version.</param>
        public SonarQubeViewModel(string vsverionIn, IConfigurationHelper configurationHelperIn)
        {
            this.vsversion = vsverionIn;
            this.ToolsProvidedByPlugins = new ObservableCollection<MenuItem>();
            this.AvailableProjects = new ObservableCollection<Resource>();

            this.notificationManager = new NotifyCationManager(this, vsverionIn);
            if (configurationHelperIn != null)
            {
                this.configurationHelper = configurationHelperIn;
            }
            else
            {
                this.configurationHelper = new ConfigurationHelper(vsverionIn, this.notificationManager);
            }

            this.sonarKeyTranslator = new SQKeyTranslator(this.notificationManager);
            this.sonarRestConnector = new SonarRestService(new JsonSonarConnector());
            this.VSonarQubeOptionsViewData = new VSonarQubeOptionsViewModel(this.sonarRestConnector, this.configurationHelper, this.notificationManager);
            this.VSonarQubeOptionsViewData.ResetUserData();

            this.CanConnectEnabled = true;
            this.ConnectionTooltip = "Not Connected";
            this.BackGroundColor = Colors.White;
            this.ForeGroundColor = Colors.Black;
            this.ErrorIsFound = false;
            this.IsExtensionBusy = false;
            this.ShowRightFlyout = false;
            this.InitCommands();
            this.NumberNewIssues = "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)
        {
            var topLel = new SourceControlMenu(rest, model, manager, translator)
            {
                CommandText = "Source Control", IsEnabled = false
            };

            topLel.SubItems.Add(new SourceControlMenu(rest, model, manager, translator)
            {
                CommandText = "assign to committer", IsEnabled = true
            });
            topLel.SubItems.Add(new SourceControlMenu(rest, model, manager, translator)
            {
                CommandText = "show commit message", IsEnabled = true
            });
            return(topLel);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SonarQubeViewModel" /> class.
        /// </summary>
        /// <param name="vsverionIn">The vsverion in.</param>
        /// <param name="helper">The helper.</param>
        /// <param name="notification">The notification.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="restService">The rest service.</param>
        /// <param name="sourceControl">The source control.</param>
        /// <param name="pluginManager">The plugin manager.</param>
        /// <param name="locaAnalyser">The local analyser.</param>
        public SonarQubeViewModel(
            string vsverionIn,
            IConfigurationHelper helper,
            INotificationManager notification,
            ISQKeyTranslator translator,
            ISonarRestService restService,
            ISourceControlProvider sourceControl = null,
            IPluginManager pluginManager = null,
            ISonarLocalAnalyser locaAnalyser = null)
        {
            this.vsversion = vsverionIn;
            this.ToolsProvidedByPlugins = new ObservableCollection<MenuItem>();
            this.AvailableProjects = new ObservableCollection<Resource>();

            this.pluginManager = pluginManager;
            this.sourceControl = sourceControl;
            this.configurationHelper = helper;
            this.notificationManager = notification;
            this.sonarKeyTranslator = translator;
            this.sonarRestConnector = restService;
            this.LocaAnalyser = locaAnalyser;
            this.VSonarQubeOptionsViewData =
                new VSonarQubeOptionsViewModel(
                    this.sonarRestConnector,
                    this.configurationHelper,
                    this.notificationManager);

            this.VSonarQubeOptionsViewData.ResetUserData();

            // start association module after all models are started
            this.AssociationModule = new AssociationModel(
                this.notificationManager,
                this.sonarRestConnector,
                this.configurationHelper,
                this.sonarKeyTranslator,
                this.pluginManager,
                this,
                this.LocaAnalyser,
                this.vsversion);

            this.CanConnectEnabled = true;
            this.ConnectionTooltip = "Not Connected";
            this.BackGroundColor = Colors.White;
            this.ForeGroundColor = Colors.Black;
            this.ErrorIsFound = true;
            this.IsExtensionBusy = false;

            this.InitCommands();
        }
 /// <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);
            }
        }
Exemplo n.º 20
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>
        /// 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);
        }
Exemplo n.º 22
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, ISonarLocalAnalyser analyser)
        {
            var topLel = new MoreInfoMenu(rest, model, manager, translator, analyser)
            {
                CommandText = "More Info", IsEnabled = true
            };

            return(topLel);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalViewModel" /> class.
        /// </summary>
        /// <param name="pluginsIn">The plugin data.</param>
        /// <param name="service">The service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="analyser">The analyzer.</param>
        /// <param name="newIssuesList">The new issues list.</param>
        public LocalViewModel(
            IList<IAnalysisPlugin> pluginsIn,
            ISonarRestService service,
            IConfigurationHelper configurationHelper,
            INotificationManager notificationManager,
            ISQKeyTranslator translator,
            ISonarLocalAnalyser analyser,
            Dictionary<string, List<Issue>> newIssuesList)
        {
            this.newAddedIssues = newIssuesList;
            this.keyTranslator = translator;
            this.notificationManager = notificationManager;
            this.restService = service;
            this.configurationHelper = configurationHelper;

            this.plugins = pluginsIn;
            this.Header = "Local Analysis";
            this.IssuesGridView = new IssueGridViewModel("LocalView", false, this.configurationHelper, service, notificationManager, translator);
            this.IssuesGridView.ContextMenuItems = this.CreateRowContextMenu(service, translator, analyser);
            this.IssuesGridView.ShowContextMenu = true;
            this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout;
            this.AllLog = new List<string>();

            this.InitCommanding();

            this.localAnalyserModule = analyser;
            this.localAnalyserModule.StdOutEvent += this.UpdateOutputMessagesFromPlugin;
            this.localAnalyserModule.LocalAnalysisCompleted += this.UpdateLocalIssues;

            this.ShowLeftFlyOut = false;
            this.SizeOfFlyout = 0;
            this.ShowFalsePositivesAndResolvedIssues = true;
            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;

            this.ReloadSavedOptions(this.configurationHelper);

            // register model
            AssociationModel.RegisterNewModelInPool(this);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="IssuesSearchModel" /> class.
 /// </summary>
 /// <param name="configurationHelper">The configuration helper.</param>
 /// <param name="restService">The rest service.</param>
 /// <param name="manager">The manager.</param>
 /// <param name="translator">The translator.</param>
 /// <param name="analyser">The analyser.</param>
 public IssuesSearchModel(
     IConfigurationHelper configurationHelper,
     ISonarRestService restService,
     INotificationManager manager,
     ISQKeyTranslator translator,
     ISonarLocalAnalyser analyser)
 {
     this.keyTranslator = translator;
     this.notificationmanager = manager;
     this.configurationHelper = configurationHelper;
     this.restService = restService;
     this.issuesSearchViewModel = new IssuesSearchViewModel(this, manager, this.configurationHelper, restService, translator, analyser);
     this.restSourceModel = new RestSourceControlModel(manager, restService);
     AssociationModel.RegisterNewModelInPool(this);
 }
        /// <summary>
        /// The create row context menu.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="analyser">The analyser.</param>
        /// <returns>
        /// The
        /// <see><cref>ObservableCollection</cref></see>
        /// .
        /// </returns>
        private ObservableCollection<IMenuItem> CreateRowContextMenu(ISonarRestService service, ISQKeyTranslator translator, ISonarLocalAnalyser analyser)
        {
            var menu = new ObservableCollection<IMenuItem>
                           {
                               SetExclusionsMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager, translator, analyser),
                               SetSqaleMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager, translator, analyser),
                               MoreInfoMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager, translator, analyser)
                           };

            return menu;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalViewModel" /> class.
        /// </summary>
        /// <param name="pluginsIn">The plugins in. TODO they must be also updatetable</param>
        /// <param name="service">The service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="translator">The translator.</param>
        public LocalViewModel(
            List<IAnalysisPlugin> pluginsIn,
            ISonarRestService service,
            IConfigurationHelper configurationHelper,
            INotificationManager notificationManager,
            ISQKeyTranslator translator)
        {
            this.keyTranslator = translator;
            this.notificationManager = notificationManager;
            this.restService = service;
            this.configurationHelper = configurationHelper;

            this.plugins = pluginsIn;
            this.Header = "Local Analysis";
            this.IssuesGridView = new IssueGridViewModel(false, "LocalView", false, this.configurationHelper, service, notificationManager, translator);
            this.OuputLogLines = new PaginatedObservableCollection<string>(300);
            this.AllLog = new List<string>();

            this.InitCommanding();
            this.InitFileAnalysis();

            this.localAnalyserModule = new SonarLocalAnalyser(this.plugins, this.restService, this.configurationHelper, this.notificationManager);
            this.localAnalyserModule.StdOutEvent += this.UpdateOutputMessagesFromPlugin;
            this.localAnalyserModule.LocalAnalysisCompleted += this.UpdateLocalIssues;
            this.localAnalyserModule.AssociateCommandCompeted += this.UpdateAssociateCommand;

            this.ShowFlyouts = false;
            this.SizeOfFlyout = 0;

            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;

            // register model
            AssociationModel.RegisterNewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AssociationModel" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="service">The service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="pluginManager">The plugin manager.</param>
        /// <param name="model">The </param>
        public AssociationModel(
            INotificationManager logger,
            ISonarRestService service,
            IConfigurationHelper configurationHelper,
            ISQKeyTranslator translator,
            IPluginManager pluginManager,
            SonarQubeViewModel model,
            ISonarLocalAnalyser localAnalyeser,
            string vsVersion)
        {
            this.vsVersion = vsVersion;
            this.keyTranslator = translator;
            this.pluginManager = pluginManager;
            this.model = model;
            this.configurationHelper = configurationHelper;
            this.logger = logger;
            this.sonarService = service;
            this.localAnalyserModule = localAnalyeser;

            this.localAnalyserModule.AssociateCommandCompeted += this.LocalAssociationCompleted;
        }
        /// <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, ISonarLocalAnalyser analyser)
        {
            var topLel = new SetSqaleMenu(rest, model, manager, translator, analyser) { CommandText = "Sqale", IsEnabled = false };

            topLel.SubItems.Add(new SetSqaleMenu(rest, model, manager, translator, analyser) { CommandText = "adjust effort", IsEnabled = true });
            return topLel;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IssueGridViewModel" /> class.
        /// </summary>
        /// <param name="rowContextMenu">The row Context Menu.</param>
        /// <param name="gridId">The grid Id.</param>
        /// <param name="showSqaleRating">if set to <c>true</c> [show sqale rating].</param>
        /// <param name="helper">The helper.</param>
        /// <param name="restServiceIn">The rest service in.</param>
        /// <param name="notManager">The not manager.</param>
        /// <param name="keyTranslatorIn">The key translator in.</param>
        public IssueGridViewModel(
            bool rowContextMenu,
            string gridId,
            bool showSqaleRating,
            IConfigurationHelper helper,
            ISonarRestService restServiceIn,
            INotificationManager notManager,
            ISQKeyTranslator keyTranslatorIn)
        {
            this.keyTranslator = keyTranslatorIn;
            this.notificationManager = notManager;
            this.restService = restServiceIn;

            this.dataGridOptionsKey += gridId;
            this.configurationHelper = helper;
            this.AllIssues = new AsyncObservableCollection<Issue>();
            this.Issues = new AsyncObservableCollection<Issue>();

            this.OpenInVsCommand = new RelayCommand<IList>(this.OnOpenInVsCommand);
            this.MouseEventCommand = new RelayCommand(this.OnMouseEventCommand);

            this.SelectionChangedCommand = new RelayCommand<IList>(
                items =>
                    {
                        this.SelectedItems = items;
                        this.IssuesCounter = this.Issues.Count.ToString(CultureInfo.InvariantCulture);
                    });

            this.ColumnHeaderChangedCommand = new RelayCommand(this.OnColumnHeaderChangedCommand);
            this.RestoreUserSettingsInIssuesDataGrid();

            this.ShowHeaderContextMenu = true;
            this.ContextVisibilityMenuItems = this.CreateColumnVisibiltyMenu();
            this.ShowContextMenu = rowContextMenu;
            this.ContextMenuItems = this.CreateRowContextMenu();

            this.filter = new IssueFilter(this);
            this.InitFilterCommanding();

            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;

            this.ShowSqaleRating = showSqaleRating;

            // register model
            AssociationModel.RegisterNewModelInPool(this);
            SonarQubeViewModel.RegisterNewViewModelInPool(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, ISonarLocalAnalyser analyser)
        {
            var topLel = new SetSqaleMenu(rest, model, manager, translator, analyser)
            {
                CommandText = "Sqale", IsEnabled = false
            };

            topLel.SubItems.Add(new SetSqaleMenu(rest, model, manager, translator, analyser)
            {
                CommandText = "adjust effort", IsEnabled = true
            });
            return(topLel);
        }
        /// <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);
        }
        /// <summary>
        /// The create row context menu.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="analyser">The analyser.</param>
        /// <returns>
        /// The
        /// <see><cref>ObservableCollection</cref></see>
        /// .
        /// </returns>
        private ObservableCollection<IMenuItem> CreateRowContextMenu(ISonarRestService service, ISQKeyTranslator translator, ISonarLocalAnalyser analyser)
        {
            var menu = new ObservableCollection<IMenuItem>
                           {
                               ChangeStatusMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager),
                               OpenResourceMenu.MakeMenu(service, this.IssuesGridView),
                               SourceControlMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager, translator),
                               IssueTrackerMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager, translator),
                               AssignMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager),
                               AssignTagMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager),
                               SetSqaleMenu.MakeMenu(service, this.IssuesGridView, this.notificationManager, translator, analyser)
                           };

            return menu;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AssociationModel" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="service">The service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="pluginManager">The plugin manager.</param>
        /// <param name="model">The model.</param>
        public AssociationModel(
            INotificationManager logger,
            ISonarRestService service,
            IConfigurationHelper configurationHelper,
            ISQKeyTranslator translator,
            IPluginManager pluginManager,
            SonarQubeViewModel model)
        {
            this.keyTranslator = translator;
            this.pluginManager = pluginManager;
            this.model = model;
            this.configurationHelper = configurationHelper;
            this.logger = logger;
            this.sonarService = service;

            // start view model
            this.associationViewModel = new AssociationViewModel(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, ISonarLocalAnalyser analyser)
 {
     var topLel = new MoreInfoMenu(rest, model, manager, translator, analyser) { CommandText = "More Info", IsEnabled = true };
     return topLel;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="IssuesSearchViewModel" /> class.
        /// </summary>
        /// <param name="searchModel">The search model.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="restService">The rest service.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="analyser">The analyser.</param>
        public IssuesSearchViewModel(
            IssuesSearchModel searchModel,
            INotificationManager notificationManager,
            IConfigurationHelper configurationHelper,
            ISonarRestService restService,
            ISQKeyTranslator translator,
            ISonarLocalAnalyser analyser)
        {
            this.restService = restService;
            this.notificationManager = notificationManager;
            this.configurationHelper = configurationHelper;
            this.searchModel = searchModel;
            this.Header = "Issues Search";
            this.AvailableProjects = new List<Resource>();
            this.AssigneeList = new ObservableCollection<User>();
            this.AvailableSearches = new ObservableCollection<string>();
            this.IssuesGridView = new IssueGridViewModel("SearchView", false, configurationHelper, restService, notificationManager, translator);
            this.savedSearchModel = new SearchModel(this.AvailableSearches);
            this.IssuesGridView.ContextMenuItems = this.CreateRowContextMenu(restService, translator, analyser);
            this.IssuesGridView.ShowContextMenu = true;
            this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout;
            this.SizeOfFlyout = 0;
            this.InitCommanding();

            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;
            this.CreatedBeforeDate = DateTime.Now;
            this.CreatedSinceDate = DateTime.Now;

            SonarQubeViewModel.RegisterNewViewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ServerViewModel" /> class.
        /// </summary>
        /// <param name="vsenvironmenthelper">The vsenvironmenthelper.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="restservice">The restservice.</param>
        /// <param name="notificationManager">The notification manager.</param>
        /// <param name="translator">The translator.</param>
        public ServerViewModel(
            IVsEnvironmentHelper vsenvironmenthelper,
            IConfigurationHelper configurationHelper,
            ISonarRestService restservice,
            INotificationManager notificationManager,
            ISQKeyTranslator translator)
        {
            this.notificationMan = notificationManager;
            this.vsenvironmenthelper = vsenvironmenthelper;
            this.configurationHelper = configurationHelper;
            this.restservice = restservice;

            this.Header = "Server Analysis";
            this.AvailableActionPlans = new ObservableCollection<SonarActionPlan>();
            this.AlreadyOpenDiffs = new SortedSet<string>();
            this.IssuesGridView = new IssueGridViewModel(true, "ServerView", true, this.configurationHelper, this.restservice, this.notificationMan, translator);
            this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout;
            this.InitCommanding();

            this.ForeGroundColor = Colors.Black;
            this.BackGroundColor = Colors.White;
            this.SizeOfFlyout = 0;
            // register model
            AssociationModel.RegisterNewModelInPool(this);
        }