本文整理汇总了C#中MonoDevelop.Components.Commands.CommandArrayInfo.Add方法的典型用法代码示例。如果您正苦于以下问题:C# CommandArrayInfo.Add方法的具体用法?C# CommandArrayInfo.Add怎么用?C# CommandArrayInfo.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Components.Commands.CommandArrayInfo
的用法示例。
在下文中一共展示了CommandArrayInfo.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
protected override void Update(CommandArrayInfo info)
{
if (IdeApp.Workspace.IsOpen) {
info.Add("Default", "Default").Checked = !IsRoslynCompilerSet;
info.Add("Roslyn", "Roslyn").Checked = IsRoslynCompilerSet;
}
}
示例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)
{
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));
}
示例4: 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)));
}
示例5: 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;
}
示例6: 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;
}));
}
}
示例7: Update
protected override void Update (CommandArrayInfo info)
{
if (DbFactoryService.DbFactoryCount > 0) {
foreach (IDbFactory fac in DbFactoryService.DbFactories) {
CommandInfo cmd = new CommandInfo (fac.Name);
cmd.Icon = "md-db-database";
info.Add (cmd, fac);
}
} else {
CommandInfo cmd = new CommandInfo (AddinCatalog.GetString ("No database providers detected."));
cmd.Enabled = false;
info.Add (cmd, null);
}
}
示例8: 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;
}
示例9: 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);
}
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: 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;
}
}
}
示例13: Update
protected override void Update (CommandArrayInfo info)
{
var proj = IdeApp.ProjectOperations.CurrentSelectedProject as IPhoneProject;
if (proj == null)
return;
var workspaceConfig = IdeApp.Workspace.ActiveConfigurationId;
var conf = proj.GetConfiguration (new SolutionConfigurationSelector (workspaceConfig)) as IPhoneProjectConfiguration;
if (conf == null || conf.Platform != IPhoneProject.PLAT_SIM)
return;
var projSetting = proj.GetSimulatorTarget (conf);
var def = info.Add ("Default", null);
if (projSetting == null)
def.Checked = true;
foreach (var st in IPhoneFramework.GetSimulatorTargets (IPhoneSdkVersion.Parse (conf.MtouchMinimumOSVersion), proj.SupportedDevices)) {
var i = info.Add (st.ToString (), st);
if (projSetting != null && projSetting.Equals (st))
i.Checked = true;
}
}
示例14: Update
protected override void Update (CommandArrayInfo info)
{
var proj = DefaultUploadToDeviceHandler.GetActiveExecutableMonoDroidProject ();
if (proj == null || !MonoDroidFramework.HasAndroidJavaSdks)
return;
var conf = (MonoDroidProjectConfiguration) proj.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
var projSetting = proj.GetDeviceTarget (conf);
foreach (var st in MonoDroidFramework.DeviceManager.Devices) {
var i = info.Add (st.ID, st);
if (projSetting != null && projSetting.Equals (st))
i.Checked = true;
}
}
示例15: Update
protected override void Update(CommandArrayInfo info)
{
var project = IdeApp.ProjectOperations.CurrentSelectedProject as DnxProject;
if (project == null) {
info.Bypass = true;
return;
}
foreach (DnxFramework framework in project.GetFrameworks ()) {
CommandInfo item = info.Add (framework.FriendlyName, framework);
if (framework.Name == project.CurrentFramework) {
item.Checked = true;
}
}
}