-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathPlugin.cs
82 lines (73 loc) · 3.8 KB
/
Plugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System.Collections.Generic;
using GitExtensions.PluginTemplate.Properties;
using GitUIPluginInterfaces;
using ResourceManager;
using System.ComponentModel.Composition;
using System.Windows.Forms;
namespace GitExtensions.PluginTemplate
{
/// <summary>
/// A template for Git Extensions plugins.
/// Find more documentation here: https://github.com/gitextensions/gitextensions.plugintemplate/wiki/GitPluginBase
/// </summary>
[Export(typeof(IGitPlugin))]
public class Plugin : GitPluginBase
{
public Plugin()
{
// Set the name of the plugin, as it appears in Git Extensions' Plugins menu.
SetNameAndDescription("Name of your plugin...");
// Set the icon of the plugin, as it appears in Git Extensions' Plugins menu
Icon = Resources.Icon;
// Translate the plugin strings. Do not remove. Should be called in the constructor of the plugin.
Translate();
}
/// <summary>
/// Is called when the plugin is loaded. This happens every time when a repository is opened.
/// </summary>
public override void Register(IGitUICommands gitUiCommands)
{
// Put your initialization logic here
}
/// <summary>
/// Is called when the plugin is unloaded. This happens every time when a repository is closed through one of the following events:
/// 1. opening another repository
/// 2. returning to Dashboard (Repository > Close (go to Dashboard))
/// 3. closing Git Extensions
/// </summary>
public override void Unregister(IGitUICommands gitUiCommands)
{
// Put your cleaning logic here
}
///// <summary>
///// This is where you define the plugin setting page displayed in Git Extensions settings and that allows the user to configure the plugin settings.
///// You should return a collection of ISetting instances that could be of types:
///// * `BoolSetting` to store a boolean (display a Checkbox control),
///// * `StringSetting` to store a string (display a TextBox control),
///// * `NumberSetting` to store a number (display a TextBox control),
///// * `ChoiceSetting` to propose choices and store a string (display a ComboBox control),
///// * `PasswordSetting` to store a password (display a password TextBox control),
///// * `CredentialsSetting` to store a login and a password (display a login and a password fields),
///// See an example: https://github.com/gitextensions/gitextensions/blob/master/Plugins/JiraCommitHintPlugin/JiraCommitHintPlugin.cs
///// </summary>
//public override IEnumerable<ISetting> GetSettings()
//{
// // Uncomment and fill if your plugin have settings that the user could configure
//}
/// <summary>
/// Is called when the plugin's name is clicked in Git Extensions' Plugins menu.
/// Must return `true` if the revision grid should be refreshed after the execution of the plugin. false, otherwise.
/// Help: You could call args.GitUICommands.StartSettingsDialog(this); in this method to open the setting page of the plugin.
/// </summary>
/// <returns>
/// Returns <see langword="true"/> if the revision grid should be refreshed after the execution of the plugin;
/// otherwise <see langword="false"/>.
/// </returns>
public override bool Execute(GitUIEventArgs gitUIEventArgs)
{
// Put your action logic here
MessageBox.Show(gitUIEventArgs.OwnerForm, "Hello from the Plugin Template.", "Git Extensions");
return false;
}
}
}