[Monodevelop-patches-list] r1199 - in trunk/MonoDevelop: . src/Libraries/MonoDevelop.Core/Services src/Main/Base/Commands src/Main/Base/Services
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Fri Mar 19 23:28:51 EST 2004
Author: jba
Date: 2004-03-19 23:28:51 -0500 (Fri, 19 Mar 2004)
New Revision: 1199
Modified:
trunk/MonoDevelop/ChangeLog
trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/Services/IMessageService.cs
trunk/MonoDevelop/src/Main/Base/Commands/MenuItemBuilders.cs
trunk/MonoDevelop/src/Main/Base/Services/MessageService.cs
Log:
last parts of bugfix for #53311 - tools prompt on launch for args, if set in options
Modified: trunk/MonoDevelop/ChangeLog
===================================================================
--- trunk/MonoDevelop/ChangeLog 2004-03-20 01:17:52 UTC (rev 1198)
+++ trunk/MonoDevelop/ChangeLog 2004-03-20 04:28:51 UTC (rev 1199)
@@ -1,3 +1,12 @@
+2004-03-20 John BouAntoun <jba-mono at optusnet.com.au>
+
+ * src/Main/Base/Commands/MenuItemBuilders.cs : made it prompt
+ user for launching exteranl tool if set in options
+ * src/Main/Base/Services/MessageService.cs: added generic
+ text prompting dialog, GetTextResponse() for above change:
+ * src/Libraries/MonoDevelop.Core/Services/IMessageService.cs:
+ added prototype for GetTextResponse() for above change:
+
2004-03-19 John Luke <jluke at cfl.rr.com>
* src/Main/Base/Gui/IProgressMonitor.cs:
Modified: trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/Services/IMessageService.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/Services/IMessageService.cs 2004-03-20 01:17:52 UTC (rev 1198)
+++ trunk/MonoDevelop/src/Libraries/MonoDevelop.Core/Services/IMessageService.cs 2004-03-20 04:28:51 UTC (rev 1199)
@@ -49,5 +49,9 @@
bool AskQuestionFormatted(string formatstring, params string[] formatitems);
bool AskQuestion(string question, string caption);
bool AskQuestionFormatted(string caption, string formatstring, params string[] formatitems);
+
+ // used to return text input from a user in response to a question
+ string GetTextResponse(string question, string caption, string initialValue);
+ string GetTextResponse(string question, string caption);
}
}
Modified: trunk/MonoDevelop/src/Main/Base/Commands/MenuItemBuilders.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/MenuItemBuilders.cs 2004-03-20 01:17:52 UTC (rev 1198)
+++ trunk/MonoDevelop/src/Main/Base/Commands/MenuItemBuilders.cs 2004-03-20 04:28:51 UTC (rev 1199)
@@ -130,14 +130,34 @@
IProjectService projectService = (IProjectService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+ MessageService messageService =(MessageService)ServiceManager.Services.GetService(typeof(MessageService));
for (int i = 0; i < ToolLoader.Tool.Count; ++i) {
if (item.Text == ToolLoader.Tool[i].ToString()) {
+
ExternalTool tool = (ExternalTool)ToolLoader.Tool[i];
+ // set the command
string command = tool.Command;
- string args = stringParserService.Parse(tool.Arguments);
+ // set the args
+ string args = stringParserService.Parse(tool.Arguments);
+ // prompt for args if needed
+ if (tool.PromptForArguments) {
+ args = messageService.GetTextResponse(
+ "Enter any arguments you want to use while launching tool, " + tool.MenuCommand + ":",
+ "Command Arguments for " + tool.MenuCommand,
+ args);
+
+ // if user selected cancel string will be null
+ if (args == null) {
+ args = stringParserService.Parse(tool.Arguments);
+ }
+ }
+
+ // debug command and args
Console.WriteLine("command : " + command);
Console.WriteLine("args : " + args);
+
+ // create the process
try {
ProcessStartInfo startinfo;
if (args == null || args.Length == 0) {
@@ -148,12 +168,10 @@
startinfo.WorkingDirectory = stringParserService.Parse(tool.InitialDirectory);
- // FIXME: need to find a way to prompt for the user arguments
// FIXME: need to find a way to wire the console output into the output window if specified
Process.Start(startinfo);
- } catch (Exception ex) {
- IMessageService messageService =(IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
+ } catch (Exception ex) {
messageService.ShowError(ex, "External program execution failed.\nError while starting:\n '" + command + " " + args + "'");
}
break;
Modified: trunk/MonoDevelop/src/Main/Base/Services/MessageService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/MessageService.cs 2004-03-20 01:17:52 UTC (rev 1198)
+++ trunk/MonoDevelop/src/Main/Base/Services/MessageService.cs 2004-03-20 04:28:51 UTC (rev 1199)
@@ -127,5 +127,47 @@
md.Hide ();
}
}
+
+ // call this method to show a dialog and get a response value
+ // returns null if cancel is selected
+ public string GetTextResponse(string question, string caption, string initialValue)
+ {
+ string returnValue = null;
+
+ using (Gtk.Dialog md = new Gtk.Dialog (caption, (Gtk.Window) WorkbenchSingleton.Workbench, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent)) {
+ // add a label with the question
+ Gtk.Label questionLabel = new Gtk.Label(question);
+ questionLabel.UseMarkup = true;
+ questionLabel.Xalign = 0.0F;
+ md.VBox.PackStart(questionLabel, true, false, 6);
+
+ // add an entry with initialValue
+ Gtk.Entry responseEntry = (initialValue != null) ? new Gtk.Entry(initialValue) : new Gtk.Entry();
+ md.VBox.PackStart(responseEntry, false, true, 6);
+
+ // add action widgets
+ md.AddActionWidget(new Gtk.Button(Gtk.Stock.Cancel), Gtk.ResponseType.Cancel);
+ md.AddActionWidget(new Gtk.Button(Gtk.Stock.Ok), Gtk.ResponseType.Ok);
+
+ md.VBox.ShowAll();
+ md.ActionArea.ShowAll();
+ md.HasSeparator = false;
+ md.BorderWidth = 6;
+
+ int response = md.Run ();
+ md.Hide ();
+
+ if ((Gtk.ResponseType) response == Gtk.ResponseType.Ok) {
+ returnValue = responseEntry.Text;
+ }
+ }
+
+ return returnValue;
+ }
+
+ public string GetTextResponse(string question, string caption)
+ {
+ return GetTextResponse(question, caption, string.Empty);
+ }
}
}
More information about the Monodevelop-patches-list
mailing list