Skip to content

Commit 14aab4c

Browse files
committed
Merge with conflicts.
2 parents bc779f8 + 6316ed0 commit 14aab4c

21 files changed

+182
-120
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<CodeExplorer_NavigateCommand>().FirstOrDefault();
36+
_navigateCommand = commands.OfType<CodeExplorerNavigateCommand>().FirstOrDefault();
3737

38-
_addTestModuleCommand = commands.OfType<CodeExplorer_AddTestModuleCommand>().FirstOrDefault();
39-
_addStdModuleCommand = commands.OfType<CodeExplorer_AddStdModuleCommand>().FirstOrDefault();
40-
_addClassModuleCommand = commands.OfType<CodeExplorer_AddClassModuleCommand>().FirstOrDefault();
41-
_addUserFormCommand = commands.OfType<CodeExplorer_AddUserFormCommand>().FirstOrDefault();
38+
_addTestModuleCommand = commands.OfType<CodeExplorerAddTestModuleCommand>().FirstOrDefault();
39+
_addStdModuleCommand = commands.OfType<CodeExplorerAddStdModuleCommand>().FirstOrDefault();
40+
_addClassModuleCommand = commands.OfType<CodeExplorerAddClassModuleCommand>().FirstOrDefault();
41+
_addUserFormCommand = commands.OfType<CodeExplorerAddUserFormCommand>().FirstOrDefault();
4242

43-
_openDesignerCommand = commands.OfType<CodeExplorer_OpenDesignerCommand>().FirstOrDefault();
44-
_openProjectPropertiesCommand = commands.OfType<CodeExplorer_OpenProjectPropertiesCommand>().FirstOrDefault();
45-
_renameCommand = commands.OfType<CodeExplorer_RenameCommand>().FirstOrDefault();
46-
_indenterCommand = commands.OfType<CodeExplorer_IndentCommand>().FirstOrDefault();
43+
_openDesignerCommand = commands.OfType<CodeExplorerOpenDesignerCommand>().FirstOrDefault();
44+
_openProjectPropertiesCommand = commands.OfType<CodeExplorerOpenProjectPropertiesCommand>().FirstOrDefault();
45+
_renameCommand = commands.OfType<CodeExplorerRenameCommand>().FirstOrDefault();
46+
_indenterCommand = commands.OfType<CodeExplorerIndentCommand>().FirstOrDefault();
4747

48-
_findAllReferencesCommand = commands.OfType<CodeExplorer_FindAllReferencesCommand>().FirstOrDefault();
49-
_findAllImplementationsCommand = commands.OfType<CodeExplorer_FindAllImplementationsCommand>().FirstOrDefault();
48+
_findAllReferencesCommand = commands.OfType<CodeExplorerFindAllReferencesCommand>().FirstOrDefault();
49+
_findAllImplementationsCommand = commands.OfType<CodeExplorerFindAllImplementationsCommand>().FirstOrDefault();
5050

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

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

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

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

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

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -414,30 +414,29 @@
414414
<Compile Include="UI\About\AboutDialog.Designer.cs">
415415
<DependentUpon>AboutDialog.cs</DependentUpon>
416416
</Compile>
417-
<Compile Include="UI\HotkeyDisplayConverter.cs" />
418-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_CommitCommand.cs" />
419-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_AddUserFormCommand.cs" />
420-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_CopyResultsCommand.cs" />
421-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_OpenProjectPropertiesCommand.cs" />
422-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_RenameCommand.cs" />
423-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_FindAllReferencesCommand.cs" />
424-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_FindAllImplementationsCommand.cs" />
425-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_IndentCommand.cs" />
426-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_NavigateCommand.cs" />
427-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_RemoveCommand.cs" />
428-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_ExportCommand.cs" />
429-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_ImportCommand.cs" />
430-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_PrintCommand.cs" />
431-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_OpenDesignerCommand.cs" />
432-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_AddClassModuleCommand.cs" />
433-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_AddStdModuleCommand.cs" />
434-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_AddTestModuleCommand.cs" />
417+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerCommitCommand.cs" />
418+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerAddUserFormCommand.cs" />
419+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerCopyResultsCommand.cs" />
420+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerOpenProjectPropertiesCommand.cs" />
421+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerRenameCommand.cs" />
422+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerFindAllReferencesCommand.cs" />
423+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerFindAllImplementationsCommand.cs" />
424+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerIndentCommand.cs" />
425+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerNavigateCommand.cs" />
426+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerRemoveCommand.cs" />
427+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerExportCommand.cs" />
428+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerImportCommand.cs" />
429+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerPrintCommand.cs" />
430+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerOpenDesignerCommand.cs" />
431+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerAddClassModuleCommand.cs" />
432+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerAddStdModuleCommand.cs" />
433+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerAddTestModuleCommand.cs" />
435434
<Compile Include="UI\Controls\LinkButton.xaml.cs">
436435
<DependentUpon>LinkButton.xaml</DependentUpon>
437436
</Compile>
438437
<Compile Include="UI\Converters\InvertBoolValueConverter.cs" />
439438
<Compile Include="UI\Converters\BoolToHiddenVisibilityConverter.cs" />
440-
<Compile Include="UI\CodeExplorer\Commands\CodeExplorer_UndoCommand.cs" />
439+
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerUndoCommand.cs" />
441440
<Compile Include="UI\Command\MenuItems\NoIndentAnnotationCommandMenuItem.cs" />
442441
<Compile Include="UI\Command\MenuItems\IndentCurrentModuleCommandMenuItem.cs" />
443442
<Compile Include="UI\Command\NoIndentAnnotationCommand.cs" />

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
using System.Runtime.InteropServices;
13
using Microsoft.Vbe.Interop;
24
using NLog;
35
using Rubberduck.Navigation.CodeExplorer;
@@ -6,18 +8,25 @@
68

79
namespace Rubberduck.UI.CodeExplorer.Commands
810
{
9-
public class CodeExplorer_AddClassModuleCommand : CommandBase
11+
public class CodeExplorerAddClassModuleCommand : CommandBase
1012
{
1113
private readonly VBE _vbe;
1214

13-
public CodeExplorer_AddClassModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
15+
public CodeExplorerAddClassModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1416
{
1517
_vbe = vbe;
1618
}
1719

1820
protected override bool CanExecuteImpl(object parameter)
1921
{
20-
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
22+
try
23+
{
24+
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
25+
}
26+
catch (COMException)
27+
{
28+
return false;
29+
}
2130
}
2231

2332
protected override void ExecuteImpl(object parameter)

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
using System.Runtime.InteropServices;
13
using Microsoft.Vbe.Interop;
24
using NLog;
35
using Rubberduck.Navigation.CodeExplorer;
@@ -6,18 +8,26 @@
68

79
namespace Rubberduck.UI.CodeExplorer.Commands
810
{
9-
public class CodeExplorer_AddStdModuleCommand : CommandBase
11+
public class CodeExplorerAddStdModuleCommand : CommandBase
1012
{
1113
private readonly VBE _vbe;
1214

13-
public CodeExplorer_AddStdModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
15+
public CodeExplorerAddStdModuleCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1416
{
1517
_vbe = vbe;
1618
}
1719

1820
protected override bool CanExecuteImpl(object parameter)
1921
{
20-
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
22+
try
23+
{
24+
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
25+
}
26+
catch (COMException)
27+
{
28+
// could be that _vbe.VBProjects reference is stale?
29+
return false;
30+
}
2131
}
2232

2333
protected override void ExecuteImpl(object parameter)

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
using System.Runtime.InteropServices;
13
using Microsoft.Vbe.Interop;
24
using NLog;
35
using Rubberduck.Navigation.CodeExplorer;
@@ -7,20 +9,27 @@
79

810
namespace Rubberduck.UI.CodeExplorer.Commands
911
{
10-
public class CodeExplorer_AddTestModuleCommand : CommandBase
12+
public class CodeExplorerAddTestModuleCommand : CommandBase
1113
{
1214
private readonly VBE _vbe;
1315
private readonly NewUnitTestModuleCommand _newUnitTestModuleCommand;
1416

15-
public CodeExplorer_AddTestModuleCommand(VBE vbe, NewUnitTestModuleCommand newUnitTestModuleCommand) : base(LogManager.GetCurrentClassLogger())
17+
public CodeExplorerAddTestModuleCommand(VBE vbe, NewUnitTestModuleCommand newUnitTestModuleCommand) : base(LogManager.GetCurrentClassLogger())
1618
{
1719
_vbe = vbe;
1820
_newUnitTestModuleCommand = newUnitTestModuleCommand;
1921
}
2022

2123
protected override bool CanExecuteImpl(object parameter)
2224
{
23-
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
25+
try
26+
{
27+
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
28+
}
29+
catch (COMException)
30+
{
31+
return false;
32+
}
2433
}
2534

2635
protected override void ExecuteImpl(object parameter)

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
using System.Runtime.InteropServices;
13
using Microsoft.Vbe.Interop;
24
using NLog;
35
using Rubberduck.Navigation.CodeExplorer;
@@ -6,18 +8,25 @@
68

79
namespace Rubberduck.UI.CodeExplorer.Commands
810
{
9-
public class CodeExplorer_AddUserFormCommand : CommandBase
11+
public class CodeExplorerAddUserFormCommand : CommandBase
1012
{
1113
private readonly VBE _vbe;
1214

13-
public CodeExplorer_AddUserFormCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
15+
public CodeExplorerAddUserFormCommand(VBE vbe) : base(LogManager.GetCurrentClassLogger())
1416
{
1517
_vbe = vbe;
1618
}
1719

1820
protected override bool CanExecuteImpl(object parameter)
1921
{
20-
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
22+
try
23+
{
24+
return GetDeclaration(parameter) != null || _vbe.VBProjects.Count == 1;
25+
}
26+
catch (COMException)
27+
{
28+
return false;
29+
}
2130
}
2231

2332
protected override void ExecuteImpl(object parameter)

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

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

66
namespace Rubberduck.UI.CodeExplorer.Commands
77
{
8-
public class CodeExplorer_CommitCommand : CommandBase
8+
public class CodeExplorerCommitCommand : CommandBase
99
{
1010
private readonly SourceControlDockablePresenter _presenter;
1111

12-
public CodeExplorer_CommitCommand(SourceControlDockablePresenter presenter) : base(LogManager.GetCurrentClassLogger())
12+
public CodeExplorerCommitCommand(SourceControlDockablePresenter presenter) : base(LogManager.GetCurrentClassLogger())
1313
{
1414
_presenter = presenter;
1515
}

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

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

1010
namespace Rubberduck.UI.CodeExplorer.Commands
1111
{
12-
public class CodeExplorer_CopyResultsCommand : CommandBase
12+
public class CodeExplorerCopyResultsCommand : CommandBase
1313
{
1414
private readonly RubberduckParserState _state;
1515
private readonly IClipboardWriter _clipboard;
1616

17-
public CodeExplorer_CopyResultsCommand(RubberduckParserState state) : base(LogManager.GetCurrentClassLogger())
17+
public CodeExplorerCopyResultsCommand(RubberduckParserState state) : base(LogManager.GetCurrentClassLogger())
1818
{
1919
_state = state;
2020
_clipboard = new ClipboardWriter();

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_ExportCommand.cs renamed to RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorerExportCommand.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Runtime.InteropServices;
45
using System.Windows.Forms;
56
using Microsoft.Vbe.Interop;
67
using NLog;
@@ -9,7 +10,7 @@
910

1011
namespace Rubberduck.UI.CodeExplorer.Commands
1112
{
12-
public class CodeExplorer_ExportCommand : CommandBase, IDisposable
13+
public class CodeExplorerExportCommand : CommandBase, IDisposable
1314
{
1415
private readonly ISaveFileDialog _saveFileDialog;
1516
private readonly Dictionary<vbext_ComponentType, string> _exportableFileExtensions = new Dictionary<vbext_ComponentType, string>
@@ -20,7 +21,7 @@ public class CodeExplorer_ExportCommand : CommandBase, IDisposable
2021
{ vbext_ComponentType.vbext_ct_MSForm, ".frm" }
2122
};
2223

23-
public CodeExplorer_ExportCommand(ISaveFileDialog saveFileDialog) : base(LogManager.GetCurrentClassLogger())
24+
public CodeExplorerExportCommand(ISaveFileDialog saveFileDialog) : base(LogManager.GetCurrentClassLogger())
2425
{
2526
_saveFileDialog = saveFileDialog;
2627
_saveFileDialog.OverwritePrompt = true;
@@ -33,9 +34,17 @@ protected override bool CanExecuteImpl(object parameter)
3334
return false;
3435
}
3536

36-
var node = (CodeExplorerComponentViewModel)parameter;
37-
var componentType = node.Declaration.QualifiedName.QualifiedModuleName.Component.Type;
38-
return _exportableFileExtensions.Select(s => s.Key).Contains(componentType);
37+
try
38+
{
39+
var node = (CodeExplorerComponentViewModel)parameter;
40+
var componentType = node.Declaration.QualifiedName.QualifiedModuleName.Component.Type;
41+
return _exportableFileExtensions.Select(s => s.Key).Contains(componentType);
42+
}
43+
catch (COMException)
44+
{
45+
// thrown when the component reference is stale
46+
return false;
47+
}
3948
}
4049

4150
protected override void ExecuteImpl(object parameter)

RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorer_FindAllImplementationsCommand.cs renamed to RetailCoder.VBE/UI/CodeExplorer/Commands/CodeExplorerFindAllImplementationsCommand.cs

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

66
namespace Rubberduck.UI.CodeExplorer.Commands
77
{
8-
public class CodeExplorer_FindAllImplementationsCommand : CommandBase
8+
public class CodeExplorerFindAllImplementationsCommand : CommandBase
99
{
1010
private readonly RubberduckParserState _state;
1111
private readonly FindAllImplementationsCommand _findAllImplementations;
1212

13-
public CodeExplorer_FindAllImplementationsCommand(RubberduckParserState state, FindAllImplementationsCommand findAllImplementations) : base(LogManager.GetCurrentClassLogger())
13+
public CodeExplorerFindAllImplementationsCommand(RubberduckParserState state, FindAllImplementationsCommand findAllImplementations) : base(LogManager.GetCurrentClassLogger())
1414
{
1515
_state = state;
1616
_findAllImplementations = findAllImplementations;

0 commit comments

Comments
 (0)