/// <summary>
        /// Initializes a new instance of the <see cref="LicenseViewerViewModel" /> class.
        /// </summary>
        /// <param name="plugincontroller">The plugincontroller.</param>
        /// <param name="helper">The helper.</param>
        public LicenseViewerViewModel(
            PluginManagerModel plugincontroller,
            IConfigurationHelper helper)
        {
            this.Header      = "License Manager";
            this.pluginModel = plugincontroller;
            this.confHelper  = helper;

            this.ForeGroundColor      = Colors.Black;
            this.ForeGroundColor      = Colors.Black;
            this.AvailableLicenses    = new ObservableCollection <VsLicense>();
            this.RefreshCommand       = new RelayCommand(this.GetLicensesFromServer);
            this.GenerateTokenCommand = new RelayCommand(this.OnGenerateTokenCommand, () => this.SelectedLicense != null);

            try
            {
                this.GetLicensesFromServer();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            // register model so it can be updated
            AssociationModel.RegisterNewModelInPool(this);
            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="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);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RoslynManagerModel" /> class.
        /// </summary>
        /// <param name="pluginsIn">The plugins in.</param>
        /// <param name="notificationManagerIn">The notification manager in.</param>
        /// <param name="configHelper">The configuration helper.</param>
        public RoslynManagerModel(
            IEnumerable <IAnalysisPlugin> pluginsIn,
            INotificationManager notificationManagerIn,
            IConfigurationHelper configHelper,
            ISonarRestService rest)
        {
            this.roslynHomePath             = Path.Combine(configHelper.ApplicationPath, "Diagnostics");
            this.roslynExternalUserDiagPath = Path.Combine(this.roslynHomePath, "UserDiagnostics");
            this.roslynEmbbedDiagPath       = Path.Combine(this.roslynHomePath, "InternalDiagnostics");

            if (!Directory.Exists(this.roslynHomePath))
            {
                Directory.CreateDirectory(this.roslynHomePath);
            }

            if (!Directory.Exists(this.roslynExternalUserDiagPath))
            {
                Directory.CreateDirectory(this.roslynExternalUserDiagPath);
            }

            if (!Directory.Exists(this.roslynEmbbedDiagPath))
            {
                Directory.CreateDirectory(this.roslynEmbbedDiagPath);
            }

            this.rest                   = rest;
            this.confHelper             = configHelper;
            this.plugins                = pluginsIn;
            this.notificationManager    = notificationManagerIn;
            this.ExtensionDiagnostics   = new Dictionary <string, VSSonarExtensionDiagnostic>();
            this.embedVersionController = new EmbbedVersionController(this.notificationManager, rest, configHelper, this.roslynEmbbedDiagPath);

            // register model
            AssociationModel.RegisterNewModelInPool(this);
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GeneralConfigurationViewModel" /> class.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="restService">The rest service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="notificationManager">The notification manager.</param>
        public GeneralConfigurationViewModel(
            VSonarQubeOptionsViewModel viewModel,
            ISonarRestService restService,
            IConfigurationHelper configurationHelper,
            INotificationManager notificationManager)
        {
            this.Header              = "General Settings";
            this.UserName            = string.Empty;
            this.Password            = string.Empty;
            this.viewModel           = viewModel;
            this.restService         = restService;
            this.configurationHelper = configurationHelper;
            this.notificationManager = notificationManager;

            this.ClearCacheCommand     = new RelayCommand(this.OnClearCacheCommand);
            this.TestConnectionCommand = new RelayCommand <object>(this.OnTestAndSavePassword);
            this.ClearCredentials      = new RelayCommand(this.OnClearCredentials);

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

            this.GetCredentials();
            this.ReloadDataFromDisk(null);

            // register model
            AssociationModel.RegisterNewModelInPool(this);
            SonarQubeViewModel.RegisterNewViewModelInPool(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="AnalysisOptionsViewModel" /> class.
        /// </summary>
        /// <param name="viewModel">The view Model.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        public AnalysisOptionsViewModel(
            VSonarQubeOptionsViewModel viewModel,
            IConfigurationHelper configurationHelper)
        {
            this.configurationHelper       = configurationHelper;
            this.viewModel                 = viewModel;
            this.TimeoutValue              = 10;
            this.IsSolutionAnalysisChecked = true;
            this.IsProjectAnalysisChecked  = true;
            this.Header                 = "Analysis Options";
            this.ForeGroundColor        = Colors.Black;
            this.BackGroundColor        = Colors.White;
            this.DownloadWrapperCommand = new RelayCommand(this.OnDownloadWrapperCommand);

            SonarQubeViewModel.RegisterNewViewModelInPool(this);
            AssociationModel.RegisterNewModelInPool(this);

            try
            {
                this.ReloadDataFromDisk(null);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to reload from disk : " + ex.Message);
            }
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OpenResourceMenu" /> class.
        /// Initializes a new instance of the <see cref="ChangeStatusMenu" /> class.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        private OpenResourceMenu(ISonarRestService rest, IssueGridViewModel model)
        {
            this.model          = model;
            this.rest           = rest;
            this.ExecuteCommand = new RelayCommand(this.OnAssociateCommand);
            this.SubItems       = new ObservableCollection <IMenuItem>();

            // register menu for data sync
            AssociationModel.RegisterNewModelInPool(this);
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssignMenu" /> class.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="notmanager">The notmanager.</param>
        private AssignMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager notmanager)
        {
            this.model          = model;
            this.rest           = rest;
            this.manager        = notmanager;
            this.ExecuteCommand = new RelayCommand(this.OnAssociateCommand);
            this.SubItems       = new ObservableCollection <IMenuItem>();

            // register menu for data sync
            AssociationModel.RegisterNewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ShowHideIssueColumn"/> class.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <param name="helper">
        /// The helper.
        /// </param>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="gridKey">
        /// The grid key.
        /// </param>
        public ShowHideIssueColumn(IssueGridViewModel model, IConfigurationHelper helper, string name, string gridKey)
        {
            this.gridKey        = gridKey;
            this.helper         = helper;
            this.name           = name;
            this.model          = model;
            this.CommandText    = "Columns";
            this.IsEnabled      = true;
            this.ExecuteCommand = new RelayCommand(this.OnAssociateCommand);
            this.SubItems       = new ObservableCollection <IMenuItem>();

            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);
        }
Пример #12
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);
 }
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RoslynManagerModel" /> class.
        /// </summary>
        /// <param name="pluginsIn">The plugins in.</param>
        /// <param name="notificationManagerIn">The notification manager in.</param>
        /// <param name="configHelper">The configuration helper.</param>
        public RoslynManagerModel(
            IEnumerable <IAnalysisPlugin> pluginsIn,
            INotificationManager notificationManagerIn,
            IConfigurationHelper configHelper)
        {
            this.confHelper           = configHelper;
            this.plugins              = pluginsIn;
            this.notificationManager  = notificationManagerIn;
            this.ExtensionDiagnostics = new Dictionary <string, VSSonarExtensionDiagnostic>();
            this.InitializedInstalledDiagnostics();

            // register model
            AssociationModel.RegisterNewModelInPool(this);
        }
        /// <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="registerPool">if set to <c>true</c> [register pool].</param>
        private PlanMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager manager, bool registerPool = true)
        {
            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);
            }
        }
Пример #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VSonarQubeOptionsViewModel" /> class.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        /// <param name="notifier">The notifier.</param>
        public VSonarQubeOptionsViewModel(
            ISonarRestService service,
            IConfigurationHelper configurationHelper,
            INotificationManager notifier)
        {
            this.notificationManager = notifier;
            this.restService         = service;
            this.configurationHelper = configurationHelper;

            this.InitModels();
            this.InitCommanding();

            AssociationModel.RegisterNewModelInPool(this);
            SonarQubeViewModel.RegisterNewViewModelInPool(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);
 }
Пример #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalysisOptionsViewModel" /> class.
        /// </summary>
        /// <param name="viewModel">The view Model.</param>
        /// <param name="configurationHelper">The configuration helper.</param>
        public AnalysisOptionsViewModel(
            VSonarQubeOptionsViewModel viewModel,
            IConfigurationHelper configurationHelper)
        {
            this.configurationHelper       = configurationHelper;
            this.viewModel                 = viewModel;
            this.TimeoutValue              = 10;
            this.IsSolutionAnalysisChecked = true;
            this.IsProjectAnalysisChecked  = true;
            this.Header                          = "Analysis Options";
            this.ForeGroundColor                 = Colors.Black;
            this.BackGroundColor                 = Colors.White;
            this.BrowseForJavaTrigger            = new RelayCommand(this.OnBrowseForJavaTrigger);
            this.BrowseForSonarRunnerQubeTrigger = new RelayCommand(this.OnBrowseForSonarRunnerQubeTrigger);

            SonarQubeViewModel.RegisterNewViewModelInPool(this);
            AssociationModel.RegisterNewModelInPool(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotifyCationManager" /> class.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="visualStudioVersion">The visual studio version.</param>
        public NotifyCationManager(SonarQubeViewModel model, string visualStudioVersion)
        {
            this.model           = model;
            this.userRoamingFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "VSSonarExtension\\debug.log." + visualStudioVersion);

            try
            {
                if (File.Exists(this.userRoamingFile))
                {
                    File.Delete(this.userRoamingFile);
                }
            }
            catch (Exception error)
            {
                Debug.WriteLine(error.Message);
            }

            AssociationModel.RegisterNewModelInPool(this);
        }