コード例 #1
0
        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));
            }
        }
コード例 #2
0
		internal IProcessAsyncOperation InternalExecute (CommandExecutionContext ctx, IExecutionMode mode, ExecutionCommand command, IConsole console)
		{
			CustomExecutionMode cmode = ExecutionModeCommandService.ShowParamtersDialog (ctx, mode, null);
			if (cmode == null)
				return new CancelledProcessAsyncOperation ();
			
			return cmode.Execute (command, console, false, false);
		}
コード例 #3
0
		internal static IEnumerable<ExecutionCommandCustomizer> GetExecutionCommandCustomizers (CommandExecutionContext ctx)
		{
			ExecutionCommand cmd = ctx.GetTargetCommand ();
			if (cmd == null)
				yield break;
			foreach (ExecutionCommandCustomizer customizer in AddinManager.GetExtensionNodes ("/MonoDevelop/Ide/ExecutionCommandEditors", typeof(ExecutionCommandCustomizer))) {
				if (customizer.CanCustomize (cmd))
					yield return customizer;
			}
		}
コード例 #4
0
		public Gtk.Widget Load (CommandExecutionContext ctx, object data)
		{
			if (data != null) {
				CustomArgsExecutionModeData cdata = (CustomArgsExecutionModeData) data;
				entryArgs.Text = cdata.Arguments;
				folderEntry.Path = cdata.WorkingDirectory;
				envVarList.LoadValues (cdata.EnvironmentVariables);
			}
			return this;
		}
コード例 #5
0
		public Gtk.Widget Load (CommandExecutionContext ctx, object data)
		{
			config = (MonoExecutionParameters) data;
			if (config != null)
				config = config.Clone ();
			else
				config = new MonoExecutionParameters ();
			propertyGrid.CurrentObject = config;
			
			return this;
		}
コード例 #6
0
		public void Load (CommandExecutionContext ctx, bool includeDefault, bool includeDefaultCustomizer, ExecutionModeIncludeFilter filter)
		{
			bool separate = false;
			foreach (List<IExecutionMode> modeList in ExecutionModeCommandService.GetExecutionModeCommands (ctx, includeDefault, includeDefaultCustomizer)) {
				bool addedSome = false;
				foreach (IExecutionMode mode in modeList) {
					if (filter == null || filter (mode)) {
						if (separate) {
							modes.Add (null);
							comboMode.AppendText ("--");
							separate = false;
						}
						modes.Add (mode);
						comboMode.AppendText (mode.Name);
						addedSome = true;
					}
				}
				separate = addedSome;
			}
		}
コード例 #7
0
		public CustomExecutionModeManagerDialog (CommandExecutionContext ctx)
		{
			this.Build ();
			
			this.ctx = ctx;
			
			store = new Gtk.ListStore (typeof(CustomExecutionMode), typeof(string), typeof(string), typeof(string), typeof(string));
			listModes.Model = store;
			
			Gtk.CellRendererText crt = new Gtk.CellRendererText ();
			listModes.AppendColumn (GettextCatalog.GetString ("Name"), crt, "text", 1);
			listModes.AppendColumn (GettextCatalog.GetString ("Execution Mode"), crt, "text", 2);
			listModes.AppendColumn (GettextCatalog.GetString ("Available for"), crt, "text", 3);
			
			listModes.Selection.Changed += delegate {
				UpdateButtons ();
			};
			
			treeState = new TreeViewState (listModes, 4);
			
			Fill ();
		}
コード例 #8
0
		public void Initialize (CommandExecutionContext ctx, IExecutionMode modeToExecute, CustomExecutionMode data)
		{
			this.ctx = ctx;
			
			this.data = data;
			if (this.data == null)
				this.data = new CustomExecutionMode ();
			
			if (modeToExecute != null) {
				// The user is running the project and the selected mode requires arguments
				comboTargetMode.Load (ctx, true, false);
				comboTargetMode.SelectedMode = modeToExecute;
				mode = modeToExecute;
				editMode = false;
				buttonOk.Label = Gtk.Stock.Execute;
			}
			else if (data != null) {
				// Editing an existing custom mode
				comboTargetMode.Load (ctx, true, false);
				mode = comboTargetMode.SelectedMode = data.Mode;
				checkSave.Visible = false;
				checkPrompt.Visible = boxName.Visible = true;
				checkPrompt.Active = data.PromptForParameters;
				entryModeName.Text = data.Name;
				comboStore.Active = (int) data.Scope;
			}
			else {
				// Creating a new mode
				comboTargetMode.Load (ctx, true, false);
				comboTargetMode.SelectedMode = null;
				checkSave.Visible = false;
				boxName.Visible = true;
				checkPrompt.Visible = true;
				buttonOk.Sensitive = false; // Until name is intered
			}
			LoadEditors ();
			nameChanged = false;
		}
コード例 #9
0
        public override IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console, CommandExecutionContext ctx, object config_data)
        {
            DotNetExecutionCommand dnec = command as DotNetExecutionCommand;

            ProfileConfiguration config = new ProfileConfiguration ();
            config.TargetPath = command.CommandString;
            ProfilerExecutionOptions options = config_data as ProfilerExecutionOptions;
            if (options != null) {
                config.StartEnabled = options.StartEnabled;
                config.Mode = options.Mode;
            }

            string logfile = System.IO.Path.GetTempFileName () + ".mprof";
            ProfilerSocket socket = new ProfilerSocket ();
            ProfilerViewContent view = new ProfilerViewContent ();
            socket.Paused += delegate { view.Load (logfile); };
            dnec.RuntimeArguments += String.Format (" --profile=logging:{0},o={1},cp={2}", config.ToArgs (), logfile, socket.Port);
            IExecutionHandler h = Runtime.ProcessService.GetDefaultExecutionHandler (command);
            IProcessAsyncOperation result = h.Execute (command, console);
            result.Completed += delegate { view.Load (logfile); };
            Gtk.Application.Invoke (delegate { IdeApp.Workbench.OpenDocument (view, true); });
            return result;
        }
コード例 #10
0
 public CommandItem(CommandExecutionContext context, IExecutionMode mode)
 {
     Context = context;
     Mode    = mode;
 }
コード例 #11
0
 public CommandItem(CommandExecutionContext context, IExecutionMode mode)
 {
     Context = context;
     Mode = mode;
 }
コード例 #12
0
 static bool SupportsParameterization(IExecutionMode mode, CommandExecutionContext ctx)
 {
     if (ExecutionModeCommandService.GetExecutionCommandCustomizers (ctx).Any ())
         return true;
     return mode.ExecutionHandler is ParameterizedExecutionHandler;
 }
コード例 #13
0
        internal static CustomExecutionMode ShowParamtersDialog(CommandExecutionContext ctx, IExecutionMode mode, CustomExecutionMode currentMode)
        {
            CustomExecutionMode cmode = null;

            DispatchService.GuiSyncDispatch (delegate {
                CustomExecutionModeDialog dlg = new CustomExecutionModeDialog ();
                try {
                    dlg.Initialize (ctx, mode, currentMode);
                    if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
                        cmode = dlg.GetConfigurationData ();
                        cmode.Project = ctx.Project;
                        if (dlg.Save)
                            SaveCustomCommand (ctx.Project, cmode);
                    }
                } finally {
                    dlg.Destroy ();
                }
            });
            return cmode;
        }
コード例 #14
0
 /// <summary>
 /// Runs a command
 /// </summary>
 /// <param name="command">
 /// Command to run
 /// </param>
 /// <param name="console">
 /// The console where to redirect the output
 /// </param>
 /// <param name="ctx">
 /// Context with execution information
 /// </param>
 /// <param name="configurationData">
 /// Configuration information. Created by the IExecutionConfigurationEditor object.
 /// </param>
 public abstract IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console, CommandExecutionContext ctx, object configurationData);
コード例 #15
0
        internal static List <List <IExecutionMode> > GetExecutionModeCommands(CommandExecutionContext ctx, bool includeDefault, bool includeDefaultCustomizer)
        {
            List <List <IExecutionMode> > itemGroups = new List <List <IExecutionMode> > ();

            List <CustomExecutionMode> customModes = new List <CustomExecutionMode> (GetCustomModes(ctx));

            foreach (IExecutionModeSet mset in Runtime.ProcessService.GetExecutionModes())
            {
                List <IExecutionMode> items    = new List <IExecutionMode> ();
                HashSet <string>      setModes = new HashSet <string> ();
                foreach (IExecutionMode mode in mset.ExecutionModes)
                {
                    if (!ctx.CanExecute(mode.ExecutionHandler))
                    {
                        continue;
                    }
                    setModes.Add(mode.Id);
                    if (mode.Id != "Default" || includeDefault)
                    {
                        items.Add(mode);
                    }
                    if (mode.Id == "Default" && includeDefaultCustomizer && SupportsParameterization(mode, ctx))
                    {
                        CustomExecutionMode cmode = new CustomExecutionMode();
                        cmode.Mode                = mode;
                        cmode.Project             = ctx.Project;
                        cmode.PromptForParameters = true;
                        cmode.Name                = GettextCatalog.GetString("Custom Parameters...");
                        items.Add(cmode);
                    }
                }
                List <CustomExecutionMode> toRemove = new List <CustomExecutionMode> ();
                foreach (CustomExecutionMode cmode in customModes)
                {
                    if (setModes.Contains(cmode.Mode.Id))
                    {
                        if (ctx.CanExecute(cmode.Mode.ExecutionHandler))
                        {
                            items.Add(cmode);
                        }
                        toRemove.Add(cmode);
                    }
                }
                foreach (CustomExecutionMode cmode in toRemove)
                {
                    customModes.Remove(cmode);
                }

                if (items.Count > 0)
                {
                    itemGroups.Add(items);
                }
            }

            if (customModes.Count > 0)
            {
                List <IExecutionMode> items = new List <IExecutionMode> ();
                foreach (CustomExecutionMode cmode in customModes)
                {
                    if (ctx.CanExecute(cmode.ExecutionHandler))
                    {
                        items.Add(cmode);
                    }
                }
                if (items.Count > 0)
                {
                    itemGroups.Add(items);
                }
            }
            return(itemGroups);
        }
コード例 #16
0
        public static void GenerateExecutionModeCommands(SolutionItem 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();
                }
            }

            var targets = new List <ExecutionTarget> ();

            if (project != null)
            {
                FlattenExecutionTargets(targets, project.GetExecutionTargets(IdeApp.Workspace.ActiveConfiguration));
            }

            if (targets.Count > 1)
            {
                foreach (var t in targets)
                {
                    var         h  = new TargetedExecutionHandler(Runtime.ProcessService.DefaultExecutionHandler, t);
                    CommandInfo ci = info.Add(t.FullName, new CommandItem(ctx, new ExecutionMode(t.Id, t.FullName, h)));
                    ci.Description = GettextCatalog.GetString("Run With: {0}", ci.Text);
                }
                info.AddSeparator();
            }

            if (supportsParameterization)
            {
                info.AddSeparator();
                info.Add(GettextCatalog.GetString("Edit Custom Modes..."), new CommandItem(ctx, null));
            }
        }
コード例 #17
0
        internal static IEnumerable <ExecutionCommandCustomizer> GetExecutionCommandCustomizers(CommandExecutionContext ctx)
        {
            ExecutionCommand cmd = ctx.GetTargetCommand();

            if (cmd == null)
            {
                yield break;
            }
            foreach (ExecutionCommandCustomizer customizer in AddinManager.GetExtensionNodes("/MonoDevelop/Ide/ExecutionCommandEditors", typeof(ExecutionCommandCustomizer)))
            {
                if (customizer.CanCustomize(cmd))
                {
                    yield return(customizer);
                }
            }
        }
コード例 #18
0
		internal bool Resolve (IRunTarget item)
		{
			if (RunConfiguration != null && Mode != null)
				return true;
			RunConfiguration = item.GetRunConfigurations ().FirstOrDefault (co => co.Id == runConfigurationId);
			if (RunConfiguration == null)
				return false;
			var ctx = new CommandExecutionContext (item, h => item.CanExecute (new MonoDevelop.Projects.ExecutionContext (h, null, IdeApp.Workspace.ActiveExecutionTarget), IdeApp.Workspace.ActiveConfiguration, RunConfiguration));
			IExecutionModeSet modeSet;
			IExecutionMode mode;
			if (!ExecutionModeCommandService.GetExecutionMode (ctx, executionModeId, out modeSet, out mode))
				return false;
			ModeSet = modeSet;
			Mode = mode;
			return true;
		}
コード例 #19
0
		public void Load (CommandExecutionContext ctx, bool includeDefault, bool includeDefaultCustomizer)
		{
			Load (ctx, includeDefault, includeDefaultCustomizer, null);
		}
コード例 #20
0
		internal static bool GetExecutionMode (CommandExecutionContext ctx, string id, out IExecutionModeSet modeSet, out IExecutionMode mode)
		{
			foreach (IExecutionModeSet mset in Runtime.ProcessService.GetExecutionModes ()) {
				foreach (IExecutionMode m in mset.ExecutionModes) {
					if (m.Id == id && ctx.CanExecute (m.ExecutionHandler)) {
						modeSet = mset;
						mode = m;
						return true;
					}
				}
			}
			modeSet = null;
			mode = null;
			return false;
		}
コード例 #21
0
		void LoadModes ()
		{
			storeModes.Clear ();
			var currentMode = SelectedExecutionMode;
			bool nodeSelected = false;
			var ctx = new CommandExecutionContext (item, h => item.CanExecute (new ExecutionContext (h, null, IdeApp.Workspace.ActiveExecutionTarget), IdeApp.Workspace.ActiveConfiguration, SelectedConfiguration));
			foreach (var modeSet in Runtime.ProcessService.GetExecutionModes ()) {
				TreeNavigator setNode = null;
				foreach (var mode in modeSet.ExecutionModes) {
					if (ctx.CanExecute (mode.ExecutionHandler)) {
						if (setNode == null) {
							setNode = storeModes.AddNode ();
							setNode.SetValue (modeNameField, modeSet.Name);
							setNode.SetValue (modeField, mode);
							setNode.SetValue (modeSetField, modeSet);
							if (mode.Id == currentMode?.Id) {
								treeModes.SelectRow (setNode.CurrentPosition);
								nodeSelected = true;
							}
						}
						var node = storeModes.AddNode (setNode.CurrentPosition);
						node.SetValue (modeNameField, mode.Name);
						node.SetValue (modeField, mode);
						node.SetValue (modeSetField, modeSet);
						if (!nodeSelected && mode.Id == currentMode?.Id) {
							treeModes.SelectRow (node.CurrentPosition);
							nodeSelected = true;
						}
					}
				}
				// If the mode only has one child, remove it, we don't need to show it
				if (setNode != null && setNode.MoveToChild ()) {
					var pos = setNode.Clone ();
					if (!setNode.MoveNext ())
						pos.Remove ();
				}
			}
			if (!nodeSelected && storeModes.GetFirstNode ()?.CurrentPosition != null)
				treeModes.SelectRow (storeModes.GetFirstNode ().CurrentPosition);
		}
コード例 #22
0
		/// <summary>
		/// Runs a command
		/// </summary>
		/// <param name="command">
		/// Command to run
		/// </param>
		/// <param name="console">
		/// The console where to redirect the output
		/// </param>
		/// <param name="ctx">
		/// Context with execution information
		/// </param>
		/// <param name="configurationData">
		/// Configuration information. Created by the IExecutionConfigurationEditor object.
		/// </param>
		public abstract IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console, CommandExecutionContext ctx, object configurationData);
コード例 #23
0
 public static IExecutionMode GetExecutionMode(CommandExecutionContext ctx, string id)
 {
     foreach (IExecutionMode mode in GetExecutionModes (ctx)) {
         if (mode.Id == id)
             return mode;
     }
     return null;
 }
コード例 #24
0
        public static IEnumerable<IExecutionMode> GetExecutionModes(CommandExecutionContext ctx)
        {
            foreach (IExecutionModeSet mset in Runtime.ProcessService.GetExecutionModes ()) {
                foreach (IExecutionMode mode in mset.ExecutionModes) {
                    if (ctx.CanExecute (mode.ExecutionHandler))
                        yield return mode;
                }
            }

            foreach (CustomExecutionMode mode in GetCustomModes (ctx)) {
                if (ctx.CanExecute (mode))
                    yield return mode;
            }
        }
コード例 #25
0
		List<ExecutionConfiguration> GetExecutionConfigurations ()
		{
			var ctx = new CommandExecutionContext (project, h => project.CanExecute (new ExecutionContext (h, null, IdeApp.Workspace.ActiveExecutionTarget), IdeApp.Workspace.ActiveConfiguration, runConfig));
			var res = new List<ExecutionConfiguration> ();
			foreach (var modeSet in Runtime.ProcessService.GetExecutionModes ()) {
				foreach (var mode in modeSet.ExecutionModes) {
					if (ctx.CanExecute (mode.ExecutionHandler))
						res.Add (new ExecutionConfiguration (runConfig, modeSet, mode));
				}
			}
			return res;
		}
コード例 #26
0
 internal static IEnumerable<CustomExecutionMode> GetCustomModes(CommandExecutionContext ctx)
 {
     if (ctx.Project != null) {
         CustomExecutionModes modes = ctx.Project.UserProperties.GetValue<CustomExecutionModes> ("MonoDevelop.Ide.CustomExecutionModes", GetDataContext ());
         if (modes != null) {
             foreach (CustomExecutionMode mode in modes.Data) {
                 mode.Project = ctx.Project;
                 if (ctx.CanExecute (mode.ExecutionHandler)) {
                     mode.Scope = CustomModeScope.Project;
                     yield return mode;
                 }
             }
         }
         modes = ctx.Project.ParentSolution.UserProperties.GetValue<CustomExecutionModes> ("MonoDevelop.Ide.CustomExecutionModes", GetDataContext ());
         if (modes != null) {
             foreach (CustomExecutionMode mode in modes.Data) {
                 mode.Project = ctx.Project;
                 if (ctx.CanExecute (mode.ExecutionHandler)) {
                     mode.Scope = CustomModeScope.Solution;
                     yield return mode;
                 }
             }
         }
     }
     foreach (CustomExecutionMode mode in GetGlobalCustomExecutionModes ().Data) {
         if (ctx.CanExecute (mode.ExecutionHandler)) {
             mode.Scope = CustomModeScope.Global;
             yield return mode;
         }
     }
 }
コード例 #27
0
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console, bool allowPrompt, bool forcePrompt)
		{
			if ((PromptForParameters || forcePrompt) && allowPrompt) {
				var ctx = new CommandExecutionContext (Project, command);
				CustomExecutionMode customMode = ExecutionModeCommandService.ShowParamtersDialog (ctx, Mode, this);
				if (customMode == null)
					return new CancelledProcessAsyncOperation ();
				return customMode.Execute (command, console, false, false);
			}

			foreach (var cc in GetCachedCustomizers ()) {
				cc.Item1.Customize (command, cc.Item2);
			}

			var cmode = Mode.ExecutionHandler as ParameterizedExecutionHandler;
			if (cmode != null) {
				CommandExecutionContext ctx = new CommandExecutionContext (Project, command);
				return cmode.Execute (command, console, ctx, Data);
			}

			return Mode.ExecutionHandler.Execute (command, console);
		}
コード例 #28
0
        internal static List<List<IExecutionMode>> GetExecutionModeCommands(CommandExecutionContext ctx, bool includeDefault, bool includeDefaultCustomizer)
        {
            List<List<IExecutionMode>> itemGroups = new List<List<IExecutionMode>> ();

            List<CustomExecutionMode> customModes = new List<CustomExecutionMode> (GetCustomModes (ctx));

            foreach (IExecutionModeSet mset in Runtime.ProcessService.GetExecutionModes ()) {
                List<IExecutionMode> items = new List<IExecutionMode> ();
                HashSet<string> setModes = new HashSet<string> ();
                foreach (IExecutionMode mode in mset.ExecutionModes) {
                    if (!ctx.CanExecute (mode.ExecutionHandler))
                        continue;
                    setModes.Add (mode.Id);
                    if (mode.Id != "Default" || includeDefault)
                        items.Add (mode);
                    if (mode.Id == "Default" && includeDefaultCustomizer && SupportsParameterization (mode, ctx)) {
                        CustomExecutionMode cmode = new CustomExecutionMode ();
                        cmode.Mode = mode;
                        cmode.Project = ctx.Project;
                        cmode.PromptForParameters = true;
                        cmode.Name = GettextCatalog.GetString ("Custom Parameters...");
                        items.Add (cmode);
                    }
                }
                List<CustomExecutionMode> toRemove = new List<CustomExecutionMode> ();
                foreach (CustomExecutionMode cmode in customModes) {
                    if (setModes.Contains (cmode.Mode.Id)) {
                        if (ctx.CanExecute (cmode.Mode.ExecutionHandler))
                            items.Add (cmode);
                        toRemove.Add (cmode);
                    }
                }
                foreach (CustomExecutionMode cmode in toRemove)
                    customModes.Remove (cmode);

                if (items.Count > 0)
                    itemGroups.Add (items);
            }

            if (customModes.Count > 0) {
                List<IExecutionMode> items = new List<IExecutionMode> ();
                foreach (CustomExecutionMode cmode in customModes) {
                    if (ctx.CanExecute (cmode.ExecutionHandler))
                        items.Add (cmode);
                }
                if (items.Count > 0)
                    itemGroups.Add (items);
            }
            return itemGroups;
        }
コード例 #29
0
            public Gtk.Widget Load(CommandExecutionContext ctx, object config_data)
            {
                options = config_data as ProfilerExecutionOptions;
                if (options == null)
                    options = new ProfilerExecutionOptions ();
                else
                    options = options.Clone ();

                VBox result = new VBox (false, 0);
                HBox box = new HBox (false, 6);
                box = new HBox (false, 6);
                box.PackStart (new Label ("Mode:"), false, false, 0);
                ComboBox type_combo = ComboBox.NewText ();
                type_combo.AppendText ("Allocations");
                type_combo.AppendText ("Calls/Instrumented");
                type_combo.AppendText ("Statistical");
                type_combo.Active = 2;
                type_combo.Changed += delegate { options.Mode = (ProfileMode) (1 << type_combo.Active); };
                box.PackStart (type_combo, false, false, 0);
                box.ShowAll ();
                result.PackStart (box, false, false, 3);
                box = new HBox (false, 6);
                CheckButton start_enabled_chkbtn = new CheckButton ("Enable Logging at Startup");
                start_enabled_chkbtn.Active = true;
                start_enabled_chkbtn.Toggled += delegate { options.StartEnabled = start_enabled_chkbtn.Active; };
                box.PackStart (start_enabled_chkbtn, false, false, 0);
                box.ShowAll ();
                result.PackStart (box, false, false, 3);
                return result;
            }
コード例 #30
0
		public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console, bool allowPrompt, bool forcePrompt)
		{
			if ((PromptForParameters || forcePrompt) && allowPrompt) {
				CommandExecutionContext ctx = new CommandExecutionContext (Project, command);
				CustomExecutionMode customMode = ExecutionModeCommandService.ShowParamtersDialog (ctx, Mode, this);
				if (customMode == null)
					return new CancelledProcessAsyncOperation ();
				else
					return customMode.Execute (command, console, false, false);
			}
			if (commandData != null) {
				foreach (KeyValuePair<string,object> cmdData in commandData) {
					ExecutionCommandCustomizer cc = ExecutionModeCommandService.GetExecutionCommandCustomizer (cmdData.Key);
					if (cc != null)
						cc.Customize (command, cmdData.Value);
				}
			}
			ParameterizedExecutionHandler cmode = Mode.ExecutionHandler as ParameterizedExecutionHandler;
			if (cmode != null) {
				CommandExecutionContext ctx = new CommandExecutionContext (Project, command);
				return cmode.Execute (command, console, ctx, Data);
			} else
				return Mode.ExecutionHandler.Execute (command, console);
		}