Skip to content

Commit dbc87a0

Browse files
committed
Merge branch 'next' of git://github.com/rubberduck-vba/Rubberduck into pull4238b
2 parents 6be6993 + b81f817 commit dbc87a0

File tree

177 files changed

+3472
-2837
lines changed

Some content is hidden

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

177 files changed

+3472
-2837
lines changed

Rubberduck.CodeAnalysis/Inspections/Abstract/InspectionResultBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
using Rubberduck.Parsing.Inspections.Abstract;
66
using Rubberduck.Resources.Inspections;
77
using Rubberduck.Parsing.Symbols;
8-
using Rubberduck.UI;
9-
using Rubberduck.UI.Controls;
108
using Rubberduck.VBEditor;
9+
using Rubberduck.Interaction.Navigation;
1110

1211
namespace Rubberduck.Inspections.Abstract
1312
{

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 36 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using Rubberduck.VBEditor.SafeComWrappers;
2020
using System.Windows;
2121
using Rubberduck.Parsing.UIContext;
22+
using Rubberduck.UI.UnitTesting.Commands;
2223
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
2324

2425
// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
@@ -39,9 +40,9 @@ public sealed class CodeExplorerViewModel : ViewModelBase, IDisposable
3940
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
4041

4142
public CodeExplorerViewModel(
42-
FolderHelper folderHelper,
43-
RubberduckParserState state,
44-
List<CommandBase> commands,
43+
FolderHelper folderHelper,
44+
RubberduckParserState state,
45+
RemoveCommand removeCommand,
4546
IConfigProvider<GeneralSettings> generalSettingsProvider,
4647
IConfigProvider<WindowSettings> windowSettingsProvider,
4748
IUiDispatcher uiDispatcher,
@@ -64,53 +65,15 @@ public CodeExplorerViewModel(
6465
{
6566
_windowSettings = windowSettingsProvider.Create();
6667
}
67-
68-
var reparseCommand = commands.OfType<ReparseCommand>().SingleOrDefault();
69-
70-
RefreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(),
71-
reparseCommand == null ? (Action<object>)(o => { }) :
72-
o => reparseCommand.Execute(o),
73-
o => !IsBusy && reparseCommand != null && reparseCommand.CanExecute(o));
74-
75-
OpenCommand = commands.OfType<OpenCommand>().SingleOrDefault();
76-
OpenDesignerCommand = commands.OfType<OpenDesignerCommand>().SingleOrDefault();
77-
78-
AddVBFormCommand = commands.OfType<AddVBFormCommand>().SingleOrDefault();
79-
AddMDIFormCommand = commands.OfType<AddMDIFormCommand>().SingleOrDefault();
80-
AddUserFormCommand = commands.OfType<AddUserFormCommand>().SingleOrDefault();
81-
AddStdModuleCommand = commands.OfType<AddStdModuleCommand>().SingleOrDefault();
82-
AddClassModuleCommand = commands.OfType<AddClassModuleCommand>().SingleOrDefault();
83-
AddUserControlCommand = commands.OfType<AddUserControlCommand>().SingleOrDefault();
84-
AddPropertyPageCommand = commands.OfType<AddPropertyPageCommand>().SingleOrDefault();
85-
AddUserDocumentCommand = commands.OfType<AddUserDocumentCommand>().SingleOrDefault();
86-
AddTestModuleCommand = commands.OfType<UI.CodeExplorer.Commands.AddTestModuleCommand>().SingleOrDefault();
87-
AddTestModuleWithStubsCommand = commands.OfType<AddTestModuleWithStubsCommand>().SingleOrDefault();
88-
89-
SetAsStartupProjectCommand = commands.OfType<SetAsStartupProjectCommand>().SingleOrDefault();
90-
OpenProjectPropertiesCommand = commands.OfType<OpenProjectPropertiesCommand>().SingleOrDefault();
91-
RenameCommand = commands.OfType<RenameCommand>().SingleOrDefault();
92-
IndenterCommand = commands.OfType<IndentCommand>().SingleOrDefault();
93-
94-
FindAllReferencesCommand = commands.OfType<UI.CodeExplorer.Commands.FindAllReferencesCommand>().SingleOrDefault();
95-
FindAllImplementationsCommand = commands.OfType<UI.CodeExplorer.Commands.FindAllImplementationsCommand>().SingleOrDefault();
96-
9768
CollapseAllSubnodesCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCollapseNodes);
9869
ExpandAllSubnodesCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteExpandNodes);
9970

100-
ImportCommand = commands.OfType<ImportCommand>().SingleOrDefault();
101-
ExportCommand = commands.OfType<ExportCommand>().SingleOrDefault();
102-
ExportAllCommand = commands.OfType<ExportAllCommand>().SingleOrDefault();
103-
104-
_externalRemoveCommand = commands.OfType<RemoveCommand>().SingleOrDefault();
71+
_externalRemoveCommand = removeCommand;
10572
if (_externalRemoveCommand != null)
10673
{
10774
RemoveCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRemoveComand, _externalRemoveCommand.CanExecute);
10875
}
10976

110-
PrintCommand = commands.OfType<PrintCommand>().SingleOrDefault();
111-
112-
CopyResultsCommand = commands.OfType<CopyResultsCommand>().SingleOrDefault();
113-
11477
SetNameSortCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
11578
{
11679
if ((bool)param)
@@ -189,7 +152,7 @@ public bool SortByCodeOrder
189152
}
190153
}
191154

192-
public CommandBase CopyResultsCommand { get; }
155+
public CopyResultsCommand CopyResultsCommand { get; }
193156

194157
public CommandBase SetNameSortCommand { get; }
195158

@@ -287,9 +250,9 @@ public string Description
287250
}
288251
}
289252

290-
public bool CanExecuteIndenterCommand => IndenterCommand.CanExecute(SelectedItem);
291-
public bool CanExecuteRenameCommand => RenameCommand.CanExecute(SelectedItem);
292-
public bool CanExecuteFindAllReferencesCommand => FindAllReferencesCommand.CanExecute(SelectedItem);
253+
public bool CanExecuteIndenterCommand => IndenterCommand?.CanExecute(SelectedItem) ?? false;
254+
public bool CanExecuteRenameCommand => RenameCommand?.CanExecute(SelectedItem) ?? false;
255+
public bool CanExecuteFindAllReferencesCommand => FindAllReferencesCommand?.CanExecute(SelectedItem) ?? false;
293256

294257
private ObservableCollection<CodeExplorerItemViewModel> _projects;
295258
public ObservableCollection<CodeExplorerItemViewModel> Projects
@@ -516,46 +479,46 @@ private void SwitchNodeState(CodeExplorerItemViewModel node, bool expandedState)
516479
SwitchNodeState(item, expandedState);
517480
}
518481
}
482+
519483

520-
public CommandBase RefreshCommand { get; }
521-
522-
public CommandBase OpenCommand { get; }
523-
484+
public ReparseCommand RefreshCommand { get; set; }
524485

525-
public CommandBase AddVBFormCommand { get; }
526-
public CommandBase AddMDIFormCommand { get; }
527-
public CommandBase AddUserFormCommand { get; }
528-
public CommandBase AddStdModuleCommand { get; }
529-
public CommandBase AddClassModuleCommand { get; }
530-
public CommandBase AddUserControlCommand { get; }
531-
public CommandBase AddPropertyPageCommand { get; }
532-
public CommandBase AddUserDocumentCommand { get; }
533-
public CommandBase AddTestModuleCommand { get; }
534-
public CommandBase AddTestModuleWithStubsCommand { get; }
486+
public OpenCommand OpenCommand { get; set; }
535487

536-
public CommandBase OpenDesignerCommand { get; }
537-
public CommandBase SetAsStartupProjectCommand { get; }
538-
public CommandBase OpenProjectPropertiesCommand { get; }
488+
public AddVBFormCommand AddVBFormCommand { get; set; }
489+
public AddMDIFormCommand AddMDIFormCommand { get; set; }
490+
public AddUserFormCommand AddUserFormCommand { get; set; }
491+
public AddStdModuleCommand AddStdModuleCommand { get; set; }
492+
public AddClassModuleCommand AddClassModuleCommand { get; set; }
493+
public AddUserControlCommand AddUserControlCommand { get; set; }
494+
public AddPropertyPageCommand AddPropertyPageCommand { get; set; }
495+
public AddUserDocumentCommand AddUserDocumentCommand { get; set; }
496+
public AddTestModuleCommand AddTestModuleCommand { get; set; }
497+
public AddTestModuleWithStubsCommand AddTestModuleWithStubsCommand { get; set; }
539498

540-
public CommandBase RenameCommand { get; }
499+
public OpenDesignerCommand OpenDesignerCommand { get; set; }
500+
public SetAsStartupProjectCommand SetAsStartupProjectCommand { get; set; }
501+
public OpenProjectPropertiesCommand OpenProjectPropertiesCommand { get; set; }
541502

542-
public CommandBase IndenterCommand { get; }
503+
public RenameCommand RenameCommand { get; set; }
504+
505+
public IndentCommand IndenterCommand { get; set; }
543506

544-
public CommandBase FindAllReferencesCommand { get; }
545-
public CommandBase FindAllImplementationsCommand { get; }
507+
public FindAllReferencesCommand FindAllReferencesCommand { get; set; }
508+
public FindAllImplementationsCommand FindAllImplementationsCommand { get; set; }
546509

547510
public CommandBase CollapseAllSubnodesCommand { get; }
548511
public CommandBase ExpandAllSubnodesCommand { get; }
549512

550-
public CommandBase ImportCommand { get; }
551-
public CommandBase ExportCommand { get; }
552-
public CommandBase ExportAllCommand { get; }
513+
public ImportCommand ImportCommand { get; set; }
514+
public ExportCommand ExportCommand { get; set; }
515+
public ExportAllCommand ExportAllCommand { get; set; }
553516

554517
public CommandBase RemoveCommand { get; }
555518

556-
public CommandBase PrintCommand { get; }
519+
public PrintCommand PrintCommand { get; set; }
557520

558-
private readonly CommandBase _externalRemoveCommand;
521+
private readonly RemoveCommand _externalRemoveCommand;
559522

560523
// this is a special case--we have to reset SelectedItem to prevent a crash
561524
private void ExecuteRemoveComand(object param)
@@ -567,7 +530,7 @@ private void ExecuteRemoveComand(object param)
567530
_externalRemoveCommand.Execute(param);
568531
}
569532

570-
private bool CanExecuteExportAllCommand => ExportAllCommand.CanExecute(SelectedItem);
533+
private bool CanExecuteExportAllCommand => ExportAllCommand?.CanExecute(SelectedItem) ?? false;
571534

572535
public Visibility ExportVisibility => _vbe.Kind == VBEKind.Standalone || CanExecuteExportAllCommand ? Visibility.Collapsed : Visibility.Visible;
573536

Rubberduck.Core/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[assembly: AssemblyCopyright("Copyright © 2014-2018")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
16-
[assembly: InternalsVisibleTo("Rubberduck.Main")]
16+
[assembly: InternalsVisibleTo("Rubberduck")]
1717
// internals visible for testing and mocking
1818
[assembly: InternalsVisibleTo("RubberduckTests")]
1919
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

Rubberduck.Core/Rubberduck.Core.csproj

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,12 @@
382382
<Compile Include="AutoComplete\AutoCompleteClosingParenthese.cs" />
383383
<Compile Include="AutoComplete\AutoCompleteClosingString.cs" />
384384
<Compile Include="AutoComplete\AutoCompleteService.cs" />
385+
<Compile Include="UI\UnitTesting\Commands\AddTestModuleWithStubsCommand.cs" />
385386
<Compile Include="UI\CodeExplorer\Commands\AddPropertyPageCommand.cs" />
386387
<Compile Include="UI\CodeExplorer\Commands\AddUserDocumentCommand.cs" />
387388
<Compile Include="UI\CodeExplorer\Commands\AddUserControlCommand.cs" />
388389
<Compile Include="UI\CodeExplorer\Commands\AddMDIFormCommand.cs" />
389390
<Compile Include="UI\CodeExplorer\Commands\AddVBFormCommand.cs" />
390-
<Compile Include="UI\CodeExplorer\Commands\AddTestModuleWithStubsCommand.cs" />
391-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerCommandAttribute.cs" />
392391
<Compile Include="UI\CodeExplorer\Commands\AddUserFormCommand.cs" />
393392
<Compile Include="UI\CodeExplorer\Commands\CopyResultsCommand.cs" />
394393
<Compile Include="UI\CodeExplorer\Commands\SetAsStartupProjectCommand.cs" />
@@ -410,8 +409,6 @@
410409
<Compile Include="UI\Command\ExportAllCommand.cs" />
411410
<Compile Include="UI\CodeExplorer\Commands\OpenProjectPropertiesCommand.cs" />
412411
<Compile Include="UI\CodeExplorer\Commands\RenameCommand.cs" />
413-
<Compile Include="UI\CodeExplorer\Commands\FindAllReferencesCommand.cs" />
414-
<Compile Include="UI\CodeExplorer\Commands\FindAllImplementationsCommand.cs" />
415412
<Compile Include="UI\CodeExplorer\Commands\IndentCommand.cs" />
416413
<Compile Include="UI\CodeExplorer\Commands\OpenCommand.cs" />
417414
<Compile Include="UI\CodeExplorer\Commands\RemoveCommand.cs" />
@@ -421,7 +418,6 @@
421418
<Compile Include="UI\CodeExplorer\Commands\OpenDesignerCommand.cs" />
422419
<Compile Include="UI\CodeExplorer\Commands\AddClassModuleCommand.cs" />
423420
<Compile Include="UI\CodeExplorer\Commands\AddStdModuleCommand.cs" />
424-
<Compile Include="UI\CodeExplorer\Commands\AddTestModuleCommand.cs" />
425421
<Compile Include="UI\CodeExplorer\Commands\AddComponentCommand.cs" />
426422
<Compile Include="UI\Command\FormDesignerFindAllReferencesCommand.cs" />
427423
<Compile Include="UI\Command\IndentCurrentProjectCommand.cs" />
@@ -526,10 +522,12 @@
526522
<DependentUpon>AutoCompleteSettings.xaml</DependentUpon>
527523
</Compile>
528524
<Compile Include="UI\Settings\AutoCompleteSettingsViewModel.cs" />
529-
<Compile Include="UnitTesting\IFakes.cs" />
530-
<Compile Include="UnitTesting\ReturnTypeConverter.cs" />
531-
<Compile Include="UnitTesting\PermissiveObjectComparer.cs" />
532-
<Compile Include="UnitTesting\TestCategory.cs" />
525+
<Compile Include="UI\UnitTesting\Commands\RepeatLastRunCommand.cs" />
526+
<Compile Include="UI\UnitTesting\Commands\RunFailedTestsCommand.cs" />
527+
<Compile Include="UI\UnitTesting\Commands\RunInconclusiveTestsCommand.cs" />
528+
<Compile Include="UI\UnitTesting\Commands\RunNotExecutedTestsCommand.cs" />
529+
<Compile Include="UI\UnitTesting\Commands\RunSucceededTestsCommand.cs" />
530+
<Compile Include="UI\UnitTesting\ViewModels\TestMethodViewModel.cs" />
533531
<Compile Include="VersionCheck\IVersionCheck.cs" />
534532
<Compile Include="UI\Command\MenuItems\CommandBars\AppCommandBarBase.cs" />
535533
<Compile Include="UI\Command\MenuItems\CommandBars\ContextSelectionLabelMenuItem.cs" />
@@ -600,9 +598,9 @@
600598
<Compile Include="UI\Inspections\InspectionResultsViewModel.cs" />
601599
<Compile Include="UI\Inspections\InspectionSeverityImageSourceConverter.cs" />
602600
<Compile Include="UI\Command\AboutCommand.cs" />
603-
<Compile Include="UI\Command\AddTestMethodExpectedErrorCommand.cs" />
604-
<Compile Include="UI\Command\AddTestMethodCommand.cs" />
605-
<Compile Include="UI\Command\AddTestModuleCommand.cs" />
601+
<Compile Include="UI\UnitTesting\Commands\AddTestMethodExpectedErrorCommand.cs" />
602+
<Compile Include="UI\UnitTesting\Commands\AddTestMethodCommand.cs" />
603+
<Compile Include="UI\UnitTesting\Commands\AddTestModuleCommand.cs" />
606604
<Compile Include="UI\Command\CommandBase.cs" />
607605
<Compile Include="UI\Command\DelegateCommand.cs" />
608606
<Compile Include="UI\Command\IndentCurrentProcedureCommand.cs" />
@@ -772,7 +770,6 @@
772770
</Compile>
773771
<Compile Include="UI\IdentifierReferences\IdentifierReferencesListDockablePresenter.cs" />
774772
<Compile Include="UI\FileBrowserDialogFactory.cs" />
775-
<Compile Include="UI\Controls\INavigateSelection.cs" />
776773
<Compile Include="UI\Splash.cs">
777774
<SubType>Form</SubType>
778775
</Compile>
@@ -797,7 +794,6 @@
797794
<Compile Include="UI\Inspections\InspectionResultsWindow.Designer.cs">
798795
<DependentUpon>InspectionResultsWindow.cs</DependentUpon>
799796
</Compile>
800-
<Compile Include="UI\NavigateCodeEventArgs.cs" />
801797
<Compile Include="UI\Inspections\QuickFixEventArgs.cs" />
802798
<Compile Include="UI\DockableToolwindowPresenter.cs" />
803799
<Compile Include="Settings\Configuration.cs" />
@@ -831,16 +827,7 @@
831827
<DependentUpon>TestExplorerWindow.cs</DependentUpon>
832828
</Compile>
833829
<Compile Include="UI\ViewModelBase.cs" />
834-
<Compile Include="UnitTesting\AssertCompletedEventArgs.cs" />
835-
<Compile Include="UnitTesting\AssertHandler.cs" />
836-
<Compile Include="UnitTesting\UnitTestUtils.cs" />
837-
<Compile Include="UnitTesting\ITestEngine.cs" />
838-
<Compile Include="UnitTesting\ProjectTestExtensions.cs" />
839-
<Compile Include="UnitTesting\TestEngine.cs" />
840-
<Compile Include="UnitTesting\TestMethod.cs" />
841-
<Compile Include="UnitTesting\TestOutcome.cs" />
842830
<Compile Include="UI\UnitTesting\TestOutcomeImageSourceConverter.cs" />
843-
<Compile Include="UnitTesting\TestResult.cs" />
844831
<Compile Include="UI\UnitTesting\TestResultToOutcomeTextConverter.cs" />
845832
<Compile Include="UI\Command\Refactorings\RefactorCommandBase.cs" />
846833
<Compile Include="UI\Command\Refactorings\RefactorExtractMethodCommand.cs" />
@@ -977,6 +964,10 @@
977964
<Project>{B9C0BF22-4D8A-4BF4-89F9-E789C0063DEB}</Project>
978965
<Name>Rubberduck.SmartIndenter</Name>
979966
</ProjectReference>
967+
<ProjectReference Include="..\Rubberduck.UnitTesting\Rubberduck.UnitTesting.csproj">
968+
<Project>{68f55404-32ca-4414-96b8-e284f3b1f846}</Project>
969+
<Name>Rubberduck.UnitTesting</Name>
970+
</ProjectReference>
980971
<ProjectReference Include="..\Rubberduck.VBEEditor\Rubberduck.VBEditor.csproj">
981972
<Project>{8CE35EB3-8852-4BA1-84DD-DF3F5D2967B0}</Project>
982973
<Name>Rubberduck.VBEditor</Name>

Rubberduck.Core/ToDoItems/ToDoItem.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using Rubberduck.Common;
2+
using Rubberduck.Interaction.Navigation;
23
using Rubberduck.Parsing.Symbols;
34
using Rubberduck.Resources;
4-
using Rubberduck.UI;
5-
using Rubberduck.UI.Controls;
65
using Rubberduck.VBEditor;
76

87
namespace Rubberduck.ToDoItems

Rubberduck.Core/UI/CodeExplorer/Commands/AddClassModuleCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
namespace Rubberduck.UI.CodeExplorer.Commands
77
{
8-
[CodeExplorerCommand]
98
public class AddClassModuleCommand : CommandBase
109
{
1110
private readonly AddComponentCommand _addComponentCommand;

Rubberduck.Core/UI/CodeExplorer/Commands/AddMDIFormCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace Rubberduck.UI.CodeExplorer.Commands
88
{
9-
[CodeExplorerCommand]
109
public class AddMDIFormCommand : CommandBase
1110
{
1211
private readonly IVBE _vbe;

Rubberduck.Core/UI/CodeExplorer/Commands/AddPropertyPageCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
namespace Rubberduck.UI.CodeExplorer.Commands
77
{
8-
[CodeExplorerCommand]
98
public class AddPropertyPageCommand : CommandBase
109
{
1110
private readonly AddComponentCommand _addComponentCommand;

Rubberduck.Core/UI/CodeExplorer/Commands/AddStdModuleCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
namespace Rubberduck.UI.CodeExplorer.Commands
77
{
8-
[CodeExplorerCommand]
98
public class AddStdModuleCommand : CommandBase
109
{
1110
private readonly AddComponentCommand _addComponentCommand;

0 commit comments

Comments
 (0)