Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/next' into CodeExplorer_Issue4…
Browse files Browse the repository at this point in the history
…541_resx_cleanup
  • Loading branch information
IvenBach committed Nov 3, 2020
2 parents 1775b34 + 54567b4 commit 3e94930
Show file tree
Hide file tree
Showing 46 changed files with 1,107 additions and 117 deletions.
6 changes: 6 additions & 0 deletions Rubberduck.Core/Rubberduck.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@
<Compile Update="UI\Refactorings\RenameFolder\RenameFolderView.xaml.cs">
<DependentUpon>RenameFolderView.xaml</DependentUpon>
</Compile>
<Compile Update="UI\Settings\IgnoredProjectsSettingsView.xaml.cs">
<DependentUpon>IgnoredProjectsSettingsView.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
Expand All @@ -142,6 +145,9 @@
<Generator>SettingsSingleFileGenerator</Generator>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="UI\IgnoredProjects\" />
</ItemGroup>
<!-- END WINDOWS FORMS WORKAROUND SECTION -->

</Project>
2 changes: 0 additions & 2 deletions Rubberduck.Core/Settings/HotkeySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using System.Linq;
using Rubberduck.Common.Hotkeys;
using Rubberduck.JunkDrawer.Extensions;
using Rubberduck.Parsing.VBA;
using Rubberduck.Parsing.VBA.Extensions;

namespace Rubberduck.Settings
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Rubberduck.Parsing.Settings;
using Rubberduck.SettingsProvider;
using Rubberduck.VBEditor.Events;
using Rubberduck.VBEditor.Extensions;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;

namespace Rubberduck.UI.Command.ComCommands
{
public class ProjectExplorerIgnoreProjectCommand : ComCommandBase
{
private readonly IVBE _vbe;
private readonly IConfigurationService<IgnoredProjectsSettings> _configService;

public ProjectExplorerIgnoreProjectCommand(IVbeEvents vbeEvents, IVBE vbe, IConfigurationService<IgnoredProjectsSettings> configService)
: base(vbeEvents)
{
_vbe = vbe;
_configService = configService;
AddToCanExecuteEvaluation(SpecialEvaluateCanExecute, true);
}

private bool SpecialEvaluateCanExecute(object parameter)
{
using (var activeProject = _vbe.ActiveVBProject)
{
if (activeProject == null
|| !activeProject.TryGetFullPath(out var fullPath))
{
return false;
}

var ignoredProjectPaths = _configService.Read().IgnoredProjectPaths;
return !ignoredProjectPaths.Contains(fullPath);
}
}

protected override void OnExecute(object parameter)
{
using (var activeProject = _vbe.ActiveVBProject)
{
if (activeProject == null
|| !activeProject.TryGetFullPath(out var fullPath))
{
return;
}

var ignoredProjectsSetting = _configService.Read();
if (!ignoredProjectsSetting.IgnoredProjectPaths.Contains(fullPath))
{
ignoredProjectsSetting.IgnoredProjectPaths.Add(fullPath);
_configService.Save(ignoredProjectsSetting);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Rubberduck.Parsing.Settings;
using Rubberduck.SettingsProvider;
using Rubberduck.VBEditor.Events;
using Rubberduck.VBEditor.Extensions;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;

namespace Rubberduck.UI.Command.ComCommands
{
public class ProjectExplorerUnignoreProjectCommand : ComCommandBase
{
private readonly IVBE _vbe;
private readonly IConfigurationService<IgnoredProjectsSettings> _configService;

public ProjectExplorerUnignoreProjectCommand(IVbeEvents vbeEvents, IVBE vbe, IConfigurationService<IgnoredProjectsSettings> configService)
: base(vbeEvents)
{
_vbe = vbe;
_configService = configService;
AddToCanExecuteEvaluation(SpecialEvaluateCanExecute, true);
}

private bool SpecialEvaluateCanExecute(object parameter)
{
using (var activeProject = _vbe.ActiveVBProject)
{
if (activeProject == null
|| !activeProject.TryGetFullPath(out var fullPath))
{
return false;
}

var ignoredProjectPaths = _configService.Read().IgnoredProjectPaths;
return ignoredProjectPaths.Contains(fullPath);
}
}

protected override void OnExecute(object parameter)
{
using (var activeProject = _vbe.ActiveVBProject)
{
if (activeProject == null
|| !activeProject.TryGetFullPath(out var fullPath))
{
return;
}

var ignoredProjectsSetting = _configService.Read();
if (ignoredProjectsSetting.IgnoredProjectPaths.Contains(fullPath))
{
ignoredProjectsSetting.IgnoredProjectPaths.Remove(fullPath);
_configService.Save(ignoredProjectsSetting);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ToolMenuAddRemoveReferencesCommandMenuItem : AddRemoveReferencesCom

public class ProjectExplorerAddRemoveReferencesCommandMenuItem : AddRemoveReferencesCommandMenuItemBase
{
public override int DisplayOrder => (int)RefactoringsMenuItemDisplayOrder.AddRemoveReferences;
public override int DisplayOrder => (int)ProjectExplorerContextMenuItemDisplayOrder.AddRemoveReferences;

public ProjectExplorerAddRemoveReferencesCommandMenuItem(AddRemoveReferencesCommand command) : base(command) { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,35 @@

namespace Rubberduck.UI.Command.MenuItems
{
public class FindAllImplementationsCommandMenuItem : CommandMenuItemBase
public abstract class FindAllImplementationsCommandMenuItemBase : CommandMenuItemBase
{
public FindAllImplementationsCommandMenuItem(FindAllImplementationsCommand command) : base(command)
{
}
protected FindAllImplementationsCommandMenuItemBase(FindAllImplementationsCommand command)
: base(command)
{}

public override string Key => "ContextMenu_GoToImplementation";
public override int DisplayOrder => (int)CodePaneContextMenuItemDisplayOrder.FindAllImplementations;

public override bool EvaluateCanExecute(RubberduckParserState state)
{
return state != null && Command.CanExecute(null);
}
}

public class FindAllImplementationsCommandMenuItem : FindAllImplementationsCommandMenuItemBase
{
public FindAllImplementationsCommandMenuItem(FindAllImplementationsCommand command)
: base(command)
{}

public override int DisplayOrder => (int)CodePaneContextMenuItemDisplayOrder.FindAllImplementations;
}

public class ProjectExplorerFindAllImplementationsCommandMenuItem : FindAllImplementationsCommandMenuItemBase
{
public ProjectExplorerFindAllImplementationsCommandMenuItem(FindAllImplementationsCommand command)
: base(command)
{}

public override int DisplayOrder => (int)ProjectExplorerContextMenuItemDisplayOrder.FindAllImplementations;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,37 @@

namespace Rubberduck.UI.Command.MenuItems
{
public class FindAllReferencesCommandMenuItem : CommandMenuItemBase
public abstract class FindAllReferencesCommandMenuItemBase : CommandMenuItemBase
{
public FindAllReferencesCommandMenuItem(FindAllReferencesCommand command)
protected FindAllReferencesCommandMenuItemBase(FindAllReferencesCommand command)
: base(command)
{
}
{}

public override string Key => "ContextMenu_FindAllReferences";
public override int DisplayOrder => (int) CodePaneContextMenuItemDisplayOrder.FindAllReferences;

public override bool EvaluateCanExecute(RubberduckParserState state)
{
return state != null && Command.CanExecute(null);
}
}


public class FindAllReferencesCommandMenuItem : FindAllReferencesCommandMenuItemBase
{
public FindAllReferencesCommandMenuItem(FindAllReferencesCommand command)
: base(command)
{}

public override int DisplayOrder => (int)CodePaneContextMenuItemDisplayOrder.FindAllReferences;
}


public class ProjectExplorerFindAllReferencesCommandMenuItem : FindAllReferencesCommandMenuItemBase
{
public ProjectExplorerFindAllReferencesCommandMenuItem(FindAllReferencesCommand command)
: base(command)
{}

public override int DisplayOrder => (int)ProjectExplorerContextMenuItemDisplayOrder.FindAllReferences;
}
}
26 changes: 21 additions & 5 deletions Rubberduck.Core/UI/Command/MenuItems/FindSymbolCommandMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@

namespace Rubberduck.UI.Command.MenuItems
{
public class FindSymbolCommandMenuItem : CommandMenuItemBase
public abstract class FindSymbolCommandMenuItemBase : CommandMenuItemBase
{
public FindSymbolCommandMenuItem(FindSymbolCommand command)
protected FindSymbolCommandMenuItemBase(FindSymbolCommand command)
: base(command)
{
}
{}

public override string Key => "ContextMenu_FindSymbol";
public override int DisplayOrder => (int)CodePaneContextMenuItemDisplayOrder.FindSymbol;
public override bool BeginGroup => true;

public override Image Image => Resources.CommandBarIcons.FindSymbol;
Expand All @@ -24,4 +22,22 @@ public override bool EvaluateCanExecute(RubberduckParserState state)
return state != null && state.Status >= ParserState.ResolvedDeclarations && state.Status < ParserState.Error;
}
}

public class FindSymbolCommandMenuItem : FindSymbolCommandMenuItemBase
{
public FindSymbolCommandMenuItem(FindSymbolCommand command)
: base(command)
{}

public override int DisplayOrder => (int)CodePaneContextMenuItemDisplayOrder.FindSymbol;
}

public class ProjectExplorerFindSymbolCommandMenuItem : FindSymbolCommandMenuItemBase
{
public ProjectExplorerFindSymbolCommandMenuItem(FindSymbolCommand command)
: base(command)
{}

public override int DisplayOrder => (int)ProjectExplorerContextMenuItemDisplayOrder.FindSymbol;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,15 @@ public ProjectWindowContextParentMenu(IEnumerable<IMenuItem> items, int beforeIn

public override bool BeginGroup => true;
}

public enum ProjectExplorerContextMenuItemDisplayOrder
{
RenameIdentifier,
FindSymbol,
FindAllReferences,
FindAllImplementations,
AddRemoveReferences,
IgnoreProject,
UnignoreProject
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Rubberduck.UI.Command.ComCommands;
using Rubberduck.UI.Command.MenuItems.ParentMenus;

namespace Rubberduck.UI.Command.MenuItems
{
public class ProjectExplorerIgnoreProjectCommandMenuItem : CommandMenuItemBase
{
public ProjectExplorerIgnoreProjectCommandMenuItem(ProjectExplorerIgnoreProjectCommand command)
: base(command)
{ }

public override string Key => "ProjectExplorer_IgnoreProject";
public override int DisplayOrder => (int)ProjectExplorerContextMenuItemDisplayOrder.IgnoreProject;
public override bool BeginGroup => true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ public class ProjectExplorerRefactorRenameCommandMenuItem : CommandMenuItemBase
{
public ProjectExplorerRefactorRenameCommandMenuItem(ProjectExplorerRefactorRenameCommand command)
: base(command)
{
}
{}

public override string Key => "RefactorMenu_Rename";
public override int DisplayOrder => (int)RefactoringsMenuItemDisplayOrder.RenameIdentifier;
public override int DisplayOrder => (int)ProjectExplorerContextMenuItemDisplayOrder.RenameIdentifier;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Rubberduck.UI.Command.ComCommands;
using Rubberduck.UI.Command.MenuItems.ParentMenus;

namespace Rubberduck.UI.Command.MenuItems
{
public class ProjectExplorerUnignoreProjectCommandMenuItem : CommandMenuItemBase
{
public ProjectExplorerUnignoreProjectCommandMenuItem(ProjectExplorerUnignoreProjectCommand command)
: base(command)
{ }

public override string Key => "ProjectExplorer_UnignoreProject";
public override int DisplayOrder => (int)ProjectExplorerContextMenuItemDisplayOrder.UnignoreProject;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ private void TransferViewToSettings(ReferenceSettings target)
target.FixBrokenReferences = FixBrokenReferences;
target.AddToRecentOnReferenceEvents = AddToRecentOnReferenceEvents;
target.ProjectPaths = new List<string>(ProjectPaths);
// ReSharper disable once ExplicitCallerInfoArgument
OnPropertyChanged("ProjectPaths");
OnPropertyChanged(nameof(ProjectPaths));
}

public void UpdateConfig(Configuration config)
Expand Down

0 comments on commit 3e94930

Please sign in to comment.