Exemple #1
0
        public override bool Execute(GitUIEventArgs gitUiCommands)
        {
            string basePath    = AppDomain.CurrentDomain.BaseDirectory;
            string pluginsPath = ManagedExtensibility.UserPluginsPath;

            Args args = new Args();

            args.Path         = pluginsPath;
            args.Dependencies = new List <Args.Dependency>()
            {
                new Args.Dependency("GitExtensions.Extensibility")
            };
            args.Tags          = "GitExtensions";
            args.Monikers      = FrameworkMonikers;
            args.SelfPackageId = PackageId;
            args.ProcessNamesToKillBeforeChange = new[] { Process.GetCurrentProcess().ProcessName };

            ProcessStartInfo info = new ProcessStartInfo()
            {
                FileName        = Path.Combine(pluginsPath, PackageId, PluginManagerRelativePath),
                Arguments       = args.ToString(),
                UseShellExecute = false,
            };

            Process.Start(info);

            if (Configuration.CloseInstances)
            {
                CloseAllOtherInstances();
                Application.Exit();
            }

            return(false);
        }
Exemple #2
0
        public override bool Execute(GitUIEventArgs args)
        {
            using var frm = new FindLargeFilesForm(_sizeLargeFile.ValueOrDefault(Settings), args);
            frm.ShowDialog(args.OwnerForm);

            return(true);
        }
Exemple #3
0
        public override bool Execute(GitUIEventArgs args)
        {
            using var frm = new CreateLocalBranchesForm(args);
            frm.ShowDialog(args.OwnerForm);

            return(true);
        }
Exemple #4
0
        public override bool Execute(GitUIEventArgs args)
        {
            using var form = new ProxySwitcherForm(this, Settings, args);
            form.ShowDialog(args.OwnerForm);

            return(false);
        }
Exemple #5
0
        public CreateLocalBranchesForm(GitUIEventArgs gitUiCommands)
        {
            InitializeComponent();
            InitializeComplete();

            _gitUiCommands = gitUiCommands;
        }
Exemple #6
0
        private void gitUiCommands_PreCommit(object sender, GitUIEventArgs e)
        {
            if (!_enabledSettings.ValueOrDefault(Settings))
            {
                return;
            }

            if (_jira?.Issues == null)
            {
                return;
            }

            ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                var currentMessages = await GetMessageToCommitAsync(_jira, _query, _stringTemplate);

                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                _currentMessages = currentMessages;
                foreach (var message in _currentMessages)
                {
                    e.GitUICommands.AddCommitTemplate(message.Title, () => message.Text);
                }
            });
        }
Exemple #7
0
        private async void ShowPluginWindow(GitUIEventArgs args)
        {
            try
            {
                var module = args.GitModule;

                GitModule gitModule = (GitModule)module;

                var remoteUrl = (await gitModule.GetRemotesAsync()).First().FetchUrl;

                GitModel gitModel = new GitModel(gitModule, args.OwnerForm, (GitUICommands)args.GitUICommands);

                var gitLabAddress = _gitLabAddress.ValueOrDefault(Settings);

                var gitLabKey = _gitLabPrivateKey.ValueOrDefault(Settings);

                var gitFavoriteGroup = _gitLabFavoriteGroup.ValueOrDefault(Settings);

                var gitLabModel = await GitLabModel.CreateAsync(gitLabAddress, gitLabKey, remoteUrl, gitFavoriteGroup);

                var pluginWindow = new PluginWindow
                {
                    DataContext = new MergeRequestsManagerViewModel(gitLabModel, gitModel)
                };

                pluginWindow.Show();
            }
            catch (Exception)
            {
            }
        }
Exemple #8
0
 public override bool Execute(GitUIEventArgs args)
 {
     using (var frm = new GitFlowForm(args))
     {
         frm.ShowDialog(args.OwnerForm);
         return(frm.IsRefreshNeeded);
     }
 }
        public ReleaseNotesGeneratorForm(GitUIEventArgs gitUiCommands)
        {
            InitializeComponent();
            InitializeComplete();

            _gitUiCommands    = gitUiCommands;
            _gitLogLineParser = new GitLogLineParser();
        }
        public override bool Execute(GitUIEventArgs args)
        {
            using (var frm = new BitbucketPullRequestForm(this, Settings, args))
            {
                frm.ShowDialog(args.OwnerForm);
            }

            return(true);
        }
        public override bool Execute(GitUIEventArgs args)
        {
            using (var form = new FormPluginInformation())
            {
                form.ShowDialog();
            }

            return(false);
        }
Exemple #12
0
        public override bool Execute(GitUIEventArgs args)
        {
            using (var form = new ZipperForm(this, Settings, args))
            {
                form.ShowDialog(args.OwnerForm);
            }

            return(false);
        }
        public override bool Execute(GitUIEventArgs args)
        {
            using ReleaseNotesGeneratorForm form = new(args);
            if (form.ShowDialog(args.OwnerForm) == DialogResult.OK)
            {
                return(true);
            }

            return(false);
        }
Exemple #14
0
        public ReleaseNotesGeneratorForm(GitUIEventArgs gitUiCommands)
        {
            InitializeComponent();
            Translate();

            _gitUiCommands    = gitUiCommands;
            _gitLogLineParser = new GitLogLineParser();

            Icon = _gitUiCommands?.GitUICommands.FormIcon;
        }
Exemple #15
0
        public ZipperForm(ZipperPlugin plugin, ISettingsSource settings, GitUIEventArgs gitUiCommands)
        {
            InitializeComponent();
            Translate();

            Text            = _pluginDescription.Text;
            _plugin         = plugin;
            _settings       = settings;
            _gitCommands    = gitUiCommands.GitModule;
            _originalBranch = _gitCommands.GetSelectedBranch();
            _entriesAdded   = 0;
        }
Exemple #16
0
            private void UICommands_PostRepositoryChanged(object sender, GitUIEventArgs e)
            {
                if (!IsAttached)
                {
                    return;
                }

                ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
                {
                    await PostRepositoryChangedAsync();
                }).FileAndForget();
            }
Exemple #17
0
        public override bool Execute(GitUIEventArgs args)
        {
            if (string.IsNullOrEmpty(args.GitModule.WorkingDir))
            {
                return(false);
            }

            using var form = new FormImpact(args.GitModule);
            form.ShowDialog(args.OwnerForm);

            return(false);
        }
Exemple #18
0
        public GourceStart(string pathToGource, GitUIEventArgs gitUIArgs, string gourceArguments)
        {
            InitializeComponent();
            InitializeComplete();
            PathToGource    = pathToGource;
            GitUIArgs       = gitUIArgs;
            GitWorkingDir   = gitUIArgs?.GitModule.WorkingDir;
            GourceArguments = gourceArguments;

            WorkingDir.Text = GitWorkingDir;
            GourcePath.Text = pathToGource;
            Arguments.Text  = GourceArguments;
        }
Exemple #19
0
        private void gitUiCommands_PostRepositoryChanged(object sender, GitUIEventArgs e)
        {
            if (_currentCommitTemplates == null)
            {
                return;
            }

            foreach (var message in _currentCommitTemplates)
            {
                e.GitUICommands.RemoveCommitTemplate(message.Title);
            }

            _currentCommitTemplates = null;
        }
Exemple #20
0
        public override bool Execute(GitUIEventArgs args)
        {
            var workingDir = args.GitModule.WorkingDir;

            string slnFilePath;
            var    foundSlnFile = TryFindSlnFile(workingDir, out slnFilePath);

            if (foundSlnFile)
            {
                System.Diagnostics.Process.Start(slnFilePath);
            }

            return(foundSlnFile);
        }
Exemple #21
0
        public GitFlowForm(GitUIEventArgs gitUiCommands)
        {
            InitializeComponent();
            InitializeComplete();

            _gitUiCommands = gitUiCommands;

            lblPrefixManage.Text = string.Empty;
            ttGitFlow.SetToolTip(lnkGitFlow, _gitFlowTooltip.Text);

            if (_gitUiCommands != null)
            {
                Init();
            }
        }
Exemple #22
0
        /// <summary>
        /// See: https://github.com/gitextensions/gitextensions.plugintemplate/wiki/GitPluginBase#public-abstract-bool-executegituieventargs-args
        /// </summary>
        public override bool Execute(GitUIEventArgs gitUIEventArgs)
        {
            string basePath = AppDomain.CurrentDomain.BaseDirectory;
            string pluginsPath = ManagedExtensibility.UserPluginsPath;

            ProcessStartInfo info = new ProcessStartInfo()
            {
                FileName = Path.Combine(pluginsPath, PackageId, PluginManagerRelativePath),
                Arguments = gitUIEventArgs.GitModule.WorkingDir,
                UseShellExecute = false,
            };
            Process.Start(info);

            return false;
        }
Exemple #23
0
 public override bool Execute(GitUIEventArgs gitUiEventArgs)
 {
     if (IsSvnRepo(gitUiEventArgs.GitUICommands))
     {
         MessageBox.Show(gitUiEventArgs.OwnerForm, "The SVN commands are in the toolbar.", PluginName,
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
         return(true);
     }
     else
     {
         MessageBox.Show(gitUiEventArgs.OwnerForm, "The current repository has no configured SVN remote.", PluginName,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
 }
        public override bool Execute(GitUIEventArgs args)
        {
            // Only build when plugin is enabled
            if (string.IsNullOrEmpty(args.VsrModule.WorkingDir))
            {
                return(false);
            }

            var msbuildPath = _msBuildPath.ValueOrDefault(Settings);

            var workingDir    = new DirectoryInfo(args.VsrModule.WorkingDir);
            var solutionFiles = workingDir.GetFiles("*.sln", SearchOption.AllDirectories);

            for (var n = solutionFiles.Length - 1; n > 0; n--)
            {
                var solutionFile = solutionFiles[n];

                var result =
                    MessageBox.Show(args.OwnerForm,
                                    string.Format(_doYouWantBuild.Text,
                                                  solutionFile.Name,
                                                  SolutionFilesToString(solutionFiles)),
                                    "Build",
                                    MessageBoxButtons.YesNoCancel,
                                    MessageBoxIcon.Question);

                if (result == DialogResult.Cancel)
                {
                    return(false);
                }

                if (result != DialogResult.Yes)
                {
                    continue;
                }

                if (string.IsNullOrEmpty(msbuildPath) || !File.Exists(msbuildPath))
                {
                    MessageBox.Show(args.OwnerForm, _enterCorrectMsBuildPath.Text, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    args.GitUICommands.StartCommandLineProcessDialog(args.OwnerForm, msbuildPath, solutionFile.FullName + " " + _msBuildArguments.ValueOrDefault(Settings));
                }
            }

            return(false);
        }
Exemple #25
0
        public override bool Execute(GitUIEventArgs args)
        {
            if (!_enabledSettings.ValueOrDefault(Settings) || _httpClient == null)
            {
                args.GitUICommands.StartSettingsDialog(this);
                return(false);
            }

            ThreadHelper.JoinableTaskFactory.RunAsync(
                async() =>
            {
                await DisplayQueryResultAsync(_httpClient, _projectUrl, _query, _stringTemplate);
            });

            return(false);
        }
Exemple #26
0
        public override bool Execute(GitUIEventArgs args)
        {
            var settings = new DeleteUnusedBranchesFormSettings(
                _daysOlderThan.ValueOrDefault(Settings),
                _mergedInBranch.ValueOrDefault(Settings),
                _deleteRemoteBranchesFromFlag.ValueOrDefault(Settings),
                _remoteName.ValueOrDefault(Settings),
                _useRegexToFilterBranchesFlag.ValueOrDefault(Settings),
                _regexFilter.ValueOrDefault(Settings),
                _regexCaseInsensitiveFlag.ValueOrDefault(Settings),
                _regexInvertedFlag.ValueOrDefault(Settings),
                _includeUnmergedBranchesFlag.ValueOrDefault(Settings));

            using var frm = new DeleteUnusedBranchesForm(settings, args.GitModule, args.GitUICommands, this);
            frm.ShowDialog(args.OwnerForm);

            return(true);
        }
        public override bool Execute(GitUIEventArgs args)
        {
            Settings settings = Bitbucket.Settings.Parse(args.GitModule, Settings, this);

            if (settings is null)
            {
                MessageBox.Show(args.OwnerForm,
                                _yourRepositoryIsNotInBitbucket.Text,
                                string.Empty,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return(false);
            }

            using var frm = new BitbucketPullRequestForm(settings, args.GitModule);
            frm.ShowDialog(args.OwnerForm);

            return(true);
        }
Exemple #28
0
        private void gitUiCommands_PostRepositoryChanged(object sender, GitUIEventArgs e)
        {
            if (!_enabledSettings.ValueOrDefault(Settings))
            {
                return;
            }

            if (_currentMessages == null)
            {
                return;
            }

            foreach (var message in _currentMessages)
            {
                e.GitUICommands.RemoveCommitTemplate(message.Title);
            }

            _currentMessages = null;
        }
Exemple #29
0
        private void gitUiCommands_PreCommit(object sender, GitUIEventArgs e)
        {
            if (!_enabledSettings.ValueOrDefault(Settings))
            {
                return;
            }

            ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                _currentCommitTemplates = await GetCommitTemplatesAsync(_httpClient, _projectUrlSettings.ValueOrDefault(Settings), _query, _stringTemplate);

                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                foreach (var commitTemplate in _currentCommitTemplates)
                {
                    e.GitUICommands.AddCommitTemplate(commitTemplate.Title, () => commitTemplate.Text, Icon);
                }
            });
        }
        public override bool Execute(GitUIEventArgs args)
        {
            if (string.IsNullOrEmpty(args.GitModule.WorkingDir))
            {
                return(false);
            }

            var countSubmodule = !_ignoreSubmodules.ValueOrDefault(Settings);

            var formStatistics = new FormGitStatistics(args.GitModule, _codeFiles.ValueOrDefault(Settings), countSubmodule)
            {
                DirectoriesToIgnore = _ignoreDirectories.ValueOrDefault(Settings).Replace("/", "\\")
            };

            using (formStatistics)
            {
                formStatistics.ShowDialog(args.OwnerForm);
            }

            return(false);
        }
Exemple #31
0
        /// <summary>
        ///   Execute plugin
        /// </summary>
        private void ItemClick(object sender, EventArgs e)
        {
            var menuItem = sender as ToolStripMenuItem;
            if (menuItem == null)
                return;

            var plugin = menuItem.Tag as IGitPlugin;
            if (plugin == null)
                return;

            var eventArgs = new GitUIEventArgs(this, UICommands);

            bool refresh = plugin.Execute(eventArgs);
            if (refresh)
                RefreshToolStripMenuItemClick(null, null);
        }