forked from gitextensions/gitextensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GitPluginBase.cs
76 lines (63 loc) · 2.1 KB
/
GitPluginBase.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
using System.Collections.Generic;
using GitCommands;
using GitUIPluginInterfaces;
namespace ResourceManager
{
public abstract class GitPluginBase : IGitPlugin, ITranslate
{
private string _description;
public string Description
{
get { return _description; }
protected set { _description = value; }
}
public string Name
{
get;
protected set;
}
protected void SetNameAndDescription(string aName)
{
Name = aName;
Description = aName;
}
//Store settings to use later
public ISettingsSource Settings
{
get
{
return SettingsContainer.GetSettingsSource();
}
}
public IGitPluginSettingsContainer SettingsContainer { get; set; }
public virtual IEnumerable<ISetting> GetSettings()
{
return new List<ISetting>();
}
public virtual void Register(IGitUICommands gitUiCommands)
{
SettingsContainer.SetSettingsSource(gitUiCommands.GitModule.GetEffectiveSettings());
}
public virtual void Unregister(IGitUICommands gitUiCommands)
{
SettingsContainer.SetSettingsSource(null);
}
public abstract bool Execute(GitUIBaseEventArgs gitUiCommands);
protected void Translate()
{
Translator.Translate(this, AppSettings.CurrentTranslation);
}
public virtual void AddTranslationItems(ITranslation translation)
{
string name = GetType().Name;
TranslationUtils.AddTranslationItem(name, this, "Description", translation);
TranslationUtils.AddTranslationItemsFromFields(name, this, translation);
}
public virtual void TranslateItems(ITranslation translation)
{
string name = GetType().Name;
TranslationUtils.TranslateProperty(name, this, "Description", translation);
TranslationUtils.TranslateItemsFromFields(name, this, translation);
}
}
}