static bool SupportsParameterization(IExecutionMode mode, CommandExecutionContext ctx) { if (ExecutionModeCommandService.GetExecutionCommandCustomizers(ctx).Any()) { return(true); } return(mode.ExecutionHandler is ParameterizedExecutionHandler); }
void LoadEditors() { Dictionary <object, object> oldData = new Dictionary <object, object> (); foreach (KeyValuePair <object, IExecutionConfigurationEditor> editor in currentEditors) { object data = editor.Value.Save(); oldData [editor.Key] = data; } foreach (Gtk.Widget w in notebook.Children) { notebook.Remove(w); w.Destroy(); } if (mode == null) { return; } currentEditors.Clear(); foreach (ExecutionCommandCustomizer customizer in ExecutionModeCommandService.GetExecutionCommandCustomizers(ctx)) { IExecutionConfigurationEditor e = customizer.CreateEditor(); currentEditors.Add(customizer, e); object cdata; if (!oldData.TryGetValue(customizer, out cdata)) { cdata = data.GetCommandData(customizer.Id); } Gtk.Widget w = e.Load(ctx, cdata); w.Show(); notebook.AppendPage(w, new Gtk.Label(GettextCatalog.GetString(customizer.Name))); } ParameterizedExecutionHandler handler = mode.ExecutionHandler as ParameterizedExecutionHandler; if (handler != null) { IExecutionConfigurationEditor e = handler.CreateEditor(); currentEditors.Add(mode, e); object cdata; if (!oldData.TryGetValue(mode, out cdata)) { cdata = data.Data; } Gtk.Widget w = e.Load(ctx, data.Data); w.Show(); notebook.AppendPage(w, new Gtk.Label(mode.Name)); } notebook.ShowTabs = notebook.ShowBorder = currentEditors.Count > 1; hseparator.Visible = !notebook.ShowTabs; }