-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Added command to access Search Declaration menu in the Navi Bar
- Loading branch information
Showing
7 changed files
with
94 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.ComponentModel.Design; | ||
using Microsoft.VisualStudio.Shell; | ||
|
||
namespace Codist.Commands | ||
{ | ||
/// <summary> | ||
/// Command handler | ||
/// </summary> | ||
internal static class NaviBarSearchDeclarationCommand | ||
{ | ||
/// <summary> | ||
/// Command ID. | ||
/// </summary> | ||
public const int CommandId = 4130; | ||
|
||
/// <summary> | ||
/// Command menu group (command set GUID). | ||
/// </summary> | ||
public static readonly Guid CommandSet = new Guid("5EF88028-C0FC-4849-9883-10F4BD2217B3"); | ||
|
||
public static void Initialize(AsyncPackage package) { | ||
var menuItem = new OleMenuCommand(Execute, new CommandID(CommandSet, CommandId)); | ||
menuItem.BeforeQueryStatus += (s, args) => { | ||
ThreadHelper.ThrowIfNotOnUIThread(); | ||
var c = s as OleMenuCommand; | ||
c.Enabled = CodistPackage.DTE.ActiveDocument != null; | ||
}; | ||
CodistPackage.MenuService.AddCommand(menuItem); | ||
} | ||
|
||
static void Execute(object sender, EventArgs e) { | ||
ThreadHelper.ThrowIfNotOnUIThread(); | ||
var doc = CodistPackage.DTE.ActiveDocument; | ||
if (doc == null) { | ||
return; | ||
} | ||
var docWindow = CodistPackage.Instance.GetActiveWpfDocumentView(); | ||
if (docWindow == null | ||
|| docWindow.Properties.TryGetProperty<NaviBar.CSharpBar>(nameof(NaviBar), out var bar) == false) { | ||
return; | ||
} | ||
bar.ShowRootItemMenu(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters