diff options
author | Lluis Sanchez <lluis@novell.com> | 2010-05-28 13:52:27 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2010-05-28 13:52:27 +0400 |
commit | 68161149fe10e9e975a70727fe353e416f573e18 (patch) | |
tree | 761420e7e56d5f6536ef1111f832e553219fb98e /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution | |
parent | d5b298c9e8e94484d53471fec2e973df6be3c390 (diff) |
* MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs: Don't
show the parameterization options if none of the supported execution
modes is parameterizable. Fixes bug #609679 - Unable to Set Custom
Execution Commands for ASP.NET projects.
svn path=/trunk/monodevelop/; revision=158098
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs index e60aa84d06..0c53a72576 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs @@ -27,6 +27,7 @@ using System; using System.IO; using System.Collections.Generic; +using System.Linq; using MonoDevelop.Components.Commands; using MonoDevelop.Core.Execution; using MonoDevelop.Core; @@ -63,6 +64,7 @@ namespace MonoDevelop.Ide.Execution 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) { @@ -73,15 +75,20 @@ namespace MonoDevelop.Ide.Execution // 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 = ci.Text + " - " + GettextCatalog.GetString ("Hold Control key to display the execution parameters dialog."); + 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 (info.Count > 0) { + if (supportsParameterization) { info.AddSeparator (); info.Add (GettextCatalog.GetString ("Edit Custom Modes..."), new CommandItem (ctx, null)); } @@ -117,6 +124,13 @@ namespace MonoDevelop.Ide.Execution return item.Mode.ExecutionHandler; } + static bool SupportsParameterization (IExecutionMode mode, CommandExecutionContext ctx) + { + if (ExecutionModeCommandService.GetExecutionCommandCustomizers (ctx).Any ()) + return true; + return mode.ExecutionHandler is ParameterizedExecutionHandler; + } + internal static List<List<IExecutionMode>> GetExecutionModeCommands (CommandExecutionContext ctx, bool includeDefault, bool includeDefaultCustomizer) { List<List<IExecutionMode>> itemGroups = new List<List<IExecutionMode>> (); @@ -132,7 +146,7 @@ namespace MonoDevelop.Ide.Execution setModes.Add (mode.Id); if (mode.Id != "Default" || includeDefault) items.Add (mode); - if (mode.Id == "Default" && includeDefaultCustomizer) { + if (mode.Id == "Default" && includeDefaultCustomizer && SupportsParameterization (mode, ctx)) { CustomExecutionMode cmode = new CustomExecutionMode (); cmode.Mode = mode; cmode.Project = ctx.Project; @@ -237,8 +251,8 @@ namespace MonoDevelop.Ide.Execution CommandItem other = obj as CommandItem; if (other == null) return false; - if ((Mode == null || other.Mode == null) && Mode != other.Mode) - return false; + if (Mode == null || other.Mode == null) + return Mode == other.Mode; return other.Mode.Id == Mode.Id; } |