Exemplo n.º 1
0
        public override void EditorShutdown()
        {
            if (_sourceControl != null)
            {
                _sourceControl.Dispose();
                _sourceControl = null;
            }

        }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="workDir">The work dir.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="profile">The profile.</param>
 public void AssociateWithNewProject(
     Resource project,
     string workDir,
     ISourceControlProvider provider,
     Dictionary <string, Profile> profile,
     string visualStudioVersion)
 {
     this.SourceDir         = workDir;
     this.associatedProject = project;
 }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="config">The configuration.</param>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="sourceModel">The source model.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 public void AssociateWithNewProject(
     Resource project,
     string workingDir,
     ISourceControlProvider sourceModel,
     Dictionary <string, Profile> profile,
     string visualStudioVersion)
 {
     this.sourceControl = sourceModel;
     this.assignProject = project;
 }
        public void ResetView()
        {
            Logger.Trace("Resetting view");

            _provider.BranchChanged -= Provider_BranchChanged;
            _provider     = null;
            CurrentBranch = string.Empty;

            IncomingCommits = new ObservableCollection <ICommit>();
            OutgoingCommits = new ObservableCollection <ICommit>();
        }
Exemplo n.º 5
0
 internal static void UpdateStatus(IEnumerable <IDocumentItem> items, ISourceControlProvider sourceControlProvider)
 {
     if (sourceControlProvider == null)
     {
         return;
     }
     SourceControlStatusCache.UpdateStatus(
         from item in items
         where !item.IsReference
         select item.DocumentReference, sourceControlProvider);
 }
Exemplo n.º 6
0
        protected override void InternalExectute()
        {
            IDocumentItem documentItem = this.Selection().SingleOrNull <IDocumentItem>();

            if (documentItem != null)
            {
                ISourceControlProvider sourceControlProvider = base.SourceControlProvider;
                string[] path = new string[] { documentItem.DocumentReference.Path };
                sourceControlProvider.History(path);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Currents the branch.
        /// </summary>
        /// <returns>return current branch</returns>
        public string CurrentBranch(ISourceControlProvider sourceControlProvider)
        {
            var branch = sourceControlProvider.GetBranch();

            if (string.IsNullOrEmpty(branch))
            {
                return("master");
            }

            return(branch);
        }
        public SourceControlProviderHost(ISourceControlProvider sourceControlProvider)
        {
            if (sourceControlProvider == null)
            {
                throw new ArgumentNullException("sourceControlProvider");
            }
            this.hostedProvider = sourceControlProvider;
            int num = (int)this.hostedProvider.SetOnlineStatus(SourceControlOnlineStatus.None);

            this.hostedProvider.OnlineStatusChanged += new EventHandler <SourceControlOnlineEventArgs>(this.Provider_OnlineStatusChanged);
        }
Exemplo n.º 9
0
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="configIn">The configuration in.</param>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="sourceModelIn">The source model in.</param>
 /// <param name="sourcePluginIn">The source plugin in.</param>
 public void AssociateWithNewProject(
     Resource project,
     string workingDir,
     ISourceControlProvider sourceModelIn,
     Dictionary <string, Profile> profile,
     string visualStudioVersion)
 {
     this.sourceDir         = workingDir;
     this.associatedProject = project;
     this.sourceModel       = sourceModelIn;
     this.config            = AuthtenticationHelper.AuthToken;
 }
Exemplo n.º 10
0
        public void ResetView()
        {
            Logger.Trace("Resetting view");

            _provider.BranchChanged -= Provider_BranchChanged;
            _provider = null;

            OnPropertyChanged("CurrentBranch");

            IncludedChanges = new ObservableCollection <IFileStatusEntry>();
            UntrackedFiles  = new ObservableCollection <IFileStatusEntry>();
        }
Exemplo n.º 11
0
 public BranchesPresenter
     (            
         IBranchesView view,
         ICreateBranchView createView,
         IDeleteBranchView deleteView,
         IMergeView mergeView,
         ISourceControlProvider provider
     )
     :this(view, createView, deleteView, mergeView)
 {
     this.Provider = provider;
 }
Exemplo n.º 12
0
 public ISourceControlProvider this[string name]
 {
     get
     {
         ISourceControlProvider sourceControlProvider = (ISourceControlProvider)null;
         if (this.providerTable.ContainsKey(name))
         {
             sourceControlProvider = this.providerTable[name].Instance;
         }
         return(sourceControlProvider);
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// Set all properties that are associated with a selected project.
        /// Call this whenever you load a new project or change an existing project.
        /// </summary>
        public void Configure(ISourceControlProvider provider, string outputPath, IFilter displayFilter)
        {
            Clear();
            _sourceProvider        = provider;
            _outputPath            = outputPath;
            _extendedDisplayFilter = displayFilter;

            LoadCachedData();

            // Needs metrics
            _extendedDisplayFilter = CreateExtendedFilter(displayFilter);
        }
Exemplo n.º 14
0
 public BranchesPresenter
 (
     IBranchesView view,
     ICreateBranchView createView,
     IDeleteBranchView deleteView,
     IMergeView mergeView,
     ISourceControlProvider provider
 )
     : this(view, createView, deleteView, mergeView)
 {
     this.Provider = provider;
 }
Exemplo n.º 15
0
        private void SetChildPresenterSourceControlProviders(ISourceControlProvider provider)
        {
            _branchesPresenter.Provider = provider;
            _changesPresenter.Provider  = provider;
            _settingsPresenter.Provider = provider;
            _unsyncedPresenter.Provider = provider;

            _branchesPresenter.RefreshView();
            _changesPresenter.RefreshView();
            _unsyncedPresenter.RefreshView();
            // Purposely not refreshing settingsPresenter.
            //  Settings it's provider doesn't affect it's view.
        }
Exemplo n.º 16
0
 public ChangesModel(ISourceControlProvider provider)
 {
     m_Provider = provider;
     m_Requests = new HashSet <string>();
     m_AllItem  = new ChangeEntryData {
         Entry = new ChangeEntry(string.Empty), All = true
     };
     entryData            = new Dictionary <string, IChangeEntryData>();
     m_Conflicted         = new List <IChangeEntryData>();
     toggledEntries       = new Dictionary <string, bool>();
     SavedSearchQuery     = string.Empty;
     SavedRevisionSummary = string.Empty;
 }
Exemplo n.º 17
0
        public MainModel(ISourceControlProvider provider)
        {
            m_Provider = provider;

            // Setup events
            m_Provider.UpdatedOperationStatus             += OnUpdatedOperationStatus;
            m_Provider.UpdatedOperationProgress           += OnUpdatedOperationProgress;
            m_Provider.ErrorOccurred                      += OnErrorOccurred;
            m_Provider.ErrorCleared                       += OnErrorCleared;
            m_Provider.UpdatedConflictState               += OnUpdatedConflictState;
            m_Provider.UpdatedRemoteRevisionsAvailability += OnUpdatedRemoteRevisionsAvailability;
            WindowCache.Instance.BeforeSerialize          += OnStop;
        }
Exemplo n.º 18
0
        void Microsoft.Expression.Framework.Documents.IDocumentContainer.BeginCheckDocumentStatus(IDocument document)
        {
            ISolution currentSolution = base.Services.ProjectManager().CurrentSolution;

            if (currentSolution != null && currentSolution.IsSourceControlActive && SourceControlStatusCache.GetCachedStatus(this) == SourceControlStatus.CheckedIn)
            {
                ISourceControlProvider sourceControlProvider = base.Services.SourceControlProvider();
                string[] path = new string[] { base.DocumentReference.Path };
                if (sourceControlProvider.Checkout(path) == SourceControlSuccess.Success)
                {
                    SourceControlStatusCache.SetCachedStatus(this, SourceControlStatus.CheckedOut);
                }
            }
        }
Exemplo n.º 19
0
        public HistoryModel(ISourceControlProvider provider)
        {
            m_Provider = provider;
            m_Requests = new HashSet <string>();

            // Set initial values
            PageNumber         = WindowCache.Instance.HistoryPageNumber;
            SelectedRevisionId = string.Empty;
            SavedRevisionId    = WindowCache.Instance.SelectedHistoryRevision;

            // Setup events
            m_Provider.UpdatedHistoryEntries     += OnUpdatedHistoryEntries;
            WindowCache.Instance.BeforeSerialize += OnStop;
        }
Exemplo n.º 20
0
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="projectIn">The project in.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="profile">The profile.</param>
        public void AssociateWithNewProject(
            Resource projectIn,
            string workingDir,
            ISourceControlProvider provider,
            Dictionary <string, Profile> profile,
            string visualStudioVersion)
        {
            this.project = projectIn;

            foreach (var availableOption in this.AvailableOptionsModels)
            {
                availableOption.ReloadDataFromDisk(projectIn);
            }
        }
Exemplo n.º 21
0
        private void SetChildPresenterSourceControlProviders(ISourceControlProvider provider)
        {
            if (Provider.CurrentBranch == null)
            {
                ViewModel_ErrorThrown(null,
                                      new ErrorEventArgs(RubberduckUI.SourceControl_NoBranchesTitle, RubberduckUI.SourceControl_NoBranchesMessage));
                return;
            }

            foreach (var tab in TabItems)
            {
                tab.ViewModel.Provider = provider;
            }
        }
Exemplo n.º 22
0
        private void CloneRepo(SecureCredentials credentials = null)
        {
            _isCloning = true;
            _listening = false;

            Logger.Trace("Cloning repo");
            ISourceControlProvider oldProvider;

            try
            {
                oldProvider = _provider;
                _provider   = _providerFactory.CreateProvider(_vbe.ActiveVBProject);
                _providerFactory.Release(oldProvider);
                var repo = _provider.Clone(CloneRemotePath, LocalDirectory, credentials);
                AddOrUpdateLocalPathConfig(new Repository
                {
                    Id             = _vbe.ActiveVBProject.HelpFile,
                    LocalLocation  = repo.LocalLocation,
                    RemoteLocation = repo.RemoteLocation
                });
                oldProvider = Provider;
                Provider    = _providerFactory.CreateProvider(_vbe.ActiveVBProject, repo);
                _providerFactory.Release(oldProvider);
            }
            catch (SourceControlException ex)
            {
                const string unauthorizedMessage = "Request failed with status code: 401";
                if (ex.InnerException != null && ex.InnerException.Message != unauthorizedMessage)
                {
                    _isCloning = false;
                }

                HandleViewModelError(this, new ErrorEventArgs(ex.Message, ex.InnerException, NotificationType.Error));
                return;
            }
            catch
            {
                HandleViewModelError(this,
                                     new ErrorEventArgs(RubberduckUI.SourceControl_UnknownErrorTitle,
                                                        RubberduckUI.SourceControl_UnknownErrorMessage, NotificationType.Error));
                throw;
            }

            _isCloning = false;
            _listening = true;
            CloseCloneRepoGrid();

            Status = RubberduckUI.Online;
        }
Exemplo n.º 23
0
        public void ResetView()
        {
            Logger.Trace("Resetting view");

            _provider         = null;
            _currentBranch    = string.Empty;
            SourceBranch      = string.Empty;
            DestinationBranch = CurrentBranch;

            OnPropertyChanged("LocalBranches");
            OnPropertyChanged("PublishedBranches");
            OnPropertyChanged("UnpublishedBranches");
            OnPropertyChanged("Branches");
            OnPropertyChanged("CurrentBranch");
        }
Exemplo n.º 24
0
        private void RefreshSolution()
        {
            MessageBoxResult messageBoxResult;

            if (this.SolutionFileInformation != null && this.SolutionFileInformation.HasChanged())
            {
                string solutionChangedDialogMessage = StringTable.SolutionChangedDialogMessage;
                string path = base.DocumentReference.Path;
                if (!SolutionBase.IsReloadPromptEnabled())
                {
                    messageBoxResult = MessageBoxResult.Yes;
                }
                else
                {
                    MessageBoxArgs messageBoxArg        = new MessageBoxArgs();
                    CultureInfo    currentCulture       = CultureInfo.CurrentCulture;
                    object[]       shortApplicationName = new object[] { path, this.Services.ExpressionInformationService().ShortApplicationName };
                    messageBoxArg.Message = string.Format(currentCulture, solutionChangedDialogMessage, shortApplicationName);
                    messageBoxArg.Button  = MessageBoxButton.YesNo;
                    messageBoxArg.Image   = MessageBoxImage.Exclamation;
                    MessageBoxArgs messageBoxArg1 = messageBoxArg;
                    messageBoxResult = this.Services.MessageDisplayService().ShowMessage(messageBoxArg1);
                }
                if (messageBoxResult == MessageBoxResult.Yes && this.Save(false))
                {
                    this.Services.ExceptionHandler(() => {
                        this.CloseAllProjects();
                        ((ProjectManager)this.Services.ProjectManager()).OnSolutionClosed(new SolutionEventArgs(this));
                        this.LoadInternal();
                        ((ProjectManager)this.Services.ProjectManager()).OnSolutionOpened(new SolutionEventArgs(this));
                        this.reloadDocuments = true;
                        if (this.IsUnderSourceControl)
                        {
                            ISourceControlProvider sourceControlProvider = this.Services.SourceControlProvider();
                            if (sourceControlProvider != null)
                            {
                                sourceControlProvider.OpenProject(base.DocumentReference.Path, false);
                            }
                        }
                        if (this.Services.ProjectManager().ItemSelectionSet.Count == 0)
                        {
                            this.Services.ProjectManager().ItemSelectionSet.SetSelection(this);
                        }
                    }, () => string.Format(CultureInfo.CurrentCulture, StringTable.DialogRefreshFailedMessage, new object[] { base.DocumentReference.Path }));
                }
                this.UpdateFileInformation();
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="IssuesSearchModel" /> class.
 /// </summary>
 /// <param name="configurationHelper">The configuration helper.</param>
 /// <param name="restService">The rest service.</param>
 /// <param name="manager">The manager.</param>
 /// <param name="translator">The translator.</param>
 /// <param name="analyser">The analyser.</param>
 public IssuesSearchModel(
     IConfigurationHelper configurationHelper,
     ISonarRestService restService,
     INotificationManager manager,
     ISQKeyTranslator translator,
     ISonarLocalAnalyser analyser,
     IList <IIssueTrackerPlugin> issuetrackerplugins)
 {
     this.keyTranslator         = translator;
     this.notificationmanager   = manager;
     this.configurationHelper   = configurationHelper;
     this.restService           = restService;
     this.issuesSearchViewModel = new IssuesSearchViewModel(this, manager, this.configurationHelper, restService, translator, analyser, issuetrackerplugins);
     this.restSourceModel       = new RestSourceControlModel(manager, restService);
     AssociationModel.RegisterNewModelInPool(this);
 }
Exemplo n.º 26
0
 public void UnregisterProvider(string name)
 {
     if (!this.providerTable.ContainsKey(name))
     {
         return;
     }
     if (this.providerTable[name].IsLoaded)
     {
         if (this.ActiveProvider == this.providerTable[name].Instance)
         {
             this.ActiveProvider = (ISourceControlProvider)null;
         }
         this.providerTable[name].Instance.Uninitialize();
     }
     this.providerTable.Remove(name);
 }
Exemplo n.º 27
0
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="workDir">The work dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="profile">The profile.</param>
        public void AssociateWithNewProject(
            Resource project,
            string workDir,
            ISourceControlProvider provider,
            Dictionary <string, Profile> profile,
            string visualStudioVersion)
        {
            this.sourceDir         = workDir;
            this.associatedProject = project;

            foreach (var plugin in this.plugins)
            {
                var plugDesc = plugin.GetPluginDescription();
                try
                {
                    string isEnabled = this.configurationHelper.ReadSetting(Context.IssueTrackerProps, project.Name, plugDesc.Name).Value;
                    if (isEnabled.Equals("true", StringComparison.CurrentCultureIgnoreCase))
                    {
                        plugDesc.Enabled = true;
                    }
                    else
                    {
                        plugDesc.Enabled = false;
                    }
                }
                catch (Exception)
                {
                    this.configurationHelper.WriteSetting(Context.IssueTrackerProps, project.Name, plugDesc.Name, "true");
                    plugDesc.Enabled = true;
                }

                try
                {
                    var menuPlugin = plugin as IMenuCommandPlugin;
                    if (menuPlugin != null)
                    {
                        System.Windows.Application.Current.Dispatcher.Invoke(delegate { menuPlugin.UpdateConfiguration(AuthtenticationHelper.AuthToken, project, this.vshelper); });
                    }

                    plugin.AssociateProject(project, AuthtenticationHelper.AuthToken, profile, visualStudioVersion);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// The init data association.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="sourceModelIn">The source model in.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        public void AssociateWithNewProject(ISonarConfiguration config, Resource project, string workingDir, ISourceControlProvider sourceModelIn, IIssueTrackerPlugin sourcePlugin)
        {
            this.sourceModel       = sourceModelIn;
            this.associatedProject = project;
            this.userConf          = config;
            this.issuesSearchViewModel.CanQUeryIssues = true;
            this.notificationmanager.EndedWorking();

            List <User> usortedList = this.restService.GetUserList(config);

            if (usortedList != null && usortedList.Count > 0)
            {
                this.issuesSearchViewModel.UsersList = new ObservableCollection <User>(usortedList.OrderBy(i => i.Name));
            }

            this.ReloadPlanData();
        }
Exemplo n.º 29
0
        private void InitRepo()
        {
            using (var folderPicker = _folderBrowserFactory.CreateFolderBrowser((RubberduckUI.SourceControl_CreateNewRepo)))
            {
                if (folderPicker.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                _provider = _providerFactory.CreateProvider(_vbe.ActiveVBProject);
                var repo = _provider.InitVBAProject(folderPicker.SelectedPath);
                Provider = _providerFactory.CreateProvider(_vbe.ActiveVBProject, repo, _wrapperFactory);

                AddOrUpdateLocalPathConfig((Repository)repo);
                Status = RubberduckUI.Online;
            }
        }
        /// <summary>
        /// The init data association.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="sourceModelIn">The source model in.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        /// <param name="profile">The profile.</param>
        public void AssociateWithNewProject(
            Resource project,
            string workingDir,
            ISourceControlProvider sourceModelIn,
            Dictionary <string, Profile> profile,
            string visualStudioVersion)
        {
            this.sourceModel       = sourceModelIn;
            this.associatedProject = project;
            this.issuesSearchViewModel.CanQUeryIssues = true;
            this.notificationmanager.EndedWorking();

            List <User> usortedList = this.restService.GetUserList(AuthtenticationHelper.AuthToken);

            if (usortedList != null && usortedList.Count > 0)
            {
                this.issuesSearchViewModel.AssigneeList = new ObservableCollection <User>(usortedList.OrderBy(i => i.Name));
            }
        }
 /// <summary>
 /// The init data association.
 /// </summary>
 /// <param name="userConnectionConfig">The user connection config.</param>
 /// <param name="associatedProjectIn">The associated project in.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 public void AssociateWithNewProject(
     ISonarConfiguration userConnectionConfig,
     Resource associatedProjectIn,
     string workingDir,
     ISourceControlProvider provider,
     IIssueTrackerPlugin sourcePlugin)
 {
     this.userConfiguration = userConnectionConfig;
     this.associatedProject = associatedProjectIn;
     this.Configuration     = userConnectionConfig;
     if (this.vsenvironmenthelper != null)
     {
         this.IsRunningInVisualStudio = this.vsenvironmenthelper.AreWeRunningInVisualStudio();
     }
     else
     {
         this.IsRunningInVisualStudio = false;
     }
 }
Exemplo n.º 32
0
        private void _loginView_Confirm(object sender, EventArgs e)
        {
            var pwd = new SecureString();

            foreach (var c in _loginView.Password.ToCharArray())
            {
                pwd.AppendChar(c);
            }

            pwd.MakeReadOnly();

            var creds = new SecureCredentials(_loginView.Username, pwd);

            _provider = _providerFactory.CreateProvider(this.VBE.ActiveVBProject,
                                                        _config.Repositories.First(repo => repo.Name == this.VBE.ActiveVBProject.Name),
                                                        creds);

            SetChildPresenterSourceControlProviders(_provider);
        }
Exemplo n.º 33
0
        public SourceControlComponent(GUIController guiController, AGSEditor agsEditor)
            : base(guiController, agsEditor)
        {
            _sourceControl = _agsEditor.SourceControlProvider;

            try
            {
                if (!_sourceControl.Initialize(_guiController.TopLevelWindowHandle))
                {
                    _guiController.ShowMessage("Your source code control provider '" + _sourceControl.ProviderName + "' failed to initialize.", MessageBoxIcon.Warning);
                }
                if (_sourceControl.Available)
                {
                    _menuCommands.Commands.Add(new MenuCommand(ADD_TO_SOURCE_CONTROL_COMMAND, "Add to source control"));
                    _guiController.AddMenuItems(this, _menuCommands);
                }
            }
            catch (Exception ex)
            {
                _guiController.ShowMessage("A serious error occurred attempting to connect to your source control provider. Please ensure that '" + _sourceControl.ProviderName + "' is properly installed.\n\nError details: " + ex.ToString(), MessageBoxIcon.Stop);
            }
        }
Exemplo n.º 34
0
		public void Initialize()
		{
			sourceControl = SourceControlProviderFactory.GetProvider();
			FullPath = string.Format("{0}{1}", Vs.Helper.SolutionFolder, CsProj);
			Project = Vs.Helper.Solution.GetProject(FullPath);
			Folder = Path.GetDirectoryName(FullPath);
			//var built = Project.Build(new string[] { "debug" }, new ILogger[] { new MsBuildLogger()});

			var outputPath = Project.GetProperty("OutputPath").EvaluatedValue;
			var extension = Project.GetProperty("OutputType").EvaluatedValue.ToLower() == "exe" ? "exe" : "dll";
			var assemblyName = Project.GetProperty("AssemblyName").EvaluatedValue + "." + extension;
			var asmPath = IoNic.PathCombineLocal(Path.GetDirectoryName(FullPath), outputPath, assemblyName);

			if (!File.Exists(asmPath))//|| !built
				throw new Exception("Try building your project (in debug mode).  Could not find " + asmPath);

			var assemblyBytes = File.ReadAllBytes(asmPath);
			var asm = Assembly.Load(assemblyBytes);
			Assembly = asm;
			discoverTypes();
			RootNamespace = Assembly.GetName().Name;
			UsingStatements.Add(RootNamespace);
		}
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="projectIn">The project in.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        public void AssociateWithNewProject(ISonarConfiguration config, Resource projectIn, string workingDir, ISourceControlProvider provider, IIssueTrackerPlugin sourcePlugin)
        {
            this.project = projectIn;

            foreach (var availableOption in this.AvailableOptionsModels)
            {
                availableOption.ReloadDataFromDisk(projectIn);
            }
        }
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="project">The project.</param>
        /// <param name="workDir">The work dir.</param>
        /// <param name="provider">The provider.</param>
        public void AssociateWithNewProject(ISonarConfiguration config, Resource project, string workDir, ISourceControlProvider provider)
        {
            this.sourceDir = workDir;
            this.sonarConf = config;
            this.associatedProject = project;

            foreach (var plugin in this.plugins)
            {
                var plugDesc = plugin.GetPluginDescription();
                try
                {
                    string isEnabled = this.configurationHelper.ReadSetting(Context.IssueTrackerProps, project.Name, plugDesc.Name).Value;
                    if (isEnabled.Equals("true", StringComparison.CurrentCultureIgnoreCase))
                    {
                        plugDesc.Enabled = true;
                    }
                    else
                    {
                        plugDesc.Enabled = false;
                    }
                }
                catch (Exception)
                {
                    this.configurationHelper.WriteOptionInApplicationData(Context.IssueTrackerProps, project.Name, plugDesc.Name, "true");
                    plugDesc.Enabled = true;
                }

                try
                {
                    plugin.AssociateProject(project, config);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }

            // select issue tracker plugin to use
            this.SelectIssueTrackerPlugin();
        }
        /// <summary>
        /// The init data association.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="profile">The profile.</param>
        public void AssociateWithNewProject(
            Resource project,
            string workingDir,
            ISourceControlProvider provider,
            Dictionary<string, Profile> profile,
            string visualStudioVersion)
        {
            if (project == null || string.IsNullOrEmpty(project.SolutionRoot))
            {
                return;
            }

            this.associatedProject = project;
            this.IsAssociatedWithProject = this.associatedProject != null;
            this.SourceWorkingDir = workingDir;
            this.CanRunAnalysis = true;
            this.FileAnalysisIsEnabled = true;
        }
        /// <summary>
        /// The init data association.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="sourceModelIn">The source model in.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        /// <param name="profile">The profile.</param>
        public void AssociateWithNewProject(
            Resource project,
            string workingDir,
            ISourceControlProvider sourceModelIn,
            Dictionary<string, Profile> profile,
            string visualStudioVersion)
        {
            this.sourceModel = sourceModelIn;
            this.associatedProject = project;
            this.issuesSearchViewModel.CanQUeryIssues = true;
            this.notificationmanager.EndedWorking();

            List<User> usortedList = this.restService.GetUserList(AuthtenticationHelper.AuthToken);
            if (usortedList != null && usortedList.Count > 0)
            {
                this.issuesSearchViewModel.AssigneeList = new ObservableCollection<User>(usortedList.OrderBy(i => i.Name));
            }
        }
Exemplo n.º 39
0
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="configIn">The configuration in.</param>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        public void AssociateWithNewProject(ISonarConfiguration configIn, Resource project, string workingDir, ISourceControlProvider provider, IIssueTrackerPlugin sourcePlugin)
        {
            this.sourceDir = workingDir;
            this.associatedProject = project;
            this.config = configIn;

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

                        foreach (var item in this.rest.GetAvailableActionPlan(this.config, project.Key))
                        {
                            var menu = new PlanMenu(this.rest, this.model, this.manager, false) { CommandText = item.Name, IsEnabled = true };
                            menu.AssociateWithNewProject(configIn, project, workingDir, provider, sourcePlugin);
                            this.SubItems.Add(menu);
                        }
                    });
            }
        }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="sourceModel">The source model.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 /// <param name="profile">The profile.</param>
 public void AssociateWithNewProject(
     Resource project,
     string workingDir,
     ISourceControlProvider sourceModel,
     IIssueTrackerPlugin sourcePlugin,
     Dictionary<string, Profile> profile)
 {
     // not necessary
 }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="config">The configuration.</param>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 public void AssociateWithNewProject(ISonarConfiguration config, Resource project, string workingDir, ISourceControlProvider provider, IIssueTrackerPlugin sourcePlugin)
 {
     // menu not accessing services
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SonarQubeViewModel" /> class.
        /// </summary>
        /// <param name="vsverionIn">The vsverion in.</param>
        /// <param name="helper">The helper.</param>
        /// <param name="notification">The notification.</param>
        /// <param name="translator">The translator.</param>
        /// <param name="restService">The rest service.</param>
        /// <param name="sourceControl">The source control.</param>
        /// <param name="pluginManager">The plugin manager.</param>
        /// <param name="locaAnalyser">The local analyser.</param>
        public SonarQubeViewModel(
            string vsverionIn,
            IConfigurationHelper helper,
            INotificationManager notification,
            ISQKeyTranslator translator,
            ISonarRestService restService,
            ISourceControlProvider sourceControl = null,
            IPluginManager pluginManager = null,
            ISonarLocalAnalyser locaAnalyser = null)
        {
            this.vsversion = vsverionIn;
            this.ToolsProvidedByPlugins = new ObservableCollection<MenuItem>();
            this.AvailableProjects = new ObservableCollection<Resource>();

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

            this.VSonarQubeOptionsViewData.ResetUserData();

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

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

            this.InitCommands();
        }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="configIn">The configuration in.</param>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="sourceModelIn">The source model in.</param>
 /// <param name="sourcePluginIn">The source plugin in.</param>
 public void AssociateWithNewProject(ISonarConfiguration configIn, Resource project, string workingDir, ISourceControlProvider sourceModelIn, IIssueTrackerPlugin sourcePluginIn)
 {
     this.sourceDir = workingDir;
     this.associatedProject = project;
     this.config = configIn;
     this.issueTrackerPlugin = sourcePluginIn;
     this.sourceModel = sourceModelIn;
 }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="config">The configuration.</param>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 public void AssociateWithNewProject(
     Resource project,
     string workingDir,
     ISourceControlProvider provider,
     Dictionary<string, Profile> profile,
     string visualStudioVersion)
 {
     // menu not accessing services
 }
        /// <summary>
        /// The init data association.
        /// </summary>
        /// <param name="userConnectionConfig">The user connection config.</param>
        /// <param name="associatedProjectIn">The associated project in.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        public void AssociateWithNewProject(
            Resource associatedProjectIn,
            string workingDir,
            ISourceControlProvider provider,
            Dictionary<string, Profile> profile,
            string visualStudioVersion)
        {
            if (associatedProjectIn == null || string.IsNullOrEmpty(associatedProjectIn.SolutionRoot))
            {
                return;
            }

            this.associatedProject = associatedProjectIn;
            if (this.vsenvironmenthelper != null)
            {
                this.IsRunningInVisualStudio = this.vsenvironmenthelper.AreWeRunningInVisualStudio();
            }
            else
            {
                this.IsRunningInVisualStudio = false;
            }
        }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="configIn">The configuration in.</param>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 public void AssociateWithNewProject(ISonarConfiguration configIn, Resource project, string workingDir, ISourceControlProvider provider, IIssueTrackerPlugin sourcePlugin)
 {
     this.config = configIn;
 }
        /// <summary>
        /// The init data association.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="sourceModelIn">The source model in.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        public void AssociateWithNewProject(ISonarConfiguration config, Resource project, string workingDir, ISourceControlProvider sourceModelIn, IIssueTrackerPlugin sourcePlugin)
        {
            this.sourceModel = sourceModelIn;
            this.associatedProject = project;
            this.userConf = config;
            this.issuesSearchViewModel.CanQUeryIssues = true;
            this.notificationmanager.EndedWorking();

            List<User> usortedList = this.restService.GetUserList(config);
            if (usortedList != null && usortedList.Count > 0)
            {
                this.issuesSearchViewModel.UsersList = new ObservableCollection<User>(usortedList.OrderBy(i => i.Name));
            }

            this.ReloadPlanData();
        }
        /// <summary>
        /// Called when [solution open].
        /// </summary>
        /// <param name="solutionName">Name of the solution.</param>
        /// <param name="solutionPath">The solution path.</param>
        /// <param name="fileInView">The file in view.</param>
        /// <param name="sourceProvider">The source provider.</param>
        public void OnSolutionOpen(string solutionName, string solutionPath, string fileInView, ISourceControlProvider sourceProvider = null)
        {
            this.ErrorIsFound = false;
            this.IsSolutionOpen = true;

            if (sourceProvider == null)
            {
                // create new source control provider
                this.sourceControl = new SourceControlModel(
                    this.pluginManager.SourceCodePlugins,
                    solutionPath,
                    this.Logger,
                    this.sonarRestConnector);
            }
            else
            {
                this.sourceControl = sourceProvider;
            }

            this.AssociationModule.AssociateProjectToSolution(solutionName, solutionPath, this.AvailableProjects, this.SourceControl);

            if (!string.IsNullOrEmpty(fileInView) && File.Exists(fileInView))
            {
                this.RefreshDataForResource(fileInView, File.ReadAllText(fileInView), false);
            }

            this.SetupAssociationMessages();
        }
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="workDir">The work dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="profile">The profile.</param>
        public void AssociateWithNewProject(
            Resource project,
            string workDir,
            ISourceControlProvider provider,
            Dictionary<string, Profile> profile,
            string visualStudioVersion)
        {
            this.sourceDir = workDir;
            this.associatedProject = project;

            foreach (var plugin in this.plugins)
            {
                var plugDesc = plugin.GetPluginDescription();
                try
                {
                    string isEnabled = this.configurationHelper.ReadSetting(Context.IssueTrackerProps, project.Name, plugDesc.Name).Value;
                    if (isEnabled.Equals("true", StringComparison.CurrentCultureIgnoreCase))
                    {
                        plugDesc.Enabled = true;
                    }
                    else
                    {
                        plugDesc.Enabled = false;
                    }
                }
                catch (Exception)
                {
                    this.configurationHelper.WriteSetting(Context.IssueTrackerProps, project.Name, plugDesc.Name, "true");
                    plugDesc.Enabled = true;
                }

                try
                {
                    var menuPlugin = plugin as IMenuCommandPlugin;
                    if (menuPlugin != null)
                    {
                        System.Windows.Application.Current.Dispatcher.Invoke(delegate { menuPlugin.UpdateConfiguration(AuthtenticationHelper.AuthToken, project, this.vshelper); });
                    }

                    plugin.AssociateProject(project, AuthtenticationHelper.AuthToken, profile, visualStudioVersion);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }
        }
Exemplo n.º 50
0
        public void DoEditorInitialization()
        {
            _game = new Game();
            _sourceControl = new SourceControlProvider();
            _recentGamesList = new RecentGamesList();
            _debugger = new DebugController(_engineComms);
            _debugger.BreakAtLocation += new DebugController.BreakAtLocationHandler(_debugger_BreakAtLocation);

            _builtInScriptHeader = new Script(BUILT_IN_HEADER_FILE_NAME, Resources.ResourceManager.GetResourceAsString("agsdefns.sh"), true);
            AutoComplete.ConstructCache(_builtInScriptHeader);

            Factory.NativeProxy.NewGameLoaded(Factory.AGSEditor.CurrentGame);
        }
        /// <summary>
        /// Associates the with new project.
        /// </summary>
        /// <param name="projectIn">The project in.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="profile">The profile.</param>
        public void AssociateWithNewProject(
            Resource projectIn,
            string workingDir,
            ISourceControlProvider provider,
            Dictionary<string, Profile> profile,
            string visualStudioVersion)
        {
            this.project = projectIn;

            foreach (var availableOption in this.AvailableOptionsModels)
            {
                availableOption.ReloadDataFromDisk(projectIn);
            }
        }
 /// <summary>
 /// The init data association.
 /// </summary>
 /// <param name="userConnectionConfig">The user connection config.</param>
 /// <param name="associatedProjectIn">The associated project in.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 public void AssociateWithNewProject(
     ISonarConfiguration userConnectionConfig,
     Resource associatedProjectIn,
     string workingDir,
     ISourceControlProvider provider,
     IIssueTrackerPlugin sourcePlugin)
 {
     this.userConfiguration = userConnectionConfig;
     this.associatedProject = associatedProjectIn;
     this.Configuration = userConnectionConfig;
     if (this.vsenvironmenthelper != null)
     {
         this.IsRunningInVisualStudio = this.vsenvironmenthelper.AreWeRunningInVisualStudio();
     }
     else
     {
         this.IsRunningInVisualStudio = false;
     }
 }
 /// <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>
 /// Associates the with new project.
 /// </summary>
 /// <param name="configIn">The configuration in.</param>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="sourceModel">The source model.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 public void AssociateWithNewProject(ISonarConfiguration configIn, Resource project, string workingDir, ISourceControlProvider sourceModel, IIssueTrackerPlugin sourcePlugin)
 {
     // not neccessary
 }
Exemplo n.º 55
0
 public ChangesPresenter(IChangesView view, ISourceControlProvider provider)
     :this(view)
 {
     this.Provider = provider;
 }
        /// <summary>
        /// The init data association.
        /// </summary>
        /// <param name="userConnectionConfig">The user connection config.</param>
        /// <param name="associatedProjectIn">The associated project in.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        public void AssociateWithNewProject(
            ISonarConfiguration userConnectionConfig,
            Resource associatedProjectIn,
            string workingDir,
            ISourceControlProvider provider,
            IIssueTrackerPlugin sourcePlugin)
        {
            this.userConfiguration = userConnectionConfig;
            this.associatedProject = associatedProjectIn;
            this.Configuration = userConnectionConfig;
            if (this.vsenvironmenthelper != null)
            {
                this.IsRunningInVisualStudio = this.vsenvironmenthelper.AreWeRunningInVisualStudio();
            }
            else
            {
                this.IsRunningInVisualStudio = false;
            }

            List<SonarActionPlan> usortedListofPlan = this.restservice.GetAvailableActionPlan(userConnectionConfig, this.associatedProject.Key);
            if (usortedListofPlan != null && usortedListofPlan.Count > 0)
            {
                this.AvailableActionPlans = new ObservableCollection<SonarActionPlan>(usortedListofPlan.OrderBy(i => i.Name));
            }
        }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="workingDir">The working dir.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="profile">The profile.</param>
 public void AssociateWithNewProject(
     Resource project,
     string workingDir,
     ISourceControlProvider provider,
     Dictionary<string, Profile> profile,
     string visualStudioVersion)
 {
     this.sourceDir = workingDir;
     this.associatedProject = project;
 }
 /// <summary>
 /// Associates the with new project.
 /// </summary>
 /// <param name="config">The configuration.</param>
 /// <param name="project">The project.</param>
 /// <param name="workDir">The work dir.</param>
 /// <param name="provider">The provider.</param>
 /// <param name="sourcePlugin">The source plugin.</param>
 public void AssociateWithNewProject(ISonarConfiguration config, Resource project, string workDir, ISourceControlProvider provider, IIssueTrackerPlugin sourcePlugin)
 {
     this.sonarConfig = config;
     this.associatedProject = project;
     this.sourceDir = workDir;
 }
        /// <summary>
        /// Starts the automatic association.
        /// </summary>
        /// <param name="solutionName">Name of the solution.</param>
        /// <param name="solutionPath">The solution path.</param>
        public void StartAutoAssociation(string solutionName, string solutionPath)
        {
            if (!this.model.IsConnected || (this.OpenSolutionName == solutionName && this.OpenSolutionPath == solutionPath))
            {
                return;
            }

            this.OpenSolutionName = solutionName;
            this.OpenSolutionPath = solutionPath;

            // create a new source control provider for solution
            this.sourceControl = new SourceControlModel(this.pluginManager.SourceCodePlugins, this.OpenSolutionPath);

            if (this.model.IsConnected)
            {
                Resource solResource = this.GetResourceForSolution(solutionName, solutionPath);

                if (solResource != null)
                {
                    foreach (Resource availableProject in this.associationViewModel.AvailableProjects)
                    {
                        if (availableProject.Key.Equals(solResource.Key))
                        {
                            if (availableProject.IsBranch)
                            {
                                var branchName = this.CurrentBranch().Replace("/", "_");
                                foreach (var branch in availableProject.BranchResources)
                                {
                                    if (branch.Name.EndsWith(branchName))
                                    {
                                        availableProject.SolutionRoot = solutionPath;
                                        branch.SolutionRoot = solutionPath;
                                        branch.Default = true;
                                        this.associationViewModel.SelectedProject = availableProject;
                                        this.associationViewModel.SelectedBranchProject = branch;
                                        this.AssignASonarProjectToSolution(availableProject, branch);
                                        this.IsConnectedButNotAssociated = false;
                                        this.IsAssociated = true;
                                        this.CreateConfiguration(Path.Combine(solutionPath, "sonar-project.properties"));
                                        return;
                                    }
                                }
                            }
                            else
                            {
                                availableProject.SolutionRoot = solutionPath;
                                this.associationViewModel.SelectedProject = availableProject;
                                this.AssignASonarProjectToSolution(availableProject, null);
                                this.IsConnectedButNotAssociated = false;
                                this.IsAssociated = true;
                                this.CreateConfiguration(Path.Combine(solutionPath, "sonar-project.properties"));
                            }

                            return;
                        }

                        if (availableProject.IsBranch)
                        {
                            foreach (var branch in availableProject.BranchResources)
                            {
                                if (branch.Key.Equals(solResource.Key))
                                {
                                    availableProject.SolutionRoot = solutionPath;
                                    branch.SolutionRoot = solutionPath;
                                    this.associationViewModel.SelectedProject = availableProject;
                                    this.associationViewModel.SelectedBranchProject = branch;
                                    this.AssignASonarProjectToSolution(availableProject, branch);
                                    this.IsConnectedButNotAssociated = false;
                                    this.IsAssociated = true;
                                    this.CreateConfiguration(Path.Combine(solutionPath, "sonar-project.properties"));
                                    return;
                                }
                            }
                        }
                    }
                }
                else
                {
                    this.ShowAssociationWindow();
                }
            }
        }
        /// <summary>
        /// The init data association.
        /// </summary>
        /// <param name="config">The configuration.</param>
        /// <param name="project">The project.</param>
        /// <param name="workingDir">The working dir.</param>
        /// <param name="provider">The provider.</param>
        /// <param name="sourcePlugin">The source plugin.</param>
        public void AssociateWithNewProject(ISonarConfiguration config, Resource project, string workingDir, ISourceControlProvider provider, IIssueTrackerPlugin sourcePlugin)
        {
            this.userConf = config;
            this.associatedProject = project;
            this.IsAssociatedWithProject = this.associatedProject != null;

            this.SourceWorkingDir = workingDir;

            if (!string.IsNullOrEmpty(this.SourceWorkingDir) && Directory.Exists(this.SourceWorkingDir))
            {
                this.CanRunAnalysis = true;
                this.LoadingSonarData = true;
                this.localAnalyserModule.AssociateWithProject(project, config);
            }
        }