1616using Rubberduck . VBEditor ;
1717using Rubberduck . VBEditor . SafeComWrappers ;
1818using Rubberduck . VBEditor . SafeComWrappers . Abstract ;
19+ using System . Windows ;
1920
2021// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
2122
@@ -60,6 +61,8 @@ public CodeExplorerViewModel(FolderHelper folderHelper, RubberduckParserState st
6061
6162 ImportCommand = commands . OfType < ImportCommand > ( ) . SingleOrDefault ( ) ;
6263 ExportCommand = commands . OfType < ExportCommand > ( ) . SingleOrDefault ( ) ;
64+ ExportAllCommand = commands . OfType < Rubberduck . UI . Command . ExportAllCommand > ( ) . SingleOrDefault ( ) ;
65+
6366 _externalRemoveCommand = commands . OfType < RemoveCommand > ( ) . SingleOrDefault ( ) ;
6467 if ( _externalRemoveCommand != null )
6568 {
@@ -99,8 +102,11 @@ public CodeExplorerItemViewModel SelectedItem
99102 OnPropertyChanged ( "CanExecuteIndenterCommand" ) ;
100103 OnPropertyChanged ( "CanExecuteRenameCommand" ) ;
101104 OnPropertyChanged ( "CanExecuteFindAllReferencesCommand" ) ;
105+ OnPropertyChanged ( "ExportVisibility" ) ;
106+ OnPropertyChanged ( "ExportAllVisibility" ) ;
102107 OnPropertyChanged ( "PanelTitle" ) ;
103108 OnPropertyChanged ( "Description" ) ;
109+
104110 // ReSharper restore ExplicitCallerInfoArgument
105111 }
106112 }
@@ -463,13 +469,15 @@ private void SwitchNodeState(CodeExplorerItemViewModel node, bool expandedState)
463469
464470 public CommandBase ImportCommand { get ; }
465471 public CommandBase ExportCommand { get ; }
472+ public CommandBase ExportAllCommand { get ; }
473+
466474 public CommandBase RemoveCommand { get ; }
467475
468476 public CommandBase PrintCommand { get ; }
469477
470478 public CommandBase CommitCommand { get ; }
471479 public CommandBase UndoCommand { get ; }
472-
480+
473481 private readonly CommandBase _externalRemoveCommand ;
474482
475483 // this is a special case--we have to reset SelectedItem to prevent a crash
@@ -482,6 +490,28 @@ private void ExecuteRemoveComand(object param)
482490 _externalRemoveCommand . Execute ( param ) ;
483491 }
484492
493+ private bool CanExecuteExportAllCommand => ExportAllCommand . CanExecute ( SelectedItem ) ;
494+
495+ public Visibility ExportVisibility
496+ {
497+ get
498+ {
499+ if ( CanExecuteExportAllCommand == false )
500+ { return Visibility . Visible ; }
501+ else { return Visibility . Collapsed ; }
502+ }
503+ }
504+
505+ public Visibility ExportAllVisibility
506+ {
507+ get
508+ {
509+ if ( CanExecuteExportAllCommand == true )
510+ { return Visibility . Visible ; }
511+ else { return Visibility . Collapsed ; }
512+ }
513+ }
514+
485515 public void Dispose ( )
486516 {
487517 if ( _state != null )
0 commit comments