本文整理汇总了C#中MonoDevelop.Components.Commands.CommandArrayInfo类的典型用法代码示例。如果您正苦于以下问题:C# CommandArrayInfo类的具体用法?C# CommandArrayInfo怎么用?C# CommandArrayInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandArrayInfo类属于MonoDevelop.Components.Commands命名空间,在下文中一共展示了CommandArrayInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
protected override void Update(CommandArrayInfo info)
{
ResolverContextStack ctxt;
var rr = Resolver.DResolverWrapper.ResolveHoveredCode(out ctxt);
bool noRes = true;
if (rr != null && rr.Length > 0)
{
res = rr[rr.Length - 1];
n = DResolver.GetResultMember(res);
if (n != null)
{
noRes = false;
info.Add(IdeApp.CommandService.GetCommandInfo(RefactoryCommands.GotoDeclaration), new Action(GotoDeclaration));
info.Add(IdeApp.CommandService.GetCommandInfo(RefactoryCommands.FindReferences), new Action(FindReferences));
if (RenamingRefactoring.CanRename(n))
{
info.AddSeparator();
info.Add(IdeApp.CommandService.GetCommandInfo(EditCommands.Rename), new Action(RenameSymbol));
}
}
}
if(noRes)
info.Add(IdeApp.CommandService.GetCommandInfo(RefactoryCommands.ImportSymbol), new Action(ImportSymbol));
info.Add(IdeApp.CommandService.GetCommandInfo(Commands.OpenDDocumentation), new Action(OpenDDoc));
}
示例2: GenerateExecutionModeCommands
public static void GenerateExecutionModeCommands(SolutionEntityItem project, CanExecuteDelegate runCheckDelegate, CommandArrayInfo info)
{
CommandExecutionContext ctx = new CommandExecutionContext (project, runCheckDelegate);
bool supportsParameterization = false;
foreach (List<IExecutionMode> modes in GetExecutionModeCommands (ctx, false, true)) {
foreach (IExecutionMode mode in modes) {
CommandInfo ci = info.Add (mode.Name, new CommandItem (ctx, mode));
if ((mode.ExecutionHandler is ParameterizedExecutionHandler) || ((mode is CustomExecutionMode) && ((CustomExecutionMode)mode).PromptForParameters)) {
// It will prompt parameters, so we need command to end with '..'.
// However, some commands may end with '...' already and we don't want to break
// already-translated strings by altering them
if (!ci.Text.EndsWith ("..."))
ci.Text += "...";
supportsParameterization = true;
} else {
// The parameters window will be shown if ctrl is pressed
ci.Description = GettextCatalog.GetString ("Run With: {0}", ci.Text);
if (SupportsParameterization (mode, ctx)) {
ci.Description += " - " + GettextCatalog.GetString ("Hold Control key to display the execution parameters dialog.");
supportsParameterization = true;
}
}
}
if (info.Count > 0)
info.AddSeparator ();
}
if (supportsParameterization) {
info.AddSeparator ();
info.Add (GettextCatalog.GetString ("Edit Custom Modes..."), new CommandItem (ctx, null));
}
}
示例3: Update
protected override void Update(CommandArrayInfo info)
{
if (IdeApp.Workspace.IsOpen) {
info.Add("Default", "Default").Checked = !IsRoslynCompilerSet;
info.Add("Roslyn", "Roslyn").Checked = IsRoslynCompilerSet;
}
}
示例4: OnAddSpecialDirectoryUpdate
public void OnAddSpecialDirectoryUpdate (CommandArrayInfo info)
{
var proj = CurrentNode.DataItem as DotNetProject;
if (proj == null)
return;
var asp = proj.GetFlavor<AspNetAppProjectFlavor> ();
if (asp == null)
return;
List<string> dirs = new List<string> (asp.GetSpecialDirectories ());
dirs.Sort ();
List<FilePath> fullPaths = new List<FilePath> (dirs.Count);
foreach (string s in dirs)
fullPaths.Add (proj.BaseDirectory.Combine (s));
RemoveDirsNotInProject (fullPaths, proj);
if (fullPaths.Count == 0)
return;
foreach (string dir in dirs) {
if (!fullPaths.Contains (proj.BaseDirectory.Combine (dir)))
continue;
info.Add (dir.Replace("_", "__"), dir);
}
}
示例5: Update
protected override void Update (CommandArrayInfo ainfo)
{
var doc = IdeApp.Workbench.ActiveDocument;
if (doc == null || doc.FileName == FilePath.Null || doc.ParsedDocument == null)
return;
ResolveResult resolveResult;
AstNode node;
if (!ResolveAt (doc, out resolveResult, out node)) {
var location = RefactoringService.GetCorrectResolveLocation (doc, doc.Editor.Caret.Location);
resolveResult = GetHeuristicResult (doc, location, ref node);
if (resolveResult == null)
return;
}
var resolveMenu = new CommandInfoSet ();
resolveMenu.Text = GettextCatalog.GetString ("Resolve");
var possibleNamespaces = GetPossibleNamespaces (doc, node, ref resolveResult);
foreach (var t in possibleNamespaces.Where (tp => tp.OnlyAddReference)) {
var reference = t.Reference;
var info = resolveMenu.CommandInfos.Add (
t.GetImportText (),
new System.Action (new AddImport (doc, resolveResult, null, reference, true, node).Run)
);
info.Icon = MonoDevelop.Ide.Gui.Stock.AddNamespace;
}
bool addUsing = !(resolveResult is AmbiguousTypeResolveResult);
if (addUsing) {
foreach (var t in possibleNamespaces.Where (tp => tp.IsAccessibleWithGlobalUsing)) {
string ns = t.Namespace;
var reference = t.Reference;
var info = resolveMenu.CommandInfos.Add (
t.GetImportText (),
new System.Action (new AddImport (doc, resolveResult, ns, reference, true, node).Run)
);
info.Icon = MonoDevelop.Ide.Gui.Stock.AddNamespace;
}
}
bool resolveDirect = !(resolveResult is UnknownMemberResolveResult);
if (resolveDirect) {
if (resolveMenu.CommandInfos.Count > 0)
resolveMenu.CommandInfos.AddSeparator ();
if (node is ObjectCreateExpression)
node = ((ObjectCreateExpression)node).Type;
foreach (var t in possibleNamespaces) {
string ns = t.Namespace;
var reference = t.Reference;
resolveMenu.CommandInfos.Add (t.GetInsertNamespaceText (doc.Editor.GetTextBetween (node.StartLocation, node.EndLocation)), new System.Action (new AddImport (doc, resolveResult, ns, reference, false, node).Run));
}
}
if (resolveMenu.CommandInfos.Count > 0)
ainfo.Insert (0, resolveMenu);
}
示例6: Update
protected override void Update (CommandArrayInfo info)
{
MonoDevelop.Ide.Gui.Document document;
IList<FixableResult> results;
if (!GetFixes (out document, out results))
return;
PopulateInfos (info, document, results);
}
示例7: OnUpdateViewToolbar
protected void OnUpdateViewToolbar (CommandArrayInfo info)
{
foreach (IDockToolbar bar in Toolbars) {
CommandInfo cmd = new CommandInfo (bar.Title);
cmd.Checked = bar.Visible;
cmd.Description = AddinManager.CurrentLocalizer.GetString ("Show toolbar '{0}'", bar.Title);
info.Add (cmd, bar);
}
}
示例8: Update
protected override void Update (CommandArrayInfo info)
{
string group;
var lastListGroup = new Dictionary <CommandArrayInfo, string>();
var descFormat = GettextCatalog.GetString ("Show {0}");
foreach (Pad pad in IdeApp.Workbench.Pads.OrderBy (p => p.Group, StringComparer.InvariantCultureIgnoreCase)) {
CommandInfo ci = new CommandInfo(pad.Title);
ci.Icon = pad.Icon;
ci.UseMarkup = true;
ci.Description = string.Format (descFormat, pad.Title);
ActionCommand cmd = IdeApp.CommandService.GetActionCommand ("Pad|" + pad.Id);
if (cmd != null) ci.AccelKey = cmd.AccelKey;
CommandArrayInfo list = info;
if (pad.Categories != null) {
for (int j = 0; j < pad.Categories.Length; j++) {
bool found = false;
for (int k = list.Count - 1; k >= 0; k--) {
if (list[k].Text == pad.Categories[j] && list[k] is CommandInfoSet) {
list = ((CommandInfoSet)list[k]).CommandInfos;
found = true;
break;
}
}
if (!found) {
CommandInfoSet set = new CommandInfoSet();
set.Text = pad.Categories[j];
set.Description = string.Format (descFormat, set.Text);
list.Add (set);
list = set.CommandInfos;
}
}
}
int atIndex = 0;
for (int j = list.Count - 1; j >= 0; j--) {
if (!(list [j] is CommandInfoSet)) {
atIndex = j + 1;
break;
}
}
list.Insert (atIndex, ci, pad);
lastListGroup.TryGetValue (list, out group);
if (group != pad.Group) {
lastListGroup [list] = pad.Group;
if (atIndex > 0) {
CommandInfo sep = new CommandInfo ("-");
sep.IsArraySeparator = true;
list.Insert (atIndex, sep, null);
}
}
}
}
示例9: Update
protected override void Update(CommandArrayInfo info)
{
if (caps.Update ()) {
if (caps.resultResolutionAttempt != DResolver.NodeResolutionAttempt.RawSymbolLookup) {
var refactoringMenu = new CommandInfoSet { Text = GettextCatalog.GetString ("Refactoring") };
if(caps.lastResults.Any(t => t is DSymbol && DRenameRefactoring.CanRenameNode ((t as DSymbol).Definition)))
refactoringMenu.CommandInfos.Add (IdeApp.CommandService.GetCommandInfo (EditCommands.Rename), new Action (caps.RenameSymbol));
if (refactoringMenu.CommandInfos.Count > 0)
info.Add (refactoringMenu);
info.Add (IdeApp.CommandService.GetCommandInfo (RefactoryCommands.GotoDeclaration), new Action (caps.GotoDeclaration));
info.Add (IdeApp.CommandService.GetCommandInfo (RefactoryCommands.FindReferences), new Action (() => caps.FindReferences (false)));
if (caps.lastResults.Any (t => t is DSymbol && (t as DSymbol).Definition.Parent is DClassLike))
info.Add (IdeApp.CommandService.GetCommandInfo (RefactoryCommands.FindAllReferences), new Action (() => caps.FindReferences (true)));
if (caps.lastResults.Any (t => {
var ds = DResolver.StripMemberSymbols (t);
return ds is ClassType || ds is InterfaceType;
}))
info.Add (IdeApp.CommandService.GetCommandInfo (RefactoryCommands.FindDerivedClasses), new Action (caps.FindDerivedClasses));
} else {
var importSymbolMenu = new CommandInfoSet { Text = GettextCatalog.GetString ("Resolve") };
var alreadyAddedItems = new List<INode> ();
foreach (var t in caps.lastResults) {
var ds = t as DSymbol;
if (ds == null)
continue;
var m = ds.Definition.NodeRoot as DModule;
if (m != null && !alreadyAddedItems.Contains (m)) {
alreadyAddedItems.Add (m);
importSymbolMenu.CommandInfos.Add (new CommandInfo {
Text = "import " + AbstractNode.GetNodePath (m, true) + ";",
Icon = MonoDevelop.Ide.Gui.Stock.AddNamespace
}, new object[]{ "a", ds.Definition });
}
}
if (importSymbolMenu.CommandInfos.Count > 0) {
// To explicitly show the Ctrl+Alt+Space hint.
importSymbolMenu.CommandInfos.AddSeparator ();
importSymbolMenu.CommandInfos.Add (IdeApp.CommandService.GetCommandInfo (RefactoryCommands.ImportSymbol), new Action (caps.TryImportMissingSymbol));
info.Add (importSymbolMenu);
}
}
}
if(SortImportsCommandHandler.CanSortImports(caps.lastDoc))
info.Add (IdeApp.CommandService.GetCommandInfo (RefactoryCommands.SortImports), new Action(()=>SortImportsCommandHandler.SortImports(caps.lastDoc)));
}
示例10: Update
protected override void Update (CommandArrayInfo ainfo)
{
CommandInfo info = ainfo.Add (GettextCatalog.GetString ("_Errors & Warnings"), new Action (delegate {
MonoDevelop.Ide.IdeApp.Preferences.ShowMessageBubbles = MonoDevelop.Ide.ShowMessageBubbles.ForErrorsAndWarnings;
}));
info.Checked = MonoDevelop.Ide.IdeApp.Preferences.ShowMessageBubbles == MonoDevelop.Ide.ShowMessageBubbles.ForErrorsAndWarnings;
info = ainfo.Add (GettextCatalog.GetString ("E_rrors only"), new Action (delegate {
MonoDevelop.Ide.IdeApp.Preferences.ShowMessageBubbles = MonoDevelop.Ide.ShowMessageBubbles.ForErrors;
}));
info.Checked = MonoDevelop.Ide.IdeApp.Preferences.ShowMessageBubbles == MonoDevelop.Ide.ShowMessageBubbles.ForErrors;
}
示例11: Update
protected override void Update (CommandArrayInfo info)
{
GitRepository repo = Repository;
if (repo != null) {
string currentBranch = repo.GetCurrentBranch ();
foreach (Branch branch in repo.GetBranches ()) {
CommandInfo ci = info.Add (branch.Name, branch.Name);
if (branch.Name == currentBranch)
ci.Checked = true;
}
}
}
示例12: Update
protected override void Update (CommandArrayInfo ainfo)
{
ainfo.Add (NavigationBar.HideStatusBox ? GettextCatalog.GetString ("_Show Caret Panel") : GettextCatalog.GetString ("_Hide Caret Panel"), new System.Action (delegate {
IdeApp.Workbench.StatusBar.ClearCaretState ();
NavigationBar.HideStatusBox = !NavigationBar.HideStatusBox;
}));
if (!NavigationBar.HideStatusBox) {
ainfo.Add (StatusBox.ShowRealColumns ? GettextCatalog.GetString ("_Show logical caret position") : GettextCatalog.GetString ("_Show visual caret position") , new System.Action (delegate {
StatusBox.ShowRealColumns = !StatusBox.ShowRealColumns;
}));
}
}
示例13: Update
protected override void Update (CommandArrayInfo info)
{
foreach (ExternalTools.ExternalTool externalTool in ExternalTools.ExternalToolService.Tools) {
//Create CommandInfo object
CommandInfo commandInfo = new CommandInfo ();
commandInfo.Text = externalTool.MenuCommand;
commandInfo.Description = GettextCatalog.GetString ("Start tool") + " " + string.Join (string.Empty, externalTool.MenuCommand.Split('&'));
//Add menu item
info.Add (commandInfo, externalTool);
}
}
示例14: Update
protected override void Update (CommandArrayInfo info)
{
IWorkspaceObject wob = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem;
GitRepository repo = VersionControlService.GetRepository (wob) as GitRepository;
if (repo != null) {
string currentBranch = repo.GetCurrentBranch ();
foreach (string branch in repo.GetBranches ()) {
CommandInfo ci = info.Add (branch, branch);
if (branch == currentBranch)
ci.Checked = true;
}
}
}
示例15: Update
protected override void Update (CommandArrayInfo ainfo)
{
CommandInfo info = ainfo.Add (GettextCatalog.GetString ("E_rrors"), new Action (delegate {
IdeApp.Preferences.ShowMessageBubbles.Value = ShowMessageBubbles.ForErrors;
IdeApp.Preferences.DefaultHideMessageBubbles.Value = false;
}));
info.Checked = !IdeApp.Preferences.DefaultHideMessageBubbles && IdeApp.Preferences.ShowMessageBubbles.Value == ShowMessageBubbles.ForErrors;
info = ainfo.Add (GettextCatalog.GetString ("_Errors and Warnings"), new Action (delegate {
IdeApp.Preferences.ShowMessageBubbles.Value = ShowMessageBubbles.ForErrorsAndWarnings;
IdeApp.Preferences.DefaultHideMessageBubbles.Value = false;
}));
info.Checked = !IdeApp.Preferences.DefaultHideMessageBubbles && IdeApp.Preferences.ShowMessageBubbles == ShowMessageBubbles.ForErrorsAndWarnings;
}