Skip to content

Commit 088082c

Browse files
author
Andrew Mansell
committed
Hide Import, Export, Remove from VB6
1 parent 4098165 commit 088082c

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ private void ExecuteRemoveComand(object param)
566566

567567
private bool CanExecuteExportAllCommand => ExportAllCommand.CanExecute(SelectedItem);
568568

569-
public Visibility ExportVisibility => CanExecuteExportAllCommand ? Visibility.Collapsed : Visibility.Visible;
569+
public Visibility ExportVisibility => _vbeKind == VBEKind.Standalone || CanExecuteExportAllCommand ? Visibility.Collapsed : Visibility.Visible;
570570

571571
public Visibility ExportAllVisibility => CanExecuteExportAllCommand ? Visibility.Visible : Visibility.Collapsed;
572572

Rubberduck.Core/UI/CodeExplorer/CodeExplorerControl.xaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@
284284
<Separator />
285285
<MenuItem Header="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI, Key=CodeExplorer_Import}"
286286
Command="{Binding ImportCommand}"
287-
CommandParameter="{Binding SelectedItem}" />
287+
CommandParameter="{Binding SelectedItem}"
288+
Visibility="{Binding VBAVisibility}"/>
288289
<MenuItem Header="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI, Key=CodeExplorer_Export}"
289290
Command="{Binding ExportCommand}"
290291
CommandParameter="{Binding SelectedItem}"
@@ -295,7 +296,8 @@
295296
Visibility="{Binding ExportAllVisibility}" />
296297
<MenuItem Header="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI, Key=CodeExplorer_Remove}"
297298
Command="{Binding RemoveCommand}"
298-
CommandParameter="{Binding SelectedItem}">
299+
CommandParameter="{Binding SelectedItem}"
300+
Visibility="{Binding VBAVisibility}">
299301
<MenuItem.Icon>
300302
<Image Height="16" Source="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/minus-circle.png">
301303
<Image.Style>
@@ -310,7 +312,7 @@
310312
</Image>
311313
</MenuItem.Icon>
312314
</MenuItem>
313-
<Separator />
315+
<Separator Visibility="{Binding VBAVisibility}" />
314316
<MenuItem Header="{Resx ResxName=Rubberduck.Resources.CodeExplorer.CodeExplorerUI, Key=CodeExplorer_Print}"
315317
Command="{Binding PrintCommand}"
316318
CommandParameter="{Binding SelectedItem}">

Rubberduck.Core/UI/Command/ExportAllCommand.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Rubberduck.Navigation.CodeExplorer;
66
using Rubberduck.UI.CodeExplorer.Commands;
77
using Rubberduck.Resources;
8+
using Rubberduck.VBEditor.SafeComWrappers;
89

910
namespace Rubberduck.UI.Command
1011
{
@@ -22,6 +23,11 @@ public ExportAllCommand(IVBE vbe, IFolderBrowserFactory folderBrowserFactory) :
2223

2324
protected override bool EvaluateCanExecute(object parameter)
2425
{
26+
if (_vbe.Kind == VBEKind.Standalone)
27+
{
28+
return false;
29+
}
30+
2531
if (!(parameter is CodeExplorerProjectViewModel) && parameter is CodeExplorerItemViewModel)
2632
{
2733
return false;

0 commit comments

Comments
 (0)