1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
6
using System.Windows.Forms;
8
using Hornung.ResourceToolkit.Gui;
9
using Hornung.ResourceToolkit.Refactoring;
10
using ICSharpCode.Core;
11
using ICSharpCode.SharpDevelop.Gui;
12
using ICSharpCode.SharpDevelop.Refactoring;
14
namespace Hornung.ResourceToolkit.Commands
16
public static class FindMissingResourceKeysHelper
18
public static void Run(SearchScope scope) {
19
// Allow the menu to close
20
Application.DoEvents();
21
using(AsynchronousWaitDialog monitor = AsynchronousWaitDialog.ShowWaitDialog("${res:Hornung.ResourceToolkit.FindMissingResourceKeys}")) {
22
FindReferencesAndRenameHelper.ShowAsSearchResults(StringParser.Parse("${res:Hornung.ResourceToolkit.ReferencesToMissingKeys}"),
23
ResourceRefactoringService.FindReferencesToMissingKeys(monitor, scope));
29
/// Find missing resource keys in the whole solution.
31
public class FindMissingResourceKeysWholeSolutionCommand : AbstractMenuCommand
33
public override void Run()
35
FindMissingResourceKeysHelper.Run(SearchScope.WholeSolution);
40
/// Find missing resource keys in the current project.
42
public class FindMissingResourceKeysCurrentProjectCommand : AbstractMenuCommand
44
public override void Run()
46
FindMissingResourceKeysHelper.Run(SearchScope.CurrentProject);
51
/// Find missing resource keys in the current file.
53
public class FindMissingResourceKeysCurrentFileCommand : AbstractMenuCommand
55
public override void Run()
57
FindMissingResourceKeysHelper.Run(SearchScope.CurrentFile);
62
/// Find missing resource keys in all open files.
64
public class FindMissingResourceKeysOpenFilesCommand : AbstractMenuCommand
66
public override void Run()
68
FindMissingResourceKeysHelper.Run(SearchScope.OpenFiles);
73
/// Find unused resource keys in the whole solution.
75
public class FindUnusedResourceKeysCommand : AbstractMenuCommand
77
public override void Run()
79
ICollection<ResourceItem> unusedKeys;
81
// Allow the menu to close
82
Application.DoEvents();
83
using(AsynchronousWaitDialog monitor = AsynchronousWaitDialog.ShowWaitDialog("${res:Hornung.ResourceToolkit.FindUnusedResourceKeys}")) {
84
unusedKeys = ResourceRefactoringService.FindUnusedKeys(monitor);
87
if (unusedKeys == null) {
91
if (unusedKeys.Count == 0) {
92
MessageService.ShowMessage("${res:Hornung.ResourceToolkit.UnusedResourceKeys.NotFound}");
96
IWorkbench workbench = WorkbenchSingleton.Workbench;
97
if (workbench != null) {
98
UnusedResourceKeysViewContent vc = new UnusedResourceKeysViewContent(unusedKeys);
99
workbench.ShowView(vc);