Skip to content

Commit 6b98421

Browse files
committed
Use logger from parent command class.
1 parent 2865aac commit 6b98421

File tree

69 files changed

+290
-227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+290
-227
lines changed

RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Windows.Input;
66
using Microsoft.Vbe.Interop;
7+
using NLog;
78
using Rubberduck.Navigation.Folders;
89
using Rubberduck.Parsing.Annotations;
910
using Rubberduck.Parsing.Symbols;
@@ -30,7 +31,7 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
3031
_state.StateChanged += ParserState_StateChanged;
3132
_state.ModuleStateChanged += ParserState_ModuleStateChanged;
3233

33-
_refreshCommand = new DelegateCommand(param => _state.OnParseRequested(this),
34+
_refreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param => _state.OnParseRequested(this),
3435
param => !IsBusy && _state.IsDirty());
3536

3637
_refreshComponentCommand = commands.OfType<CodeExplorer_RefreshComponentCommand>().FirstOrDefault();
@@ -54,7 +55,7 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
5455
_externalRemoveCommand = commands.OfType<CodeExplorer_RemoveCommand>().FirstOrDefault();
5556
if (_externalRemoveCommand != null)
5657
{
57-
_removeCommand = new DelegateCommand(ExecuteRemoveComand, _externalRemoveCommand.CanExecute);
58+
_removeCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRemoveComand, _externalRemoveCommand.CanExecute);
5859
}
5960

6061
_printCommand = commands.OfType<CodeExplorer_PrintCommand>().FirstOrDefault();
@@ -64,13 +65,13 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
6465

6566
_copyResultsCommand = commands.OfType<CodeExplorer_CopyResultsCommand>().FirstOrDefault();
6667

67-
_setNameSortCommand = new DelegateCommand(param =>
68+
_setNameSortCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
6869
{
6970
SortByName = (bool)param;
7071
SortBySelection = !(bool)param;
7172
});
7273

73-
_setSelectionSortCommand = new DelegateCommand(param =>
74+
_setSelectionSortCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
7475
{
7576
SortBySelection = (bool)param;
7677
SortByName = !(bool)param;

RetailCoder.VBE/UI/About/AboutControlViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Diagnostics;
33
using System.Reflection;
4-
using System.Windows.Input;
4+
using NLog;
55
using Rubberduck.UI.Command;
66

77
namespace Rubberduck.UI.About
@@ -26,7 +26,7 @@ public CommandBase UriCommand
2626
{
2727
return _uriCommand;
2828
}
29-
return _uriCommand = new DelegateCommand(uri =>
29+
return _uriCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), uri =>
3030
{
3131
Process.Start(new ProcessStartInfo(((Uri)uri).AbsoluteUri));
3232
});

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_AddClassModuleCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.Vbe.Interop;
2+
using NLog;
23
using Rubberduck.Navigation.CodeExplorer;
34
using Rubberduck.Parsing.Symbols;
45
using Rubberduck.UI.Command;
@@ -9,17 +10,17 @@ public class CodeExplorer_AddClassModuleCommand : CommandBase
910
{
1011
private readonly VBE _vbe;
1112

12-
public CodeExplorer_AddClassModuleCommand(VBE vbe)
13+
public CodeExplorer_AddClassModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1314
{
1415
_vbe = vbe;
1516
}
1617

17-
public override bool CanExecuteImpl(object parameter)
18+
protected override bool CanExecuteImpl(object parameter)
1819
{
1920
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
2021
}
2122

22-
public override void ExecuteImpl(object parameter)
23+
protected override void ExecuteImpl(object parameter)
2324
{
2425
if (parameter != null)
2526
{

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_AddStdModuleCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.Vbe.Interop;
2+
using NLog;
23
using Rubberduck.Navigation.CodeExplorer;
34
using Rubberduck.Parsing.Symbols;
45
using Rubberduck.UI.Command;
@@ -9,17 +10,17 @@ public class CodeExplorer_AddStdModuleCommand : CommandBase
910
{
1011
private readonly VBE _vbe;
1112

12-
public CodeExplorer_AddStdModuleCommand(VBE vbe)
13+
public CodeExplorer_AddStdModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1314
{
1415
_vbe = vbe;
1516
}
1617

17-
public override bool CanExecuteImpl(object parameter)
18+
protected override bool CanExecuteImpl(object parameter)
1819
{
1920
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
2021
}
2122

22-
public override void ExecuteImpl(object parameter)
23+
protected override void ExecuteImpl(object parameter)
2324
{
2425
if (parameter != null)
2526
{

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_AddTestModuleCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.Vbe.Interop;
2+
using NLog;
23
using Rubberduck.Navigation.CodeExplorer;
34
using Rubberduck.Parsing.Symbols;
45
using Rubberduck.UI.Command;
@@ -11,18 +12,18 @@ public class CodeExplorer_AddTestModuleCommand : CommandBase
1112
private readonly VBE _vbe;
1213
private readonly NewUnitTestModuleCommand _newUnitTestModuleCommand;
1314

14-
public CodeExplorer_AddTestModuleCommand(VBE vbe, NewUnitTestModuleCommand newUnitTestModuleCommand)
15+
public CodeExplorer_AddTestModuleCommand(VBE vbe, NewUnitTestModuleCommand newUnitTestModuleCommand) : base(LogManager.GetCurrentClassLogger())
1516
{
1617
_vbe = vbe;
1718
_newUnitTestModuleCommand = newUnitTestModuleCommand;
1819
}
1920

20-
public override bool CanExecuteImpl(object parameter)
21+
protected override bool CanExecuteImpl(object parameter)
2122
{
2223
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
2324
}
2425

25-
public override void ExecuteImpl(object parameter)
26+
protected override void ExecuteImpl(object parameter)
2627
{
2728
if (parameter != null)
2829
{

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_AddUserFormCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.Vbe.Interop;
2+
using NLog;
23
using Rubberduck.Navigation.CodeExplorer;
34
using Rubberduck.Parsing.Symbols;
45
using Rubberduck.UI.Command;
@@ -9,17 +10,17 @@ public class CodeExplorer_AddUserFormCommand : CommandBase
910
{
1011
private readonly VBE _vbe;
1112

12-
public CodeExplorer_AddUserFormCommand(VBE vbe)
13+
public CodeExplorer_AddUserFormCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1314
{
1415
_vbe = vbe;
1516
}
1617

17-
public override bool CanExecuteImpl(object parameter)
18+
protected override bool CanExecuteImpl(object parameter)
1819
{
1920
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
2021
}
2122

22-
public override void ExecuteImpl(object parameter)
23+
protected override void ExecuteImpl(object parameter)
2324
{
2425
if (parameter != null)
2526
{

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_CommitCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using NLog;
12
using Rubberduck.Navigation.CodeExplorer;
23
using Rubberduck.UI.Command;
34
using Rubberduck.UI.SourceControl;
@@ -8,17 +9,17 @@ public class CodeExplorer_CommitCommand : CommandBase
89
{
910
private readonly SourceControlDockablePresenter _presenter;
1011

11-
public CodeExplorer_CommitCommand(SourceControlDockablePresenter presenter)
12+
public CodeExplorer_CommitCommand(SourceControlDockablePresenter presenter) : base(LogManager.GetCurrentClassLogger())
1213
{
1314
_presenter = presenter;
1415
}
1516

16-
public override bool CanExecuteImpl(object parameter)
17+
protected override bool CanExecuteImpl(object parameter)
1718
{
1819
return parameter is CodeExplorerComponentViewModel;
1920
}
2021

21-
public override void ExecuteImpl(object parameter)
22+
protected override void ExecuteImpl(object parameter)
2223
{
2324
_presenter.Show();
2425

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_CopyResultsCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Globalization;
33
using System.Linq;
44
using System.Windows;
5+
using NLog;
56
using Rubberduck.Common;
67
using Rubberduck.Parsing.VBA;
78
using Rubberduck.UI.Command;
@@ -13,13 +14,13 @@ public class CodeExplorer_CopyResultsCommand : CommandBase
1314
private readonly RubberduckParserState _state;
1415
private readonly IClipboardWriter _clipboard;
1516

16-
public CodeExplorer_CopyResultsCommand(RubberduckParserState state)
17+
public CodeExplorer_CopyResultsCommand(RubberduckParserState state) : base(LogManager.GetCurrentClassLogger())
1718
{
1819
_state = state;
1920
_clipboard = new ClipboardWriter();
2021
}
2122

22-
public override void ExecuteImpl(object parameter)
23+
protected override void ExecuteImpl(object parameter)
2324
{
2425
const string XML_SPREADSHEET_DATA_FORMAT = "XML Spreadsheet";
2526

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_ExportCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Windows.Forms;
55
using Microsoft.Vbe.Interop;
6+
using NLog;
67
using Rubberduck.Navigation.CodeExplorer;
78
using Rubberduck.UI.Command;
89

@@ -19,13 +20,13 @@ public class CodeExplorer_ExportCommand : CommandBase, IDisposable
1920
{ vbext_ComponentType.vbext_ct_MSForm, ".frm" }
2021
};
2122

22-
public CodeExplorer_ExportCommand(ISaveFileDialog saveFileDialog)
23+
public CodeExplorer_ExportCommand(ISaveFileDialog saveFileDialog) : base(LogManager.GetCurrentClassLogger())
2324
{
2425
_saveFileDialog = saveFileDialog;
2526
_saveFileDialog.OverwritePrompt = true;
2627
}
2728

28-
public override bool CanExecuteImpl(object parameter)
29+
protected override bool CanExecuteImpl(object parameter)
2930
{
3031
if (!(parameter is CodeExplorerComponentViewModel))
3132
{
@@ -37,7 +38,7 @@ public override bool CanExecuteImpl(object parameter)
3738
return _exportableFileExtensions.Select(s => s.Key).Contains(componentType);
3839
}
3940

40-
public override void ExecuteImpl(object parameter)
41+
protected override void ExecuteImpl(object parameter)
4142
{
4243
var node = (CodeExplorerComponentViewModel)parameter;
4344
var component = node.Declaration.QualifiedName.QualifiedModuleName.Component;

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_FindAllImplementationsCommand.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using NLog;
12
using Rubberduck.Navigation.CodeExplorer;
23
using Rubberduck.Parsing.VBA;
34
using Rubberduck.UI.Command;
@@ -9,20 +10,20 @@ public class CodeExplorer_FindAllImplementationsCommand : CommandBase
910
private readonly RubberduckParserState _state;
1011
private readonly FindAllImplementationsCommand _findAllImplementations;
1112

12-
public CodeExplorer_FindAllImplementationsCommand(RubberduckParserState state, FindAllImplementationsCommand findAllImplementations)
13+
public CodeExplorer_FindAllImplementationsCommand(RubberduckParserState state, FindAllImplementationsCommand findAllImplementations) : base(LogManager.GetCurrentClassLogger())
1314
{
1415
_state = state;
1516
_findAllImplementations = findAllImplementations;
1617
}
1718

18-
public override bool CanExecuteImpl(object parameter)
19+
protected override bool CanExecuteImpl(object parameter)
1920
{
2021
return _state.Status == ParserState.Ready &&
2122
(parameter is CodeExplorerComponentViewModel ||
2223
parameter is CodeExplorerMemberViewModel);
2324
}
2425

25-
public override void ExecuteImpl(object parameter)
26+
protected override void ExecuteImpl(object parameter)
2627
{
2728
_findAllImplementations.Execute(((CodeExplorerItemViewModel) parameter).GetSelectedDeclaration());
2829
}

0 commit comments

Comments
 (0)