Skip to content

Commit

Permalink
fixup! Minor code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
SlugFiller committed Dec 9, 2023
1 parent 9330bb4 commit 9f77227
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions GitUI/GitModuleForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace GitUI
public class GitModuleForm : GitExtensionsForm, IGitUICommandsSource, IGitModuleForm
{
private IHotkeySettingsLoader? _hotkeySettingsLoader;
private IScriptsManager? _scriptsManager;
private IScriptsRunner? _scriptsRunner;
private GitUICommands? _uiCommands;

Expand All @@ -32,12 +31,6 @@ public IHotkeySettingsLoader HotkeySettingsReader
private set => _hotkeySettingsLoader = value;
}

public IScriptsManager ScriptsManager
{
get => _scriptsManager ?? throw new InvalidOperationException($"{GetType().FullName} was constructed incorrectly.");
private set => _scriptsManager = value;
}

public IScriptsRunner ScriptsRunner
{
get => _scriptsRunner ?? throw new InvalidOperationException($"{GetType().FullName} was constructed incorrectly.");
Expand Down Expand Up @@ -65,7 +58,6 @@ protected set
_uiCommands = value;

_hotkeySettingsLoader = _uiCommands.GetRequiredService<IHotkeySettingsLoader>();
_scriptsManager = _uiCommands.GetRequiredService<IScriptsManager>();
_scriptsRunner = _uiCommands.GetRequiredService<IScriptsRunner>();

OnUICommandsChanged(new GitUICommandsChangedEventArgs(oldCommands));
Expand Down Expand Up @@ -125,8 +117,7 @@ bool ExecuteScriptCommand()
return false;
}

IScriptsRunner scriptsRunner = UICommands.GetRequiredService<IScriptsRunner>();
_ = scriptsRunner.RunScript(scriptInfo, owner: this, UICommands, GetScriptOptionsProvider());
_ = ScriptsRunner.RunScript(scriptInfo, owner: this, UICommands, GetScriptOptionsProvider());
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion GitUI/LeftPanel/RepoObjectsTree.ContextActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ private void contextMenu_Opening(object sender, CancelEventArgs e)

if (hasSingleSelection && selectedLocalBranch?.Visible == true)
{
contextMenu.AddUserScripts(runScriptToolStripMenuItem, ExecuteCommand, (script) => script.AddToRevisionGridContextMenu, UICommands);
contextMenu.AddUserScripts(runScriptToolStripMenuItem, ExecuteCommand, script => script.AddToRevisionGridContextMenu, UICommands);
}
else
{
Expand Down

0 comments on commit 9f77227

Please sign in to comment.