Skip to content

Commit bd0f2d7

Browse files
author
Andrew Mansell
committed
Initial commit
1 parent 2e5f26c commit bd0f2d7

31 files changed

+467
-106
lines changed

Rubberduck.Core/App.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ public void Startup()
116116

117117
CheckForLegacyIndenterSettings();
118118
_appMenus.Initialize();
119-
_hooks.HookHotkeys(); // need to hook hotkeys before we localize menus, to correctly display ShortcutTexts
119+
_hooks.HookHotkeys(); // need to hook hotkeys before we localize menus, to correctly display ShortcutTexts
120120
_appMenus.Localize();
121121

122122
if (_config.UserSettings.GeneralSettings.CanCheckVersion)
123123
{
124124
_checkVersionCommand.Execute(null);
125-
}
125+
}
126126
}
127127

128128
public void Shutdown()

Rubberduck.Core/AppMenu.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using System.Threading;
54
using NLog;
65
using Rubberduck.Parsing;
76
using Rubberduck.Parsing.VBA;
@@ -63,6 +62,7 @@ public void Localize()
6362
{
6463
_stateBar.Localize();
6564
_stateBar.SetStatusLabelCaption(_parser.State.Status);
65+
6666
foreach (var menu in _menus)
6767
{
6868
menu.Localize();

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerComponentViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public bool IsTestModule
164164
{ ComponentType.VBForm, DeclarationType.VbForm },
165165
{ ComponentType.MDIForm, DeclarationType.MdiForm},
166166
{ ComponentType.UserControl, DeclarationType.UserControl},
167+
{ ComponentType.DocObject, DeclarationType.DocObject},
167168
{ ComponentType.ResFile, DeclarationType.ResFile},
168169
{ ComponentType.RelatedDocument, DeclarationType.RelatedDocument},
169170
{ ComponentType.PropPage, DeclarationType.PropPage},

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 28 additions & 10 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.VBEditor.SafeComWrappers.Abstract;
2223

2324
// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
2425
// ReSharper disable ExplicitCallerInfoArgument
@@ -33,6 +34,7 @@ public sealed class CodeExplorerViewModel : ViewModelBase, IDisposable
3334
private readonly GeneralSettings _generalSettings;
3435
private readonly WindowSettings _windowSettings;
3536
private readonly IUiDispatcher _uiDispatcher;
37+
private readonly VBEKind _vbeKind;
3638

3739
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
3840

@@ -42,14 +44,16 @@ public CodeExplorerViewModel(
4244
List<CommandBase> commands,
4345
IConfigProvider<GeneralSettings> generalSettingsProvider,
4446
IConfigProvider<WindowSettings> windowSettingsProvider,
45-
IUiDispatcher uiDispatcher)
47+
IUiDispatcher uiDispatcher,
48+
IVBE vbe)
4649
{
4750
_folderHelper = folderHelper;
4851
_state = state;
4952
_state.StateChanged += HandleStateChanged;
5053
_state.ModuleStateChanged += ParserState_ModuleStateChanged;
5154
_windowSettingsProvider = windowSettingsProvider;
5255
_uiDispatcher = uiDispatcher;
56+
_vbeKind = vbe.Kind;
5357

5458
if (generalSettingsProvider != null)
5559
{
@@ -68,15 +72,19 @@ public CodeExplorerViewModel(
6872
o => reparseCommand.Execute(o),
6973
o => !IsBusy && reparseCommand != null && reparseCommand.CanExecute(o));
7074

71-
OpenCommand = commands.OfType<UI.CodeExplorer.Commands.OpenCommand>().SingleOrDefault();
75+
OpenCommand = commands.OfType<OpenCommand>().SingleOrDefault();
7276
OpenDesignerCommand = commands.OfType<OpenDesignerCommand>().SingleOrDefault();
7377

74-
AddTestModuleCommand = commands.OfType<UI.CodeExplorer.Commands.AddTestModuleCommand>().SingleOrDefault();
75-
AddTestModuleWithStubsCommand = commands.OfType<AddTestModuleWithStubsCommand>().SingleOrDefault();
76-
78+
AddVBFormCommand = commands.OfType<AddVBFormCommand>().SingleOrDefault();
79+
AddMDIFormCommand = commands.OfType<AddMDIFormCommand>().SingleOrDefault();
80+
AddUserFormCommand = commands.OfType<AddUserFormCommand>().SingleOrDefault();
7781
AddStdModuleCommand = commands.OfType<AddStdModuleCommand>().SingleOrDefault();
7882
AddClassModuleCommand = commands.OfType<AddClassModuleCommand>().SingleOrDefault();
79-
AddUserFormCommand = commands.OfType<AddUserFormCommand>().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();
8088

8189
OpenProjectPropertiesCommand = commands.OfType<OpenProjectPropertiesCommand>().SingleOrDefault();
8290
RenameCommand = commands.OfType<RenameCommand>().SingleOrDefault();
@@ -90,7 +98,7 @@ public CodeExplorerViewModel(
9098

9199
ImportCommand = commands.OfType<ImportCommand>().SingleOrDefault();
92100
ExportCommand = commands.OfType<ExportCommand>().SingleOrDefault();
93-
ExportAllCommand = commands.OfType<Rubberduck.UI.Command.ExportAllCommand>().SingleOrDefault();
101+
ExportAllCommand = commands.OfType<ExportAllCommand>().SingleOrDefault();
94102

95103
_externalRemoveCommand = commands.OfType<RemoveCommand>().SingleOrDefault();
96104
if (_externalRemoveCommand != null)
@@ -511,11 +519,17 @@ private void SwitchNodeState(CodeExplorerItemViewModel node, bool expandedState)
511519

512520
public CommandBase OpenCommand { get; }
513521

522+
523+
public CommandBase AddVBFormCommand { get; }
524+
public CommandBase AddMDIFormCommand { get; }
525+
public CommandBase AddUserFormCommand { get; }
526+
public CommandBase AddStdModuleCommand { get; }
527+
public CommandBase AddClassModuleCommand { get; }
528+
public CommandBase AddUserControlCommand { get; }
529+
public CommandBase AddPropertyPageCommand { get; }
530+
public CommandBase AddUserDocumentCommand { get; }
514531
public CommandBase AddTestModuleCommand { get; }
515532
public CommandBase AddTestModuleWithStubsCommand { get; }
516-
public CommandBase AddStdModuleCommand { get; }
517-
public CommandBase AddClassModuleCommand { get; }
518-
public CommandBase AddUserFormCommand { get; }
519533

520534
public CommandBase OpenDesignerCommand { get; }
521535
public CommandBase OpenProjectPropertiesCommand { get; }
@@ -560,6 +574,10 @@ private void ExecuteRemoveComand(object param)
560574

561575
public Visibility EmptyUIRefreshMessageVisibility => _isBusy ? Visibility.Hidden : Visibility.Visible;
562576

577+
public Visibility VB6Visibility => _vbeKind == VBEKind.Standalone ? Visibility.Visible : Visibility.Collapsed;
578+
579+
public Visibility VBAVisibility => _vbeKind == VBEKind.Hosted ? Visibility.Visible : Visibility.Collapsed;
580+
563581
public void FilterByName(IEnumerable<CodeExplorerItemViewModel> nodes, string searchString)
564582
{
565583
foreach (var item in nodes)

Rubberduck.Core/Rubberduck.Core.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@
374374
<Compile Include="AutoComplete\AutoCompleteClosingParenthese.cs" />
375375
<Compile Include="AutoComplete\AutoCompleteClosingString.cs" />
376376
<Compile Include="AutoComplete\AutoCompleteService.cs" />
377+
<Compile Include="UI\CodeExplorer\Commands\AddPropertyPageCommand.cs" />
378+
<Compile Include="UI\CodeExplorer\Commands\AddUserDocumentCommand.cs" />
379+
<Compile Include="UI\CodeExplorer\Commands\AddUserControlCommand.cs" />
380+
<Compile Include="UI\CodeExplorer\Commands\AddMDIFormCommand.cs" />
381+
<Compile Include="UI\CodeExplorer\Commands\AddVBFormCommand.cs" />
377382
<Compile Include="UI\CodeExplorer\Commands\AddTestModuleWithStubsCommand.cs" />
378383
<Compile Include="UI\CodeExplorer\Commands\CodeExplorerCommandAttribute.cs" />
379384
<Compile Include="UI\CodeExplorer\Commands\AddUserFormCommand.cs" />

0 commit comments

Comments
 (0)