Skip to content

Commit 2bb9a64

Browse files
authored
Merge branch 'next' into Issue2009
2 parents ba95122 + 704fd01 commit 2bb9a64

24 files changed

+148
-115
lines changed

RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,35 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
3333
_refreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param => _state.OnParseRequested(this),
3434
param => !IsBusy && _state.IsDirty());
3535

36-
_navigateCommand = commands.OfType<CodeExplorerNavigateCommand>().FirstOrDefault();
36+
_navigateCommand = commands.OfType<UI.CodeExplorer.Commands.NavigateCommand>().FirstOrDefault();
3737

38-
_addTestModuleCommand = commands.OfType<CodeExplorerAddTestModuleCommand>().FirstOrDefault();
39-
_addStdModuleCommand = commands.OfType<CodeExplorerAddStdModuleCommand>().FirstOrDefault();
40-
_addClassModuleCommand = commands.OfType<CodeExplorerAddClassModuleCommand>().FirstOrDefault();
41-
_addUserFormCommand = commands.OfType<CodeExplorerAddUserFormCommand>().FirstOrDefault();
38+
_addTestModuleCommand = commands.OfType<UI.CodeExplorer.Commands.AddTestModuleCommand>().FirstOrDefault();
39+
_addStdModuleCommand = commands.OfType<AddStdModuleCommand>().FirstOrDefault();
40+
_addClassModuleCommand = commands.OfType<AddClassModuleCommand>().FirstOrDefault();
41+
_addUserFormCommand = commands.OfType<AddUserFormCommand>().FirstOrDefault();
4242

43-
_openDesignerCommand = commands.OfType<CodeExplorerOpenDesignerCommand>().FirstOrDefault();
44-
_openProjectPropertiesCommand = commands.OfType<CodeExplorerOpenProjectPropertiesCommand>().FirstOrDefault();
45-
_renameCommand = commands.OfType<CodeExplorerRenameCommand>().FirstOrDefault();
46-
_indenterCommand = commands.OfType<CodeExplorerIndentCommand>().FirstOrDefault();
43+
_openDesignerCommand = commands.OfType<OpenDesignerCommand>().FirstOrDefault();
44+
_openProjectPropertiesCommand = commands.OfType<OpenProjectPropertiesCommand>().FirstOrDefault();
45+
_renameCommand = commands.OfType<RenameCommand>().FirstOrDefault();
46+
_indenterCommand = commands.OfType<IndentCommand>().FirstOrDefault();
4747

48-
_findAllReferencesCommand = commands.OfType<CodeExplorerFindAllReferencesCommand>().FirstOrDefault();
49-
_findAllImplementationsCommand = commands.OfType<CodeExplorerFindAllImplementationsCommand>().FirstOrDefault();
48+
_findAllReferencesCommand = commands.OfType<UI.CodeExplorer.Commands.FindAllReferencesCommand>().FirstOrDefault();
49+
_findAllImplementationsCommand = commands.OfType<UI.CodeExplorer.Commands.FindAllImplementationsCommand>().FirstOrDefault();
5050

51-
_importCommand = commands.OfType<CodeExplorerImportCommand>().FirstOrDefault();
52-
_exportCommand = commands.OfType<CodeExplorerExportCommand>().FirstOrDefault();
53-
_externalRemoveCommand = commands.OfType<CodeExplorerRemoveCommand>().FirstOrDefault();
51+
_importCommand = commands.OfType<ImportCommand>().FirstOrDefault();
52+
_exportCommand = commands.OfType<ExportCommand>().FirstOrDefault();
53+
_externalRemoveCommand = commands.OfType<RemoveCommand>().FirstOrDefault();
5454
if (_externalRemoveCommand != null)
5555
{
5656
_removeCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRemoveComand, _externalRemoveCommand.CanExecute);
5757
}
5858

59-
_printCommand = commands.OfType<CodeExplorerPrintCommand>().FirstOrDefault();
59+
_printCommand = commands.OfType<PrintCommand>().FirstOrDefault();
6060

61-
_commitCommand = commands.OfType<CodeExplorerCommitCommand>().FirstOrDefault();
62-
_undoCommand = commands.OfType<CodeExplorerUndoCommand>().FirstOrDefault();
61+
_commitCommand = commands.OfType<CommitCommand>().FirstOrDefault();
62+
_undoCommand = commands.OfType<UndoCommand>().FirstOrDefault();
6363

64-
_copyResultsCommand = commands.OfType<CodeExplorerCopyResultsCommand>().FirstOrDefault();
64+
_copyResultsCommand = commands.OfType<CopyResultsCommand>().FirstOrDefault();
6565

6666
_setNameSortCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
6767
{

RetailCoder.VBE/Root/RubberduckModule.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
using System.Globalization;
3434
using Ninject.Extensions.Interception.Infrastructure.Language;
3535
using Rubberduck.Parsing.Symbols;
36+
using Rubberduck.UI.CodeExplorer.Commands;
3637

3738
namespace Rubberduck.Root
3839
{
@@ -339,9 +340,7 @@ private void BindCommandsToCodeExplorer()
339340
{
340341
var commands = Assembly.GetExecutingAssembly().GetTypes()
341342
.Where(type => type.IsClass && type.Namespace != null &&
342-
type.Namespace == "Rubberduck.UI.CodeExplorer.Commands" &&
343-
type.Name.StartsWith("CodeExplorer_") &&
344-
type.Name.EndsWith("Command"));
343+
type.CustomAttributes.Any(a => a.AttributeType == typeof(CodeExplorerCommandAttribute)));
345344

346345
foreach (var command in commands)
347346
{

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -415,29 +415,30 @@
415415
<Compile Include="UI\About\AboutDialog.Designer.cs">
416416
<DependentUpon>AboutDialog.cs</DependentUpon>
417417
</Compile>
418-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerCommitCommand.cs" />
419-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerAddUserFormCommand.cs" />
420-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerCopyResultsCommand.cs" />
421-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerOpenProjectPropertiesCommand.cs" />
422-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerRenameCommand.cs" />
423-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerFindAllReferencesCommand.cs" />
424-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerFindAllImplementationsCommand.cs" />
425-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerIndentCommand.cs" />
426-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerNavigateCommand.cs" />
427-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerRemoveCommand.cs" />
428-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerExportCommand.cs" />
429-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerImportCommand.cs" />
430-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerPrintCommand.cs" />
431-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerOpenDesignerCommand.cs" />
432-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerAddClassModuleCommand.cs" />
433-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerAddStdModuleCommand.cs" />
434-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerAddTestModuleCommand.cs" />
418+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerCommandAttribute.cs" />
419+
<Compile Include="UI\CodeExplorer\Commands\CommitCommand.cs" />
420+
<Compile Include="UI\CodeExplorer\Commands\AddUserFormCommand.cs" />
421+
<Compile Include="UI\CodeExplorer\Commands\CopyResultsCommand.cs" />
422+
<Compile Include="UI\CodeExplorer\Commands\OpenProjectPropertiesCommand.cs" />
423+
<Compile Include="UI\CodeExplorer\Commands\RenameCommand.cs" />
424+
<Compile Include="UI\CodeExplorer\Commands\FindAllReferencesCommand.cs" />
425+
<Compile Include="UI\CodeExplorer\Commands\FindAllImplementationsCommand.cs" />
426+
<Compile Include="UI\CodeExplorer\Commands\IndentCommand.cs" />
427+
<Compile Include="UI\CodeExplorer\Commands\NavigateCommand.cs" />
428+
<Compile Include="UI\CodeExplorer\Commands\RemoveCommand.cs" />
429+
<Compile Include="UI\CodeExplorer\Commands\ExportCommand.cs" />
430+
<Compile Include="UI\CodeExplorer\Commands\ImportCommand.cs" />
431+
<Compile Include="UI\CodeExplorer\Commands\PrintCommand.cs" />
432+
<Compile Include="UI\CodeExplorer\Commands\OpenDesignerCommand.cs" />
433+
<Compile Include="UI\CodeExplorer\Commands\AddClassModuleCommand.cs" />
434+
<Compile Include="UI\CodeExplorer\Commands\AddStdModuleCommand.cs" />
435+
<Compile Include="UI\CodeExplorer\Commands\AddTestModuleCommand.cs" />
435436
<Compile Include="UI\Controls\LinkButton.xaml.cs">
436437
<DependentUpon>LinkButton.xaml</DependentUpon>
437438
</Compile>
438439
<Compile Include="UI\Converters\InvertBoolValueConverter.cs" />
439440
<Compile Include="UI\Converters\BoolToHiddenVisibilityConverter.cs" />
440-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerUndoCommand.cs" />
441+
<Compile Include="UI\CodeExplorer\Commands\UndoCommand.cs" />
441442
<Compile Include="UI\Command\MenuItems\NoIndentAnnotationCommandMenuItem.cs" />
442443
<Compile Include="UI\Command\MenuItems\IndentCurrentModuleCommandMenuItem.cs" />
443444
<Compile Include="UI\Command\NoIndentAnnotationCommand.cs" />

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorerAddClassModuleCommand.cs renamed to RetailCoder.VBE/UI/CodeExplorer/Commands/AddClassModuleCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Runtime.InteropServices;
32
using Microsoft.Vbe.Interop;
43
using NLog;
@@ -8,11 +7,12 @@
87

98
namespace Rubberduck.UI.CodeExplorer.Commands
109
{
11-
public class CodeExplorerAddClassModuleCommand : CommandBase
10+
[CodeExplorerCommand]
11+
public class AddClassModuleCommand : CommandBase
1212
{
1313
private readonly VBE _vbe;
1414

15-
public CodeExplorerAddClassModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
15+
public AddClassModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1616
{
1717
_vbe = vbe;
1818
}

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorerAddStdModuleCommand.cs renamed to RetailCoder.VBE/UI/CodeExplorer/Commands/AddStdModuleCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Runtime.InteropServices;
32
using Microsoft.Vbe.Interop;
43
using NLog;
@@ -8,11 +7,12 @@
87

98
namespace Rubberduck.UI.CodeExplorer.Commands
109
{
11-
public class CodeExplorerAddStdModuleCommand : CommandBase
10+
[CodeExplorerCommand]
11+
public class AddStdModuleCommand : CommandBase
1212
{
1313
private readonly VBE _vbe;
1414

15-
public CodeExplorerAddStdModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
15+
public AddStdModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1616
{
1717
_vbe = vbe;
1818
}

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorerAddTestModuleCommand.cs renamed to RetailCoder.VBE/UI/CodeExplorer/Commands/AddTestModuleCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Runtime.InteropServices;
32
using Microsoft.Vbe.Interop;
43
using NLog;
@@ -9,12 +8,13 @@
98

109
namespace Rubberduck.UI.CodeExplorer.Commands
1110
{
12-
public class CodeExplorerAddTestModuleCommand : CommandBase
11+
[CodeExplorerCommand]
12+
public class AddTestModuleCommand : CommandBase
1313
{
1414
private readonly VBE _vbe;
1515
private readonly NewUnitTestModuleCommand _newUnitTestModuleCommand;
1616

17-
public CodeExplorerAddTestModuleCommand(VBE vbe, NewUnitTestModuleCommand newUnitTestModuleCommand) : base(LogManager.GetCurrentClassLogger())
17+
public AddTestModuleCommand(VBE vbe, NewUnitTestModuleCommand newUnitTestModuleCommand) : base(LogManager.GetCurrentClassLogger())
1818
{
1919
_vbe = vbe;
2020
_newUnitTestModuleCommand = newUnitTestModuleCommand;

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorerAddUserFormCommand.cs renamed to RetailCoder.VBE/UI/CodeExplorer/Commands/AddUserFormCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Runtime.InteropServices;
32
using Microsoft.Vbe.Interop;
43
using NLog;
@@ -8,11 +7,12 @@
87

98
namespace Rubberduck.UI.CodeExplorer.Commands
109
{
11-
public class CodeExplorerAddUserFormCommand : CommandBase
10+
[CodeExplorerCommand]
11+
public class AddUserFormCommand : CommandBase
1212
{
1313
private readonly VBE _vbe;
1414

15-
public CodeExplorerAddUserFormCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
15+
public AddUserFormCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1616
{
1717
_vbe = vbe;
1818
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
using System;
2+
3+
namespace Rubberduck.UI.CodeExplorer.Commands
4+
{
5+
public class CodeExplorerCommandAttribute : Attribute { }
6+
}

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorerCommitCommand.cs renamed to RetailCoder.VBE/UI/CodeExplorer/Commands/CommitCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
namespace Rubberduck.UI.CodeExplorer.Commands
77
{
8-
public class CodeExplorerCommitCommand : CommandBase
8+
[CodeExplorerCommand]
9+
public class CommitCommand : CommandBase
910
{
1011
private readonly SourceControlDockablePresenter _presenter;
1112

12-
public CodeExplorerCommitCommand(SourceControlDockablePresenter presenter) : base(LogManager.GetCurrentClassLogger())
13+
public CommitCommand(SourceControlDockablePresenter presenter) : base(LogManager.GetCurrentClassLogger())
1314
{
1415
_presenter = presenter;
1516
}

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorerCopyResultsCommand.cs renamed to RetailCoder.VBE/UI/CodeExplorer/Commands/CopyResultsCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99

1010
namespace Rubberduck.UI.CodeExplorer.Commands
1111
{
12-
public class CodeExplorerCopyResultsCommand : CommandBase
12+
[CodeExplorerCommand]
13+
public class CopyResultsCommand : CommandBase
1314
{
1415
private readonly RubberduckParserState _state;
1516
private readonly IClipboardWriter _clipboard;
1617

17-
public CodeExplorerCopyResultsCommand(RubberduckParserState state) : base(LogManager.GetCurrentClassLogger())
18+
public CopyResultsCommand(RubberduckParserState state) : base(LogManager.GetCurrentClassLogger())
1819
{
1920
_state = state;
2021
_clipboard = new ClipboardWriter();

0 commit comments

Comments
 (0)