public Profile(ISonarRestService service, ISonarConfiguration conf)
 {
     this.conf = conf;
     this.service = service;
     this.Rules = new Dictionary<string, Rule>();
     this.RulesByIternalKey = new Dictionary<string, Rule>();
 }
        /// <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>
        /// The get connection configuration.
        /// </summary>
        /// <param name="properties">
        /// The properties.
        /// </param>
        /// <param name="service">
        /// The service.
        /// </param>
        /// <returns>
        /// The <see cref="ConnectionConfiguration"/>.
        /// </returns>
        public static ConnectionConfiguration GetConnectionConfiguration(IVsEnvironmentHelper properties, ISonarRestService service)
        {
            ErrorMessage = string.Empty;

            var userName = "******";
            var userPassword = "******";
            var hostname = "http://localhost:9000";
            if (properties != null)
            {
                userName = properties.ReadSavedOption("Sonar Options", "General", "SonarUserName");
                userPassword = properties.ReadSavedOption("Sonar Options", "General", "SonarUserPassword");
                hostname = properties.ReadSavedOption("Sonar Options", "General", "SonarHost");
            }

            if (string.IsNullOrEmpty(hostname))
            {
                ErrorMessage = "User Configuration is Invalid, Check Tools > Options > Sonar Options";
                return null;
            }

            var userConf = new ConnectionConfiguration(hostname, userName, userPassword);
            if (!service.AuthenticateUser(userConf))
            {
                ErrorMessage = "Authentication Failed, Check User, Password and Hostname";
                return null;
            }

            return userConf;
        }
        /// <summary>The extension data viewModel update.</summary>
        /// <param name="restServiceIn">The rest service in.</param>
        /// <param name="vsenvironmenthelperIn">The vsenvironmenthelper in.</param>
        /// <param name="statusBar">The status bar.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="extensionFolder">The extension Folder.</param>
        public void InitModelFromPackageInitialization(
            ISonarRestService restServiceIn,
            IVsEnvironmentHelper vsenvironmenthelperIn,
            IVSSStatusBar statusBar,
            IServiceProvider provider,
            string extensionFolder)
        {
            this.ServiceProvider     = provider;
            this.SonarRestConnector  = restServiceIn;
            this.VsHelper            = vsenvironmenthelperIn;
            this.StatusBar           = statusBar;
            this.ExtensionFolder     = extensionFolder;
            this.NotificationManager = new NotifyCationManager(this, this.VsHelper);

            this.VSonarQubeOptionsViewData.InitPuginSystem(vsenvironmenthelperIn, this.PluginControl, this.NotificationManager);

            this.InitMenus();
            this.InitViews();
            this.InitConnection();

            this.UpdateTheme(Colors.Black, Colors.White);

            foreach (IAnalysisViewModelBase view in this.SonarQubeViews)
            {
                view.UpdateServices(restServiceIn, vsenvironmenthelperIn, this.configurationHelper, statusBar, provider);
            }

            this.VSonarQubeOptionsViewData.UpdateServices(restServiceIn, vsenvironmenthelperIn, statusBar, provider);
            foreach (IOptionsViewModelBase view in this.VSonarQubeOptionsViewData.AvailableOptions)
            {
                view.UpdateServices(restServiceIn, vsenvironmenthelperIn, this.configurationHelper, statusBar, provider);
            }
        }
        /// <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);
        }
        public void TestAssociationWithSolution()
        {
            this.mocks    = new MockRepository();
            this.service  = this.mocks.Stub <ISonarRestService>();
            this.vshelper = this.mocks.Stub <IVsEnvironmentHelper>();
            var resource = new Resource {
                Key = "KEY"
            };
            var resources = new List <Resource> {
                resource
            };

            using (this.mocks.Record())
            {
                SetupResult.For(this.service.GetServerInfo(Arg <ISonarConfiguration> .Is.Anything)).Return(3.6);
                SetupResult.For(this.service.AuthenticateUser(Arg <ISonarConfiguration> .Is.Anything)).Return(true);
                SetupResult.For(this.service.GetResourcesData(Arg <ISonarConfiguration> .Is.Anything, Arg <string> .Is.Equal("KEY"))).Return(resources);
                SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarHost")).Return("serveraddr");
                SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarUserPassword")).Return("password");
                SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarUserName")).Return("login");
                SetupResult.For(this.vshelper.ActiveSolutionName()).Return("Solution");
                SetupResult.For(this.vshelper.ReadOptionFromApplicationData("Solution", "PROJECTKEY")).Return("KEY");
            }

            var model = new ExtensionDataModel(this.service, this.vshelper, null, null);

            model.AssociateProjectToSolution();
            Assert.AreEqual("Selected Project: KEY", model.AssociatedProjectKey);
            model.AssociateProjectToSolution();
            Assert.AreEqual("Selected Project: KEY", model.AssociatedProjectKey);
        }
Exemplo n.º 7
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);
        }
        /// <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);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SourceControlModel" /> class.
        /// </summary>
        /// <param name="sourceControlPlugins">The source control plugins.</param>
        /// <param name="basePath">The base path.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="service">The service.</param>
        public SourceControlModel(IEnumerable <ISourceVersionPlugin> sourceControlPlugins, string basePath, INotificationManager manager, ISonarRestService service)
        {
            this.service  = service;
            this.manager  = manager;
            this.basePath = basePath;
            this.plugins  = sourceControlPlugins;

            if (string.IsNullOrEmpty(basePath))
            {
                this.supportedPlugin = null;
                return;
            }

            foreach (var plugin in sourceControlPlugins)
            {
                try
                {
                    plugin.InitializeRepository(basePath);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
            }

            this.supportedPlugin = this.GetSupportedPlugin();
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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="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);
        }
Exemplo n.º 13
0
 public Profile(ISonarRestService service, ISonarConfiguration conf)
 {
     this.conf              = conf;
     this.service           = service;
     this.Rules             = new Dictionary <string, Rule>();
     this.RulesByIternalKey = new Dictionary <string, Rule>();
 }
        /// <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>
        /// <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.º 16
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="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);
        }
Exemplo n.º 18
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);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SearchComponenetDialog" /> class.
        /// </summary>
        /// <param name="conf">The conf.</param>
        /// <param name="rest">The rest.</param>
        /// <param name="availableProjects">The available projects.</param>
        /// <param name="listofSaveComp">The listof save comp.</param>
        /// <param name="vshelper">The vshelper.</param>
        public SearchComponenetDialog(ISonarConfiguration conf,
                                      ISonarRestService rest,
                                      List <Resource> availableProjectsIn,
                                      List <Resource> listofSaveComp,
                                      IVsEnvironmentHelper vshelper)
        {
            this.selectedItems     = new ObservableCollection <Resource>();
            this.availableProjects = new ObservableCollection <Resource>(availableProjectsIn);
            this.componentList     = new ObservableCollection <Resource>();

            this.conf     = conf;
            this.rest     = rest;
            this.vshelper = vshelper;

            InitializeComponent();

            this.Projects.ItemsSource         = this.availableProjects;
            this.SelectedDataGrid.ItemsSource = this.selectedItems;
            this.SearchDataGrid.ItemsSource   = this.componentList;

            if (listofSaveComp != null)
            {
                foreach (var item in listofSaveComp)
                {
                    try
                    {
                        IEnumerable <Resource> resourcesWithSameKey =
                            from resource in this.availableProjects
                            where this.CompareKeysInProjects(resource, item.Key)
                            select resource;

                        var element = resourcesWithSameKey.First();

                        if (element.BranchResources.Count != 0)
                        {
                            element = element.BranchResources.First(x => x.Key.Equals(item.Key));
                        }

                        element.Qualifier = "TRK";

                        this.selectedItems.Add(element);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine("Failed to import project: ", ex.Message);
                    }
                }

                this.SearchDataGrid.Items.Refresh();
            }


            this.MouseLeftButtonDown += this.MouseLeftButtonDownPressed;
            this.SearchData.KeyDown  += new KeyEventHandler(this.KeyboardKeyDown);
        }
Exemplo n.º 20
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="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="EmbbedVersionController"/> class.
 /// </summary>
 /// <param name="notificationManager">The notification manager.</param>
 /// <param name="restService">The rest service.</param>
 /// <param name="configHelper">The configuration helper.</param>
 /// <param name="roslynDefaultPath">The roslyn default path.</param>
 public EmbbedVersionController(
     INotificationManager notificationManager,
     ISonarRestService restService,
     IConfigurationHelper configHelper,
     string roslynDefaultPath)
 {
     this.roslynHomeDiagPath  = roslynDefaultPath;
     this.notificationManager = notificationManager;
     this.configHelper        = configHelper;
     this.rest = restService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmbbedVersionController"/> class.
 /// </summary>
 /// <param name="notificationManager">The notification manager.</param>
 /// <param name="restService">The rest service.</param>
 /// <param name="configHelper">The configuration helper.</param>
 /// <param name="roslynDefaultPath">The roslyn default path.</param>
 public EmbbedVersionController(
     INotificationManager notificationManager,
     ISonarRestService restService,
     IConfigurationHelper configHelper,
     string roslynDefaultPath)
 {
     this.roslynHomeDiagPath = roslynDefaultPath;
     this.notificationManager = notificationManager;
     this.configHelper = configHelper;
     this.rest = restService;
     this.GenerateVersionData();
 }
        /// <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);
        }
Exemplo n.º 25
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>
        /// 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);
        }
 public void Setup()
 {
     this.mocks    = new MockRepository();
     this.service  = this.mocks.Stub <ISonarRestService>();
     this.vshelper = this.mocks.Stub <IVsEnvironmentHelper>();
     using (this.mocks.Record())
     {
         SetupResult.For(this.service.GetServerInfo(Arg <ISonarConfiguration> .Is.Anything)).Return(3.5);
         SetupResult.For(this.service.AuthenticateUser(Arg <ISonarConfiguration> .Is.Anything)).Return(true);
         SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarHost")).Return("serveraddr");
         SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarUserPassword")).Return("password");
         SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarUserName")).Return("login");
     }
 }
Exemplo n.º 29
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="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);
            }
        }
 public void Setup()
 {
     this.mocks = new MockRepository();
     this.service = this.mocks.Stub<ISonarRestService>();
     this.vshelper = this.mocks.Stub<IVsEnvironmentHelper>();
     using (this.mocks.Record())
     {
         SetupResult.For(this.service.GetServerInfo(Arg<ConnectionConfiguration>.Is.Anything)).Return(3.5);
         SetupResult.For(this.service.AuthenticateUser(Arg<ConnectionConfiguration>.Is.Anything)).Return(true);
         SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarHost")).Return("serveraddr");
         SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarUserPassword")).Return("password");
         SetupResult.For(this.vshelper.ReadSavedOption("Sonar Options", "General", "SonarUserName")).Return("login");
     }
 }
        /// <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, IList <IIssueTrackerPlugin> plugins)
        {
            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, plugins),
                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="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);
        }
Exemplo n.º 33
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);
 }
        /// <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.º 37
0
        /// <summary>
        /// Makes the menu.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="notmanager">The notmanager.</param>
        /// <returns>returns menu.</returns>
        public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager notmanager)
        {
            var topLel = new AssignTagMenu(rest, model, notmanager)
            {
                CommandText = "Tags", IsEnabled = false
            };

            topLel.SubItems.Add(new AssignTagMenu(rest, model, notmanager)
            {
                CommandText = "assign tag", IsEnabled = true
            });
            topLel.SubItems.Add(new AssignTagMenu(rest, model, notmanager)
            {
                CommandText = "remove tags", IsEnabled = true
            });
            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 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);
        }
Exemplo n.º 39
0
        /// <summary>
        /// The make menu.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <returns>
        /// The <see cref="IMenuItem" />.
        /// </returns>
        public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model)
        {
            var topLel = new OpenResourceMenu(rest, model)
            {
                CommandText = "Open", IsEnabled = false
            };

            topLel.SubItems.Add(new OpenResourceMenu(rest, model)
            {
                CommandText = "Visual Studio", IsEnabled = true
            });
            topLel.SubItems.Add(new OpenResourceMenu(rest, model)
            {
                CommandText = "Browser", IsEnabled = true
            });
            return(topLel);
        }
        /// <summary>
        /// The get connection configuration.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="address">The address.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns>
        /// The <see cref="ConnectionConfiguration" />.
        /// </returns>
        public static bool EstablishAConnection(ISonarRestService service, string address, string userName, string password)
        {
            if (AuthToken != null)
            {
                return true;
            }

            ErrorMessage = string.Empty;

            var token = new ConnectionConfiguration(address, userName, password, 4.5);
            if (!service.AuthenticateUser(token))
            {
                ErrorMessage = "Authentication Failed, Check User, Password and Hostname";
                return false;
            }

            token.SonarVersion = service.GetServerInfo(token);
            AuthToken = token;

            return true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SearchComponenetDialog" /> class.
        /// </summary>
        /// <param name="conf">The conf.</param>
        /// <param name="rest">The rest.</param>
        /// <param name="availableProjects">The available projects.</param>
        /// <param name="listofSaveComp">The listof save comp.</param>
        public SearchComponenetDialog(ISonarConfiguration conf, ISonarRestService rest, List<Resource> availableProjects, List<Resource> listofSaveComp)
        {
            this.selectedItems = new ObservableCollection<Resource>();
            this.availableProjects = availableProjects;
            this.conf = conf;
            this.rest = rest;

            InitializeComponent();
            this.SearchDataGrid.ItemsSource = this.componentList;
            this.SearchDataGrid.Items.Refresh();
            this.Projects.ItemsSource = availableProjects;
            this.SelectedDataGrid.ItemsSource = this.selectedItems;
            if (listofSaveComp != null)
            {
                foreach (var item in listofSaveComp)
                {
                    this.selectedItems.Add(item);
                }
            }

            this.MouseLeftButtonDown += this.MouseLeftButtonDownPressed;
            this.SearchData.KeyDown += new KeyEventHandler(this.KeyboardKeyDown);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetIssuesCommand"/> class.
 /// </summary>
 /// <param name="model">
 /// The model.
 /// </param>
 /// <param name="service">
 /// The service.
 /// </param>
 public GetIssuesCommand(ExtensionDataModel model, ISonarRestService service)
 {
     this.model = model;
     this.service = service;
 }
        /// <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="SourceControlModel" /> class.
        /// </summary>
        /// <param name="sourceControlPlugins">The source control plugins.</param>
        /// <param name="basePath">The base path.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="service">The service.</param>
        public SourceControlModel(IEnumerable<ISourceVersionPlugin> sourceControlPlugins, string basePath, INotificationManager manager, ISonarRestService service)
        {
            this.service = service;
            this.manager = manager;
            this.basePath = basePath;
            this.plugins = sourceControlPlugins;

            if (string.IsNullOrEmpty(basePath))
            {
                this.supportedPlugin = null;
                return;
            }

            foreach (var plugin in sourceControlPlugins)
            {

                try
                {
                    plugin.InitializeRepository(basePath);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
            }

            this.supportedPlugin = this.GetSupportedPlugin();
        }
        /// <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>
        /// 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="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.º 48
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="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);
            }
        }
Exemplo n.º 49
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;
        }
 /// <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="OpenInSonarCommand"/> class.
 /// </summary>
 /// <param name="model">
 /// The model.
 /// </param>
 /// <param name="restService">
 /// The rest service.
 /// </param>
 /// <param name="vsenvironmenthelper">
 /// The vsenvironmenthelper.
 /// </param>
 public OpenInSonarCommand(ExtensionDataModel model, ISonarRestService restService, IVsEnvironmentHelper vsenvironmenthelper)
 {
     this.model = model;
     this.vsenvironmenthelper = vsenvironmenthelper;
     this.restService = restService;
 }
        /// <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);
        }
        /// <summary>
        /// The make menu.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <returns>
        /// The <see cref="IMenuItem" />.
        /// </returns>
        public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model)
        {
            var topLel = new OpenResourceMenu(rest, model) { CommandText = "Open", IsEnabled = false };

            topLel.SubItems.Add(new OpenResourceMenu(rest, model) { CommandText = "Visual Studio", IsEnabled = true });
            topLel.SubItems.Add(new OpenResourceMenu(rest, model) { CommandText = "Browser", IsEnabled = true });
            return topLel;
        }
        /// <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.StatusMessage = "";
            this.UserName = string.Empty;
            this.Password = string.Empty;
            this.viewModel = viewModel;
            this.restService = restService;
            this.configurationHelper = configurationHelper;
            this.notificationManager = notificationManager;

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

            this.ConnectToServerCommand = new VsRelayCommand<object>(this.OnConnectToServerCommand);

            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="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 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="FalsePositiveOnIssueCommand"/> class.
 /// </summary>
 /// <param name="model">
 /// The model.
 /// </param>
 /// <param name="service">
 /// The service.
 /// </param>
 public FalsePositiveOnIssueCommand(ExtensionDataModel model, ISonarRestService service)
 {
     this.model = model;
     this.service = service;
 }
        /// <summary>
        /// The make menu.
        /// </summary>
        /// <param name="rest">The rest.</param>
        /// <param name="model">The model.</param>
        /// <param name="notmanager">The notmanager.</param>
        /// <returns>
        /// The <see cref="IMenuItem" />.
        /// </returns>
        public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager notmanager)
        {
            var topLel = new ChangeStatusMenu(rest, model, notmanager) { CommandText = "Status", IsEnabled = false };

            topLel.SubItems.Add(new ChangeStatusMenu(rest, model, notmanager) { CommandText = "Confirm", IsEnabled = true });
            topLel.SubItems.Add(new ChangeStatusMenu(rest, model, notmanager) { CommandText = "Fix", IsEnabled = true });
            topLel.SubItems.Add(new ChangeStatusMenu(rest, model, notmanager) { CommandText = "False Positive", 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>
 /// Makes the menu.
 /// </summary>
 /// <param name="rest">The rest.</param>
 /// <param name="model">The model.</param>
 /// <param name="notmanager">The notmanager.</param>
 /// <returns>returns menu.</returns>
 public static IMenuItem MakeMenu(ISonarRestService rest, IssueGridViewModel model, INotificationManager notmanager)
 {
     var topLel = new AssignMenu(rest, model, notmanager) { CommandText = "Assign", IsEnabled = false };
     topLel.SubItems.Add(new AssignMenu(rest, model, notmanager) { CommandText = "to user", IsEnabled = true });
     topLel.SubItems.Add(new AssignMenu(rest, model, notmanager) { CommandText = "to me", IsEnabled = true });
     topLel.SubItems.Add(new AssignMenu(rest, model, notmanager) { CommandText = "assign to author", IsEnabled = true });
     return topLel;
 }