@@ -39,13 +39,15 @@ public enum CodeExplorerSortOrder
3939 public sealed class CodeExplorerViewModel : ViewModelBase
4040 {
4141 // ReSharper disable NotAccessedField.Local - The settings providers aren't used, but several enhancement requests will need them.
42+ #pragma warning disable IDE0052 // Remove unread private members
4243 private readonly RubberduckParserState _state ;
4344 private readonly RemoveCommand _externalRemoveCommand ;
44- private readonly IConfigurationService < GeneralSettings > _generalSettingsProvider ;
45+ private readonly IConfigurationService < GeneralSettings > _generalSettingsProvider ;
4546 private readonly IConfigurationService < WindowSettings > _windowSettingsProvider ;
4647 private readonly IUiDispatcher _uiDispatcher ;
4748 private readonly IVBE _vbe ;
4849 private readonly ITemplateProvider _templateProvider ;
50+ #pragma warning restore IDE0052 // Remove unread private members
4951 // ReSharper restore NotAccessedField.Local
5052
5153 public CodeExplorerViewModel (
@@ -77,6 +79,8 @@ public CodeExplorerViewModel(
7779 CollapseAllSubnodesCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteCollapseNodes , EvaluateCanSwitchNodeState ) ;
7880 ExpandAllSubnodesCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteExpandNodes , EvaluateCanSwitchNodeState ) ;
7981 ClearSearchCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteClearSearchCommand ) ;
82+ CollapseAllCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteCollapseAllCommand ) ;
83+ ExpandAllCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteExpandAllCommand ) ;
8084 if ( _externalRemoveCommand != null )
8185 {
8286 RemoveCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteRemoveCommand , _externalRemoveCommand . CanExecute ) ;
@@ -92,7 +96,9 @@ public CodeExplorerViewModel(
9296
9397 public ObservableCollection < ICodeExplorerNode > Projects { get ; } = new ObservableCollection < ICodeExplorerNode > ( ) ;
9498
99+ #pragma warning disable IDE1006 // Naming Styles
95100 private ObservableCollection < Template > templates => _templateProvider . GetTemplates ( ) ;
101+ #pragma warning restore IDE1006 // Naming Styles
96102
97103 public ObservableCollection < Template > BuiltInTemplates =>
98104 new ObservableCollection < Template > ( templates . Where ( t => ! t . IsUserDefined )
@@ -345,6 +351,22 @@ private void ExecuteClearSearchCommand(object parameter)
345351 }
346352 }
347353
354+ private void ExecuteCollapseAllCommand ( object parameter )
355+ {
356+ foreach ( var project in Projects )
357+ {
358+ ExecuteCollapseNodes ( project ) ;
359+ }
360+ }
361+
362+ private void ExecuteExpandAllCommand ( object parameter )
363+ {
364+ foreach ( var project in Projects )
365+ {
366+ ExecuteExpandNodes ( project ) ;
367+ }
368+ }
369+
348370 private bool EvaluateCanSwitchNodeState ( object parameter )
349371 {
350372 return SelectedItem ? . Children ? . Any ( ) ?? false ;
@@ -420,7 +442,10 @@ private void ExecuteRemoveCommand(object param)
420442
421443 public CodeExplorerMoveToFolderDragAndDropCommand MoveToFolderDragAndDropCommand { get ; set ; }
422444
423- public ICodeExplorerNode FindVisibleNodeForDeclaration ( Declaration declaration )
445+ public CommandBase CollapseAllCommand { get ; }
446+ public CommandBase ExpandAllCommand { get ; }
447+
448+ public ICodeExplorerNode FindVisibleNodeForDeclaration ( Declaration declaration )
424449 {
425450 if ( declaration == null )
426451 {
0 commit comments