当前位置: 首页>>代码示例>>C#>>正文


C# Commands.CommandArrayInfo类代码示例

本文整理汇总了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));
        }
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:32,代码来源:Commands.cs

示例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));
            }
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:32,代码来源:ExecutionModeCommandService.cs

示例3: Update

		protected override void Update(CommandArrayInfo info)
		{
			if (IdeApp.Workspace.IsOpen) {
				info.Add("Default", "Default").Checked = !IsRoslynCompilerSet;
				info.Add("Roslyn", "Roslyn").Checked = IsRoslynCompilerSet;
			}
		}
开发者ID:berlamont,项目名称:RoslynCompilerAddIn,代码行数:7,代码来源:SelectActiveCompilerHandler.cs

示例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);
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:26,代码来源:AspNetProjectNodeCommandHandler.cs

示例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);
		}
开发者ID:halleyxu,项目名称:monodevelop,代码行数:59,代码来源:ResolveCommandHandler.cs

示例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);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:8,代码来源:AnalysisCommands.cs

示例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);
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:9,代码来源:CommandFrame.cs

示例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);
					}
				}
			}
		}
开发者ID:pjcollins,项目名称:monodevelop,代码行数:56,代码来源:ViewCommands.cs

示例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)));
        }
开发者ID:foerdi,项目名称:Mono-D,代码行数:54,代码来源:ContextMenuRefactoringCommandHandler.cs

示例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;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:12,代码来源:MessageBubbleCommands.cs

示例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;
				}
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:12,代码来源:Commands.cs

示例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;
				}));
			}
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:13,代码来源:NavigationBarCommands.cs

示例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);

			}
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:13,代码来源:ToolsCommands.cs

示例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;
				}
			}
		}
开发者ID:acken,项目名称:monodevelop,代码行数:13,代码来源:Commands.cs

示例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;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:14,代码来源:MessageBubbleCommands.cs


注:本文中的MonoDevelop.Components.Commands.CommandArrayInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。