[Monodevelop-patches-list] r2688 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Gui/Dialogs Gui/Pads/ClassPad Gui/Pads/FileScout Internal/Codons Internal/ProgressMonitoring Internal/Project/Combine Internal/Project/Project Services Services/DebuggerService Services/ProcessService Services/Project Services/Tasks
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Wed Jul 27 10:54:34 EDT 2005
Author: lluis
Date: 2005-07-27 10:54:34 -0400 (Wed, 27 Jul 2005)
New Revision: 2688
Added:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/ExecutionHandlerCodon.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/AggregatedOperationMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/MessageDialogProgressMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/SynchronizedProgressMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/DebugExecutionHandlerFactory.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/DefaultExecutionHandlerFactory.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ExecutionContext.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ExternalConsoleFactory.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IConsole.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IConsoleFactory.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IExecutionHandler.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IExecutionHandlerFactory.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IProcessAsyncOperation.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/MintPlatformExecutionHandler.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/MonoPlatformExecutionHandler.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/NativePlatformExecutionHandler.cs
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Base.glade
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ErrorDialog.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ClassNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/NamespaceNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ProjectNodeBuilder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/FileScout/FileScout.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/AggregatedProgressMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/BaseProgressMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/IProgressMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/NullProgressMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/DebuggerService/IDebuggerService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MessageService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessWrapper.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/OutputProgressMonitor.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/TaskService.cs
Log:
2005-07-27 Lluis Sanchez Gual <lluis at novell.com>
* Services/Tasks/OutputProgressMonitor.cs: Implement the IConsole
interface.
* Services/Tasks/TaskService.cs: Implement IConsoleFactory interface.
* Services/ProcessService/IConsole.cs: New interface.
* Services/ProcessService/NativePlatformExecutionHandler.cs: Execution
handler for native applications.
* Services/ProcessService/ProcessWrapper.cs: make the class implement
the IProcessAsyncOperation interface.
* Services/ProcessService/ExternalConsoleFactory.cs: Factory for
xterm consoles.
* Services/ProcessService/MintPlatformExecutionHandler.cs: Execution
handler for running managed applications on the mono interpreter.
* Services/ProcessService/DefaultExecutionHandlerFactory.cs: The
execution handler factory for normal non-debug executions.
* Services/ProcessService/MonoPlatformExecutionHandler.cs: Execution
handler for running managed applications on the mono jit.
* Services/ProcessService/ProcessService.cs: Modified StartConsoleProcess
which now takes a generic IConsole as parameter.
* Services/ProcessService/DebugExecutionHandlerFactory.cs: The
execution handler factory for debug executions.
* Services/ProcessService/ExecutionContext.cs: New class.
* Internal/Codons/ExecutionHandlerCodon.cs: New codon for registering
execution handlers.
* Services/ProcessService/IExecutionHandlerFactory.cs:
* Services/ProcessService/IConsoleFactory.cs:
* Services/ProcessService/IExecutionHandler.cs:
* Services/ProcessService/IProcessAsyncOperation.cs: New interfaces.
* Services/DebuggerService/IDebuggerService.cs: It now takes an
IConsole as parameter.
* Internal/Project/Project/DotNetProject.cs:
* Internal/Project/Project/Project.cs:
* Internal/Project/Combine/Combine.cs:
* Internal/Project/Combine/CombineEntry.cs:
* Services/Project/ProjectService.cs: Removed the Debug method.
The Execute method now has a ExecutionContext parameter that can be
used to specify a debugging context or any other kind of execution
context.
* MonoDevelop.Base/Base.glade:
* Gui/Dialogs/ErrorDialog.cs:
* Services/MessageService.cs: GUI improvements.
* Gui/Pads/ClassPad/NamespaceNodeBuilder.cs:
* Gui/Pads/ClassPad/ProjectNodeBuilder.cs:
* Gui/Pads/ClassPad/ClassNodeBuilder.cs: Added "Show public members only"
options.
* Gui/Pads/FileScout/FileScout.cs: Fix warning.
* Internal/ProgressMonitoring/SynchronizedProgressMonitor.cs: New class.
* Internal/ProgressMonitoring/MessageDialogProgressMonitor.cs: New class.
* Internal/ProgressMonitoring/AggregatedOperationMonitor.cs: New class.
* Internal/ProgressMonitoring/BaseProgressMonitor.cs:
* Internal/ProgressMonitoring/NullProgressMonitor.cs:
* Internal/ProgressMonitoring/IProgressMonitor.cs: Added SyncRoot
property, to support synchronized progress monitors.
* Internal/ProgressMonitoring/AggregatedProgressMonitor.cs: Support
filtering of monitor actions to propagate.
* MonoDevelopCore.addin.xml: Registered new execution handlers.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Base.glade
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Base.glade 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Base.glade 2005-07-27 14:54:34 UTC (rev 2688)
@@ -4937,7 +4937,6 @@
<widget class="GtkDialog" id="ErrorDialog">
<property name="border_width">6</property>
- <property name="width_request">450</property>
<property name="visible">True</property>
<property name="title" translatable="yes">MonoDevelop</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
@@ -5029,12 +5028,13 @@
<child>
<widget class="GtkLabel" id="descriptionLabel">
+ <property name="width_request">540</property>
<property name="visible">True</property>
- <property name="label" translatable="yes">An exception has been thrown: rr</property>
+ <property name="label" translatable="yes">An exception has been thrown 1 2 3 4 5 6 7 8 9 10 11 12 13 14</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
+ <property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
@@ -5049,7 +5049,7 @@
</child>
<child>
- <widget class="GtkExpander" id="expander1">
+ <widget class="GtkExpander" id="expander">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="expanded">False</property>
@@ -5075,11 +5075,11 @@
<property name="justification">GTK_JUSTIFY_LEFT</property>
<property name="wrap_mode">GTK_WRAP_NONE</property>
<property name="cursor_visible">True</property>
- <property name="pixels_above_lines">0</property>
- <property name="pixels_below_lines">0</property>
+ <property name="pixels_above_lines">2</property>
+ <property name="pixels_below_lines">2</property>
<property name="pixels_inside_wrap">0</property>
- <property name="left_margin">0</property>
- <property name="right_margin">0</property>
+ <property name="left_margin">6</property>
+ <property name="right_margin">6</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget>
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-07-27 14:54:34 UTC (rev 2688)
@@ -1,3 +1,72 @@
+2005-07-27 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Services/Tasks/OutputProgressMonitor.cs: Implement the IConsole
+ interface.
+ * Services/Tasks/TaskService.cs: Implement IConsoleFactory interface.
+
+ * Services/ProcessService/IConsole.cs: New interface.
+ * Services/ProcessService/NativePlatformExecutionHandler.cs: Execution
+ handler for native applications.
+ * Services/ProcessService/ProcessWrapper.cs: make the class implement
+ the IProcessAsyncOperation interface.
+ * Services/ProcessService/ExternalConsoleFactory.cs: Factory for
+ xterm consoles.
+ * Services/ProcessService/MintPlatformExecutionHandler.cs: Execution
+ handler for running managed applications on the mono interpreter.
+ * Services/ProcessService/DefaultExecutionHandlerFactory.cs: The
+ execution handler factory for normal non-debug executions.
+ * Services/ProcessService/MonoPlatformExecutionHandler.cs: Execution
+ handler for running managed applications on the mono jit.
+ * Services/ProcessService/ProcessService.cs: Modified StartConsoleProcess
+ which now takes a generic IConsole as parameter.
+ * Services/ProcessService/DebugExecutionHandlerFactory.cs: The
+ execution handler factory for debug executions.
+ * Services/ProcessService/ExecutionContext.cs: New class.
+ * Internal/Codons/ExecutionHandlerCodon.cs: New codon for registering
+ execution handlers.
+
+ * Services/ProcessService/IExecutionHandlerFactory.cs:
+ * Services/ProcessService/IConsoleFactory.cs:
+ * Services/ProcessService/IExecutionHandler.cs:
+ * Services/ProcessService/IProcessAsyncOperation.cs: New interfaces.
+
+ * Services/DebuggerService/IDebuggerService.cs: It now takes an
+ IConsole as parameter.
+
+ * Internal/Project/Project/DotNetProject.cs:
+ * Internal/Project/Project/Project.cs:
+ * Internal/Project/Combine/Combine.cs:
+ * Internal/Project/Combine/CombineEntry.cs:
+ * Services/Project/ProjectService.cs: Removed the Debug method.
+ The Execute method now has a ExecutionContext parameter that can be
+ used to specify a debugging context or any other kind of execution
+ context.
+
+ * MonoDevelop.Base/Base.glade:
+ * Gui/Dialogs/ErrorDialog.cs:
+ * Services/MessageService.cs: GUI improvements.
+
+ * Gui/Pads/ClassPad/NamespaceNodeBuilder.cs:
+ * Gui/Pads/ClassPad/ProjectNodeBuilder.cs:
+ * Gui/Pads/ClassPad/ClassNodeBuilder.cs: Added "Show public members only"
+ options.
+
+ * Gui/Pads/FileScout/FileScout.cs: Fix warning.
+
+ * Internal/ProgressMonitoring/SynchronizedProgressMonitor.cs: New class.
+ * Internal/ProgressMonitoring/MessageDialogProgressMonitor.cs: New class.
+ * Internal/ProgressMonitoring/AggregatedOperationMonitor.cs: New class.
+
+ * Internal/ProgressMonitoring/BaseProgressMonitor.cs:
+ * Internal/ProgressMonitoring/NullProgressMonitor.cs:
+ * Internal/ProgressMonitoring/IProgressMonitor.cs: Added SyncRoot
+ property, to support synchronized progress monitors.
+
+ * Internal/ProgressMonitoring/AggregatedProgressMonitor.cs: Support
+ filtering of monitor actions to propagate.
+
+ * MonoDevelopCore.addin.xml: Registered new execution handlers.
+
2005-07-27 Lluis Sanchez Gual <lluis at novell.com>
* Fix warnings.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ErrorDialog.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ErrorDialog.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ErrorDialog.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -38,16 +38,48 @@
[Glade.Widget] Button okButton;
[Glade.Widget] Label descriptionLabel;
[Glade.Widget] Gtk.TextView detailsTextView;
+ [Glade.Widget] Gtk.Expander expander;
- public ErrorDialog (string message, string details)
+ TextTag tagNoWrap;
+ TextTag tagWrap;
+
+ public ErrorDialog ()
{
new Glade.XML (null, "Base.glade", "ErrorDialog", null).Autoconnect (this);
dialog.TransientFor = (Window) WorkbenchSingleton.Workbench;
- descriptionLabel.Text = message;
- detailsTextView.Buffer.Text = details;
okButton.Clicked += new EventHandler (OnClose);
+ expander.Activated += new EventHandler (OnExpanded);
+ descriptionLabel.SizeAllocated += new SizeAllocatedHandler (OnResized);
+ descriptionLabel.ModifyBg (StateType.Normal, new Gdk.Color (255,0,0));
+
+ tagNoWrap = new TextTag ("nowrap");
+ tagNoWrap.WrapMode = WrapMode.None;
+ detailsTextView.Buffer.TagTable.Add (tagNoWrap);
+
+ tagWrap = new TextTag ("wrap");
+ tagWrap.WrapMode = WrapMode.Word;
+ detailsTextView.Buffer.TagTable.Add (tagWrap);
}
+ public string Message {
+ get { return descriptionLabel.Text; }
+ set {
+ string message = value;
+ while (message.EndsWith ("\r") || message.EndsWith ("\n"))
+ message = message.Substring (0, message.Length - 1);
+ descriptionLabel.Text = message;
+ }
+ }
+
+ public void AddDetails (string text, bool wrapped)
+ {
+ TextIter it = detailsTextView.Buffer.EndIter;
+ if (wrapped)
+ detailsTextView.Buffer.InsertWithTags (ref it, text, tagWrap);
+ else
+ detailsTextView.Buffer.InsertWithTags (ref it, text, tagNoWrap);
+ }
+
public void Run ()
{
dialog.ShowAll ();
@@ -58,5 +90,26 @@
{
dialog.Destroy ();
}
+
+ void OnExpanded (object sender, EventArgs args)
+ {
+ GLib.Timeout.Add (100, new GLib.TimeoutHandler (UpdateSize));
+ }
+
+ bool UpdateSize ()
+ {
+ int w, h;
+ dialog.GetSize (out w, out h);
+ dialog.Resize (w, 1);
+ return false;
+ }
+
+ void OnResized (object sender, SizeAllocatedArgs args)
+ {
+ int w, h;
+ descriptionLabel.GetSizeRequest (out w, out h);
+ Console.WriteLine ("AW:" + descriptionLabel.Allocation.Width);
+ Console.WriteLine ("RW:" + w);
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ClassNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ClassNodeBuilder.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ClassNodeBuilder.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -60,21 +60,27 @@
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
ClassData classData = dataObject as ClassData;
+ bool publicOnly = builder.Options ["PublicApiOnly"];
foreach (IClass innerClass in classData.Class.InnerClasses)
- builder.AddChild (innerClass);
+ if (innerClass.IsPublic || !publicOnly)
+ builder.AddChild (innerClass);
foreach (IMethod method in classData.Class.Methods)
- builder.AddChild (method);
+ if (method.IsPublic || !publicOnly)
+ builder.AddChild (method);
foreach (IProperty property in classData.Class.Properties)
- builder.AddChild (property);
+ if (property.IsPublic || !publicOnly)
+ builder.AddChild (property);
foreach (IField field in classData.Class.Fields)
- builder.AddChild (field);
+ if (field.IsPublic || !publicOnly)
+ builder.AddChild (field);
foreach (IEvent e in classData.Class.Events)
- builder.AddChild (e);
+ if (e.IsPublic || !publicOnly)
+ builder.AddChild (e);
}
public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/NamespaceNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/NamespaceNodeBuilder.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/NamespaceNodeBuilder.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -86,6 +86,7 @@
void AddProjectContent (ITreeBuilder builder, Project project, NamespaceData nsData, ArrayList list)
{
bool nestedNs = builder.Options ["NestedNamespaces"];
+ bool publicOnly = builder.Options ["PublicApiOnly"];
foreach (object ob in list) {
if (ob is string && nestedNs) {
@@ -93,8 +94,10 @@
if (!builder.HasChild (ob as string, typeof(NamespaceData)))
builder.AddChild (new NamespaceData (project, ns));
}
- else if (ob is IClass)
- builder.AddChild (new ClassData (project, ob as IClass));
+ else if (ob is IClass) {
+ if (!publicOnly || ((IClass)ob).IsPublic)
+ builder.AddChild (new ClassData (project, ob as IClass));
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ProjectNodeBuilder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ProjectNodeBuilder.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/ClassPad/ProjectNodeBuilder.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -83,6 +83,8 @@
public static void BuildChildNodes (ITreeBuilder builder, Project project)
{
+ bool publicOnly = builder.Options ["PublicApiOnly"];
+
ArrayList list = Runtime.ParserService.GetNamespaceContents (project, "", false);
foreach (object ob in list) {
if (ob is string) {
@@ -92,7 +94,7 @@
FillNamespaces (builder, project, ob as string);
}
}
- else
+ else if (!publicOnly || ((IClass)ob).IsPublic)
builder.AddChild (new ClassData (project, ob as IClass));
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/FileScout/FileScout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/FileScout/FileScout.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/FileScout/FileScout.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -128,7 +128,14 @@
fb.CurrentDir = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
}
- public event EventHandler TitleChanged;
- public event EventHandler IconChanged;
+ public event EventHandler TitleChanged {
+ add {}
+ remove {}
+ }
+
+ public event EventHandler IconChanged {
+ add {}
+ remove {}
+ }
}
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/ExecutionHandlerCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/ExecutionHandlerCodon.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/ExecutionHandlerCodon.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,62 @@
+//
+// ExecutionHandlerCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Collections;
+
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.Core.AddIns.Codons
+{
+ [CodonNameAttribute ("ExecutionHandler")]
+ public class ExecutionHandlerCodon : AbstractCodon
+ {
+ IExecutionHandler handler;
+
+ [XmlMemberAttribute ("platform", IsRequired = true)]
+ string platform = null;
+
+ public IExecutionHandler ExecutionHandler {
+ get { return handler; }
+ }
+
+ public string Platform {
+ get { return platform; }
+ }
+
+ public override object BuildItem (object owner, ArrayList subItems, ConditionCollection conditions)
+ {
+ handler = (IExecutionHandler) AddIn.CreateObject (Class);
+ return this;
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/AggregatedOperationMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/AggregatedOperationMonitor.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/AggregatedOperationMonitor.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,77 @@
+//
+// AggregatedOperationMonitor.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Collections;
+
+namespace MonoDevelop.Services
+{
+ public class AggregatedOperationMonitor: IDisposable
+ {
+ ArrayList list = new ArrayList ();
+ IProgressMonitor monitor;
+
+ public AggregatedOperationMonitor (IProgressMonitor monitor, params IAsyncOperation[] operations)
+ {
+ this.monitor = monitor;
+
+ if (operations != null) {
+ lock (list) {
+ foreach (IAsyncOperation operation in operations)
+ AddOperation (operation);
+ }
+ }
+
+ monitor.CancelRequested += new MonitorHandler (OnCancel);
+ }
+
+ public void AddOperation (IAsyncOperation operation)
+ {
+ lock (list) {
+ if (monitor.IsCancelRequested)
+ operation.Cancel ();
+ else
+ list.Add (operation);
+ }
+ }
+
+ void OnCancel (IProgressMonitor m)
+ {
+ lock (list) {
+ foreach (IAsyncOperation operation in list)
+ operation.Cancel ();
+ }
+ }
+
+ public void Dispose ()
+ {
+ monitor.CancelRequested -= new MonitorHandler (OnCancel);
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/AggregatedProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/AggregatedProgressMonitor.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/AggregatedProgressMonitor.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -28,38 +28,83 @@
using System;
+using System.Collections;
using System.IO;
namespace MonoDevelop.Services
{
+ [Flags]
+ public enum MonitorAction
+ {
+ None = 0x00,
+ WriteLog = 0x01,
+ ReportError = 0x02,
+ ReportWarning = 0x04,
+ ReportSuccess = 0x08,
+ Dispose = 0x10,
+ Tasks = 0x20,
+ Cancel = 0x40,
+ SlaveCancel = 0x80, // when the slave is cancelled, the whole aggregated monitor is cancelled.
+ All = 0xff
+ }
+
public class AggregatedProgressMonitor: IProgressMonitor, IAsyncOperation
{
- IProgressMonitor[] monitors;
+ IProgressMonitor masterMonitor;
+ ArrayList monitors = new ArrayList ();
LogTextWriter logger;
- public AggregatedProgressMonitor (params IProgressMonitor[] monitors)
+ class MonitorInfo {
+ public MonitorAction ActionMask;
+ public IProgressMonitor Monitor;
+ }
+
+ public AggregatedProgressMonitor (): this (new NullProgressMonitor ())
{
- this.monitors = monitors;
+ }
+
+ public AggregatedProgressMonitor (IProgressMonitor masterMonitor)
+ {
+ this.masterMonitor = masterMonitor;
+ AddSlaveMonitor (masterMonitor, MonitorAction.All);
logger = new LogTextWriter ();
logger.TextWritten += new LogTextEventHandler (OnWriteLog);
}
+ public void AddSlaveMonitor (IProgressMonitor slaveMonitor)
+ {
+ AddSlaveMonitor (slaveMonitor, MonitorAction.All);
+ }
+
+ public void AddSlaveMonitor (IProgressMonitor slaveMonitor, MonitorAction actionMask)
+ {
+ MonitorInfo smon = new MonitorInfo ();
+ smon.ActionMask = actionMask;
+ smon.Monitor = slaveMonitor;
+ monitors.Add (smon);
+ if ((actionMask & MonitorAction.SlaveCancel) != 0)
+ slaveMonitor.CancelRequested += new MonitorHandler (OnSlaveCancelRequested);
+ }
+
public void BeginTask (string name, int totalWork)
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.BeginTask (name, totalWork);
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.Tasks) != 0)
+ info.Monitor.BeginTask (name, totalWork);
}
public void EndTask ()
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.EndTask ();
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.Tasks) != 0)
+ info.Monitor.EndTask ();
}
public void Step (int work)
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.Step (work);
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.Tasks) != 0)
+ info.Monitor.Step (work);
}
public TextWriter Log
@@ -69,43 +114,62 @@
void OnWriteLog (string text)
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.Log.Write (text);
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.WriteLog) != 0)
+ info.Monitor.Log.Write (text);
}
public void ReportSuccess (string message)
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.ReportSuccess (message);
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.ReportSuccess) != 0)
+ info.Monitor.ReportSuccess (message);
}
public void ReportWarning (string message)
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.ReportWarning (message);
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.ReportWarning) != 0)
+ info.Monitor.ReportWarning (message);
}
public void ReportError (string message, Exception ex)
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.ReportError (message, ex);
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.ReportError) != 0)
+ info.Monitor.ReportError (message, ex);
}
public void Dispose ()
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.Dispose ();
+ foreach (MonitorInfo info in monitors) {
+ if ((info.ActionMask & MonitorAction.Dispose) != 0)
+ info.Monitor.Dispose ();
+ if ((info.ActionMask & MonitorAction.SlaveCancel) != 0)
+ info.Monitor.CancelRequested -= new MonitorHandler (OnSlaveCancelRequested);
+ }
}
public bool IsCancelRequested
{
get {
- foreach (IProgressMonitor monitor in monitors)
- if (monitor.IsCancelRequested) return true;
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.SlaveCancel) != 0) {
+ if (info.Monitor.IsCancelRequested) return true;
+ }
return false;
}
}
+ public object SyncRoot {
+ get { return this; }
+ }
+
+ void OnSlaveCancelRequested (IProgressMonitor sender)
+ {
+ AsyncOperation.Cancel ();
+ }
+
public IAsyncOperation AsyncOperation
{
get { return this; }
@@ -113,41 +177,32 @@
void IAsyncOperation.Cancel ()
{
- foreach (IProgressMonitor monitor in monitors)
- monitor.AsyncOperation.Cancel ();
+ foreach (MonitorInfo info in monitors)
+ if ((info.ActionMask & MonitorAction.Cancel) != 0)
+ info.Monitor.AsyncOperation.Cancel ();
}
void IAsyncOperation.WaitForCompleted ()
{
- if (IsCompleted) return;
-
- if (Runtime.DispatchService.IsGuiThread) {
- while (!IsCompleted) {
- while (Gtk.Application.EventsPending ())
- Gtk.Application.RunIteration ();
- System.Threading.Thread.Sleep (100);
- }
- } else {
- monitors [0].AsyncOperation.WaitForCompleted ();
- }
+ masterMonitor.AsyncOperation.WaitForCompleted ();
}
public bool IsCompleted {
- get { return monitors [0].AsyncOperation.IsCompleted; }
+ get { return masterMonitor.AsyncOperation.IsCompleted; }
}
bool IAsyncOperation.Success {
- get { return monitors [0].AsyncOperation.Success; }
+ get { return masterMonitor.AsyncOperation.Success; }
}
public event MonitorHandler CancelRequested {
- add { monitors [0].CancelRequested += value; }
- remove { monitors [0].CancelRequested -= value; }
+ add { masterMonitor.CancelRequested += value; }
+ remove { masterMonitor.CancelRequested -= value; }
}
public event OperationHandler Completed {
- add { monitors [0].AsyncOperation.Completed += value; }
- remove { monitors [0].AsyncOperation.Completed -= value; }
+ add { masterMonitor.AsyncOperation.Completed += value; }
+ remove { masterMonitor.AsyncOperation.Completed -= value; }
}
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/BaseProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/BaseProgressMonitor.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/BaseProgressMonitor.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -68,6 +68,14 @@
logger.TextWritten += new LogTextEventHandler (WriteLogInternal);
}
+ [FreeDispatch]
+ public object SyncRoot {
+ get {
+ // Dont return 'this'. Locking on proxies doesn't look like a good idea.
+ return progressTracker;
+ }
+ }
+
[AsyncDispatch]
public virtual void BeginTask (string name, int totalWork)
{
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/IProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/IProgressMonitor.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/IProgressMonitor.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -50,6 +50,9 @@
bool IsCancelRequested { get; }
event MonitorHandler CancelRequested;
+ // The returned IAsyncOperation object must be thread safe
IAsyncOperation AsyncOperation { get; }
+
+ object SyncRoot { get; }
}
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/MessageDialogProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/MessageDialogProgressMonitor.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/MessageDialogProgressMonitor.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,87 @@
+//
+// MessageDialogProgressMonitor.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Specialized;
+using System.IO;
+
+namespace MonoDevelop.Services
+{
+ // Progress monitor that reports errors and warnings in message dialogs.
+
+ public class MessageDialogProgressMonitor: NullProgressMonitor
+ {
+ StringCollection errorsMessages = new StringCollection ();
+ StringCollection warningMessages = new StringCollection ();
+ Exception errorException;
+
+ public override void ReportWarning (string message)
+ {
+ warningMessages.Add (message);
+ }
+
+ public override void ReportError (string message, Exception ex)
+ {
+ if (message == null && ex != null)
+ message = ex.Message;
+ else if (message != null && ex != null) {
+ if (!message.EndsWith (".")) message += ".";
+ message += " " + ex.Message;
+ }
+
+ errorsMessages.Add (message);
+ if (ex != null) {
+ Runtime.LoggingService.Info (ex);
+ errorException = ex;
+ }
+ }
+
+ protected override void OnCompleted ()
+ {
+ Runtime.DispatchService.GuiDispatch (new MessageHandler (ShowDialogs));
+ base.OnCompleted ();
+ }
+
+ void ShowDialogs ()
+ {
+ if (errorsMessages.Count > 0) {
+ string s = "";
+ foreach (string m in errorsMessages)
+ s += m + "\n";
+ Runtime.MessageService.ShowError (errorException, s);
+ }
+
+ if (warningMessages.Count > 0) {
+ string s = "";
+ foreach (string m in warningMessages)
+ s += m + "\n";
+ Runtime.MessageService.ShowWarning (s);
+ }
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/NullProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/NullProgressMonitor.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/NullProgressMonitor.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -38,6 +38,10 @@
bool done, canceled, error;
ManualResetEvent waitEvent;
+ public object SyncRoot {
+ get { return this; }
+ }
+
public virtual void BeginTask (string name, int totalWork)
{
}
@@ -79,8 +83,7 @@
if (waitEvent != null)
waitEvent.Set ();
}
- if (completedEvent != null)
- completedEvent (this);
+ OnCompleted ();
}
public IAsyncOperation AsyncOperation
@@ -149,6 +152,12 @@
}
}
+ protected virtual void OnCompleted ()
+ {
+ if (completedEvent != null)
+ completedEvent (AsyncOperation);
+ }
+
event MonitorHandler cancelRequestedEvent;
event OperationHandler completedEvent;
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/SynchronizedProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/SynchronizedProgressMonitor.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/ProgressMonitoring/SynchronizedProgressMonitor.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,132 @@
+//
+// SynchronizedProgressMonitor.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using System.Threading;
+using System.IO;
+
+namespace MonoDevelop.Services
+{
+ public sealed class SynchronizedProgressMonitor: IProgressMonitor
+ {
+ IProgressMonitor monitor;
+
+ public SynchronizedProgressMonitor (IProgressMonitor monitor)
+ {
+ this.monitor = monitor;
+ }
+
+ public void BeginTask (string name, int totalWork)
+ {
+ lock (monitor.SyncRoot) {
+ monitor.BeginTask (name, totalWork);
+ }
+ }
+
+ public void EndTask ()
+ {
+ lock (monitor.SyncRoot) {
+ monitor.EndTask ();
+ }
+ }
+
+ public void Step (int work)
+ {
+ lock (monitor.SyncRoot) {
+ monitor.Step (work);
+ }
+ }
+
+ public TextWriter Log {
+ get { return monitor.Log; }
+ }
+
+ public void ReportSuccess (string message)
+ {
+ lock (monitor.SyncRoot) {
+ monitor.ReportSuccess (message);
+ }
+ }
+
+ public void ReportWarning (string message)
+ {
+ lock (monitor.SyncRoot) {
+ monitor.ReportWarning (message);
+ }
+ }
+
+ public void ReportError (string message, Exception ex)
+ {
+ lock (monitor.SyncRoot) {
+ monitor.ReportError (message, ex);
+ }
+ }
+
+ public bool IsCancelRequested {
+ get {
+ lock (monitor.SyncRoot) {
+ return monitor.IsCancelRequested;
+ }
+ }
+ }
+
+ public void Dispose ()
+ {
+ lock (monitor.SyncRoot) {
+ monitor.Dispose ();
+ }
+ }
+
+ public IAsyncOperation AsyncOperation
+ {
+ get {
+ lock (monitor.SyncRoot) {
+ return monitor.AsyncOperation;
+ }
+ }
+ }
+
+ public event MonitorHandler CancelRequested {
+ add {
+ lock (monitor.SyncRoot) {
+ monitor.CancelRequested += value;
+ }
+ }
+ remove {
+ lock (monitor.SyncRoot) {
+ monitor.CancelRequested -= value;
+ }
+ }
+ }
+
+ public object SyncRoot {
+ get { return monitor.SyncRoot; }
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -351,32 +351,34 @@
Entries.Remove (entry);
}
- public override void Debug (IProgressMonitor monitor)
+ public override void Execute (IProgressMonitor monitor, ExecutionContext context)
{
- if (StartupEntry != null)
- StartupEntry.Debug (monitor);
- }
-
- public override void Execute (IProgressMonitor monitor)
- {
if (singleStartup) {
if (StartupEntry != null)
- StartupEntry.Execute (monitor);
+ StartupEntry.Execute (monitor, context);
} else {
ArrayList list = new ArrayList ();
monitor.BeginTask ("Executing projects", 1);
+
+ SynchronizedProgressMonitor syncMonitor = new SynchronizedProgressMonitor (monitor);
+
foreach (CombineExecuteDefinition ced in combineExecuteDefinitions) {
if (ced.Type != EntryExecuteType.Execute) continue;
- IProgressMonitor mm = new NullProgressMonitor ();
+ AggregatedProgressMonitor mon = new AggregatedProgressMonitor ();
+ mon.AddSlaveMonitor (syncMonitor, MonitorAction.ReportError | MonitorAction.ReportWarning | MonitorAction.SlaveCancel);
+
EntryStartData sd = new EntryStartData ();
- sd.Monitor = mm;
+ sd.Monitor = mon;
+ sd.Context = context;
sd.Entry = ced.Entry;
+
Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (ExecuteEntryAsync), sd);
- list.Add (mm.AsyncOperation);
+ list.Add (sd.Monitor.AsyncOperation);
}
foreach (IAsyncOperation op in list)
op.WaitForCompleted ();
+
monitor.EndTask ();
}
}
@@ -385,12 +387,13 @@
{
EntryStartData sd = (EntryStartData) ob;
using (sd.Monitor) {
- sd.Entry.Execute (sd.Monitor);
+ sd.Entry.Execute (sd.Monitor, sd.Context);
}
}
class EntryStartData {
public IProgressMonitor Monitor;
+ public ExecutionContext Context;
public CombineEntry Entry;
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -266,8 +266,7 @@
public abstract void Clean ();
public abstract ICompilerResult Build (IProgressMonitor monitor);
- public abstract void Execute (IProgressMonitor monitor);
- public abstract void Debug (IProgressMonitor monitor);
+ public abstract void Execute (IProgressMonitor monitor, ExecutionContext context);
public abstract bool NeedsBuilding { get; set; }
public virtual void GenerateMakefiles (Combine parentCombine)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -22,8 +22,6 @@
[ItemProperty]
string language;
- object debugStopEvent = new object ();
-
ILanguageBinding languageBinding;
public override string ProjectType {
@@ -128,80 +126,52 @@
return conf.CompiledOutputName;
}
- public override void Debug (IProgressMonitor monitor)
+ protected override void DoExecute (IProgressMonitor monitor, ExecutionContext context)
{
- DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) ActiveConfiguration;
- if (Runtime.DebuggingService != null) {
- Runtime.DebuggingService.StoppedEvent += new EventHandler (OnStopDebug);
- lock (debugStopEvent) {
- try {
- Runtime.DebuggingService.Run (monitor, new string[] { configuration.CompiledOutputName } );
- Monitor.Wait (debugStopEvent);
- } catch (Exception ex) {
- monitor.ReportError (null, ex);
- }
- }
- Runtime.DebuggingService.StoppedEvent -= new EventHandler (OnStopDebug);
- }
- }
-
- void OnStopDebug (object sender, EventArgs e)
- {
- lock (debugStopEvent) {
- Monitor.PulseAll (debugStopEvent);
- }
- }
-
- protected override void DoExecute (IProgressMonitor monitor)
- {
CopyReferencesToOutputPath (true);
DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) ActiveConfiguration;
monitor.Log.WriteLine ("Running " + configuration.CompiledOutputName + " ...");
- string runtimeStarter = "mono";
+ string platform = "Mono";
switch (configuration.NetRuntime) {
case NetRuntime.Mono:
- runtimeStarter = "mono";
+ platform = "Mono";
break;
case NetRuntime.MonoInterpreter:
- runtimeStarter = "mint";
+ platform = "Mint";
break;
}
+
+ IConsole console;
+ if (configuration.ExternalConsole)
+ console = context.ExternalConsoleFactory.CreateConsole (!configuration.PauseConsoleOutput);
+ else
+ console = context.ConsoleFactory.CreateConsole (!configuration.PauseConsoleOutput);
- string args = string.Format (@"--debug {0} {1}", configuration.CompiledOutputName, configuration.CommandLineParameters);
+ AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);
try {
- ProcessWrapper p;
+ IExecutionHandler handler = context.ExecutionHandlerFactory.CreateExecutionHandler (platform);
+ if (handler == null) {
+ monitor.ReportError ("Can not execute \"" + configuration.CompiledOutputName + "\". The selected execution mode is not supported in the " + platform + " platform.", null);
+ return;
+ }
+
+ IProcessAsyncOperation op = handler.Execute (configuration.CompiledOutputName, configuration.CommandLineParameters, Path.GetDirectoryName (configuration.CompiledOutputName), console);
- if (configuration.ExternalConsole)
- p = Runtime.ProcessService.StartConsoleProcess (
- runtimeStarter,
- args,
- Path.GetDirectoryName (configuration.CompiledOutputName),
- true, configuration.PauseConsoleOutput, null);
- else
- // The use of 'sh' is a workaround. Looks like there is a bug
- // in mono, Process can't start a "mono" process.
- p = Runtime.ProcessService.StartConsoleProcess (
- "sh",
- string.Format ("-c \"{0} {1}\"", runtimeStarter, args),
- Path.GetDirectoryName (configuration.CompiledOutputName),
- false, false, null);
-
- monitor.CancelRequested += new MonitorHandler (new ProcessStopper (p).OnStopExecution);
- p.WaitForOutput ();
- monitor.Log.WriteLine ("The application exited with code: {0}", p.ExitCode);
+ operationMonitor.AddOperation (op);
+ op.WaitForCompleted ();
+ monitor.Log.WriteLine ("The application exited with code: {0}", op.ExitCode);
} catch (Exception ex) {
monitor.ReportError ("Can not execute " + "\"" + configuration.CompiledOutputName + "\"", ex);
+ } finally {
+ operationMonitor.Dispose ();
+ console.Dispose ();
}
}
- void OnStopExecution (IProgressMonitor monitor)
- {
- }
-
public override void GenerateMakefiles (Combine parentCombine)
{
Runtime.LoggingService.Info ("Generating makefiles for " + Name);
@@ -212,20 +182,5 @@
{
return languageBinding.CanCompile(fileName);
}
-
- class ProcessStopper
- {
- Process p;
-
- public ProcessStopper (Process p)
- {
- this.p = p;
- }
-
- public void OnStopExecution (IProgressMonitor monitor)
- {
- p.Kill ();
- }
- }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/Project.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -40,9 +40,6 @@
[DataInclude (typeof(ProjectFile))]
public abstract class Project : CombineEntry
{
- readonly static string currentProjectFileVersion = "1.1";
- readonly static string configurationNodeName = "Configuration";
-
[ItemProperty ("Description", DefaultValue="")]
protected string description = "";
@@ -471,7 +468,7 @@
return ps;
}
- public override void Execute (IProgressMonitor monitor)
+ public override void Execute (IProgressMonitor monitor, ExecutionContext context)
{
if (Runtime.TaskService.Errors != 0) return;
@@ -482,14 +479,20 @@
string args = configuration.CommandLineParameters;
if (configuration.ExecuteScript != null && configuration.ExecuteScript.Length > 0) {
- ProcessWrapper p = Runtime.ProcessService.StartConsoleProcess (configuration.ExecuteScript, args, BaseDirectory, configuration.ExternalConsole, configuration.PauseConsoleOutput, null);
+ IConsole console;
+ if (configuration.ExternalConsole)
+ console = context.ExternalConsoleFactory.CreateConsole (!configuration.PauseConsoleOutput);
+ else
+ console = context.ConsoleFactory.CreateConsole (!configuration.PauseConsoleOutput);
+
+ ProcessWrapper p = Runtime.ProcessService.StartConsoleProcess (configuration.ExecuteScript, args, BaseDirectory, console, null);
p.WaitForOutput ();
} else {
- DoExecute (monitor);
+ DoExecute (monitor, context);
}
}
- protected virtual void DoExecute (IProgressMonitor monitor)
+ protected virtual void DoExecute (IProgressMonitor monitor, ExecutionContext context)
{
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am 2005-07-27 14:54:34 UTC (rev 2688)
@@ -246,6 +246,18 @@
Services/ProcessService/IProcessHostController.cs \
Services/ProcessService/ProcessHostController.cs \
Services/ProcessService/RemoteProcessObject.cs \
+Services/ProcessService/DebugExecutionHandlerFactory.cs \
+Services/ProcessService/DefaultExecutionHandlerFactory.cs \
+Services/ProcessService/ExecutionContext.cs \
+Services/ProcessService/ExternalConsoleFactory.cs \
+Services/ProcessService/IConsole.cs \
+Services/ProcessService/IConsoleFactory.cs \
+Services/ProcessService/IExecutionHandlerFactory.cs \
+Services/ProcessService/IExecutionHandler.cs \
+Services/ProcessService/IProcessAsyncOperation.cs \
+Services/ProcessService/MonoPlatformExecutionHandler.cs \
+Services/ProcessService/MintPlatformExecutionHandler.cs \
+Services/ProcessService/NativePlatformExecutionHandler.cs \
Services/Project/ProjectEventArgs.cs \
Services/Project/IProjectService.cs \
Services/Project/ProjectRenameEventArgs.cs \
@@ -322,6 +334,7 @@
Internal/Codons/IDialogPanel.cs \
Internal/Codons/DialogPanelCodon.cs \
Internal/Codons/IDialogPanelDescriptor.cs \
+Internal/Codons/ExecutionHandlerCodon.cs \
Internal/Codons/FileFormatCodon.cs \
Internal/Codons/MenuItems/AbstractCheckableMenuCommand.cs \
Internal/Codons/MenuItems/ISubmenuBuilder.cs \
@@ -415,7 +428,9 @@
Internal/Parser/IComment.cs \
Internal/Parser/ICompilationUnit.cs \
Internal/ProgressMonitoring/AggregatedProgressMonitor.cs \
+Internal/ProgressMonitoring/AggregatedOperationMonitor.cs \
Internal/ProgressMonitoring/BaseProgressMonitor.cs \
+Internal/ProgressMonitoring/MessageDialogProgressMonitor.cs \
Internal/ProgressMonitoring/ConsoleProgressMonitor.cs \
Internal/ProgressMonitoring/IAsyncOperation.cs \
Internal/ProgressMonitoring/IProgressMonitor.cs \
@@ -423,6 +438,7 @@
Internal/ProgressMonitoring/NullProgressMonitor.cs \
Internal/ProgressMonitoring/NullAsyncOperation.cs \
Internal/ProgressMonitoring/ProgressTracker.cs \
+Internal/ProgressMonitoring/SynchronizedProgressMonitor.cs \
Internal/Project/PrjxFileFormat.cs \
Internal/Project/CmbxFileFormat.cs \
Internal/Project/MdsFileFormat.cs \
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml 2005-07-27 14:54:34 UTC (rev 2688)
@@ -78,6 +78,18 @@
class="MonoDevelop.Internal.Project.CmbxFileFormat"/>
</Extension>
+ <Extension path = "/SharpDevelop/Workbench/ExecutionHandlers">
+ <ExecutionHandler id="Mono"
+ platform = "Mono"
+ class = "MonoDevelop.Services.MonoPlatformExecutionHandler"/>
+ <ExecutionHandler id="Mint"
+ platform = "Mint"
+ class = "MonoDevelop.Services.MintPlatformExecutionHandler"/>
+ <ExecutionHandler id="Native"
+ platform = "Native"
+ class = "MonoDevelop.Services.NativePlatformExecutionHandler"/>
+ </Extension>
+
<Extension path = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "Browser"
supportedformats = "Web Pages"
@@ -735,6 +747,7 @@
<PadOption id = "ShowProjects" _label = "Show project structure" defaultValue = "True" />
<PadOption id = "GroupByAccess" _label = "Group members by access" defaultValue = "False" />
<PadOption id = "GroupByType" _label = "Group members by member type" defaultValue = "True" />
+ <PadOption id = "PublicApiOnly" _label = "Show public members only" defaultValue = "False" />
<NodeBuilder id = "Combine" class = "MonoDevelop.Gui.Pads.ClassPad.CombineNodeBuilder"/>
<NodeBuilder id = "Project" class = "MonoDevelop.Gui.Pads.ClassPad.ProjectNodeBuilder"/>
<NodeBuilder id = "Namespace" class = "MonoDevelop.Gui.Pads.ClassPad.NamespaceNodeBuilder"/>
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/DebuggerService/IDebuggerService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/DebuggerService/IDebuggerService.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/DebuggerService/IDebuggerService.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -34,7 +34,7 @@
void Pause ();
void Resume ();
- void Run (IProgressMonitor monitor, string[] args);
+ void Run (IConsole console, string[] args);
void Stop ();
void StepInto ();
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MessageService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MessageService.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/MessageService.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -56,19 +56,21 @@
string msg = string.Empty;
string details;
+ ErrorDialog dlg = new ErrorDialog ();
+
if (message != null) {
- msg = message;
+ dlg.Message = message;
}
if (ex != null) {
- if (msg.Length == 0)
- msg = ex.Message;
- details = "Exception occurred: \n\n" + ex.ToString ();
+ if (dlg.Message.Length == 0)
+ dlg.Message = ex.Message;
+ dlg.AddDetails ("Exception occurred: " + ex.Message + "\n\n", true);
+ dlg.AddDetails (ex.ToString (), false);
} else {
- details = "No more details available.";
+ dlg.AddDetails ("No more details available.", true);
}
- ErrorDialog dlg = new ErrorDialog (message, details);
dlg.Run ();
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/DebugExecutionHandlerFactory.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/DebugExecutionHandlerFactory.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/DebugExecutionHandlerFactory.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,125 @@
+//
+// DebugExecutionHandlerFactory.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Threading;
+
+namespace MonoDevelop.Services
+{
+ public class DebugExecutionHandlerFactory: IExecutionHandlerFactory
+ {
+ public IExecutionHandler CreateExecutionHandler (string platformId)
+ {
+ if (Runtime.DebuggingService == null)
+ return null;
+
+ if (platformId == "Mono")
+ return new DebugExecutionHandler ();
+ else
+ return null;
+ }
+ }
+
+ class DebugExecutionHandler: IExecutionHandler, IProcessAsyncOperation
+ {
+ bool done;
+ ManualResetEvent stopEvent;
+
+ public DebugExecutionHandler ()
+ {
+ Runtime.DebuggingService.StoppedEvent += new EventHandler (OnStopDebug);
+ }
+
+ public IProcessAsyncOperation Execute (string command, string arguments, string workingDirectory, IConsole console)
+ {
+ Runtime.DebuggingService.Run (console, new string[] { command } );
+ return this;
+ }
+
+ public void Cancel ()
+ {
+ Runtime.DebuggingService.Stop ();
+ }
+
+ public void WaitForCompleted ()
+ {
+ lock (this) {
+ if (done) return;
+ if (stopEvent == null)
+ stopEvent = new ManualResetEvent (false);
+ }
+ stopEvent.WaitOne ();
+ }
+
+ public int ExitCode {
+ get { return 0; }
+ }
+
+ public bool IsCompleted {
+ get { return done; }
+ }
+
+ public bool Success {
+ get { return true; }
+ }
+
+ void OnStopDebug (object sender, EventArgs args)
+ {
+ lock (this) {
+ done = true;
+ if (stopEvent != null)
+ stopEvent.Set ();
+ if (completedEvent != null)
+ completedEvent (this);
+ }
+
+ Runtime.DebuggingService.StoppedEvent -= new EventHandler (OnStopDebug);
+ }
+
+ event OperationHandler IAsyncOperation.Completed {
+ add {
+ bool raiseNow = false;
+ lock (this) {
+ if (done)
+ raiseNow = true;
+ else
+ completedEvent += value;
+ }
+ if (raiseNow)
+ value (this);
+ }
+ remove {
+ lock (this) {
+ completedEvent -= value;
+ }
+ }
+ }
+
+ event OperationHandler completedEvent;
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/DefaultExecutionHandlerFactory.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/DefaultExecutionHandlerFactory.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/DefaultExecutionHandlerFactory.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,40 @@
+//
+// DefaultExecutionHandlerFactory.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Services
+{
+ public class DefaultExecutionHandlerFactory: IExecutionHandlerFactory
+ {
+ public IExecutionHandler CreateExecutionHandler (string platformId)
+ {
+ return Runtime.ProcessService.GetDefaultExecutionHandler (platformId);
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ExecutionContext.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ExecutionContext.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ExecutionContext.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,57 @@
+//
+// ExecutionContext.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Services
+{
+ [Serializable]
+ public class ExecutionContext
+ {
+ IExecutionHandlerFactory executionHandlerFactory;
+ IConsoleFactory consoleFactory;
+
+ public ExecutionContext (IExecutionHandlerFactory executionHandlerFactory, IConsoleFactory consoleFactory)
+ {
+ this.executionHandlerFactory = executionHandlerFactory;
+ this.consoleFactory = consoleFactory;
+ }
+
+ public IExecutionHandlerFactory ExecutionHandlerFactory {
+ get { return executionHandlerFactory; }
+ }
+
+ public IConsoleFactory ConsoleFactory {
+ get { return consoleFactory; }
+ }
+
+ public IConsoleFactory ExternalConsoleFactory {
+ get { return MonoDevelop.Services.ExternalConsoleFactory.Instance; }
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ExternalConsoleFactory.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ExternalConsoleFactory.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ExternalConsoleFactory.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,78 @@
+//
+// ExternalConsoleFactory.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+
+namespace MonoDevelop.Services
+{
+ public sealed class ExternalConsoleFactory: IConsoleFactory
+ {
+ public static ExternalConsoleFactory Instance = new ExternalConsoleFactory ();
+
+ public IConsole CreateConsole (bool closeOnDispose)
+ {
+ return new ExternalConsole (closeOnDispose);
+ }
+ }
+
+ public sealed class ExternalConsole: IConsole
+ {
+ bool closeOnDispose;
+
+ internal ExternalConsole (bool closeOnDispose)
+ {
+ this.closeOnDispose = closeOnDispose;
+ }
+
+ public TextReader In {
+ get { return Console.In; }
+ }
+
+ public TextWriter Out {
+ get { return Console.Out; }
+ }
+
+ public TextWriter Error {
+ get { return Console.Error; }
+ }
+
+ public bool CloseOnDispose {
+ get { return closeOnDispose; }
+ }
+
+ public void Dispose ()
+ {
+ }
+
+ public event EventHandler CancelRequested {
+ add {}
+ remove {}
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IConsole.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IConsole.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IConsole.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,43 @@
+//
+// IConsole.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+
+namespace MonoDevelop.Services
+{
+ public interface IConsole: IDisposable
+ {
+ TextReader In { get; }
+ TextWriter Out { get; }
+ TextWriter Error { get; }
+ bool CloseOnDispose { get; }
+
+ event EventHandler CancelRequested;
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IConsoleFactory.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IConsoleFactory.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IConsoleFactory.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,37 @@
+//
+// IConsoleFactory.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Services
+{
+ public interface IConsoleFactory
+ {
+ IConsole CreateConsole (bool closeOnDispose);
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IExecutionHandler.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IExecutionHandler.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IExecutionHandler.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,37 @@
+//
+// IExecutionHandler.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Services
+{
+ public interface IExecutionHandler
+ {
+ IProcessAsyncOperation Execute (string command, string arguments, string workingDirectory, IConsole console);
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IExecutionHandlerFactory.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IExecutionHandlerFactory.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IExecutionHandlerFactory.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,37 @@
+//
+// IExecutionHandlerFactory.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Services
+{
+ public interface IExecutionHandlerFactory
+ {
+ IExecutionHandler CreateExecutionHandler (string platformId);
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IProcessAsyncOperation.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IProcessAsyncOperation.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/IProcessAsyncOperation.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,37 @@
+//
+// IProcessAsyncOperation.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Services
+{
+ public interface IProcessAsyncOperation: IAsyncOperation
+ {
+ int ExitCode { get; }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/MintPlatformExecutionHandler.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/MintPlatformExecutionHandler.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/MintPlatformExecutionHandler.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,41 @@
+//
+// MintPlatformExecutionHandler.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Services
+{
+ public class MintPlatformExecutionHandler: NativePlatformExecutionHandler
+ {
+ public override IProcessAsyncOperation Execute (string command, string arguments, string workingDirectory, IConsole console)
+ {
+ string args = string.Format (@"--debug {0} {1}", command, arguments);
+ return base.Execute ("mint", args, workingDirectory, console);
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/MonoPlatformExecutionHandler.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/MonoPlatformExecutionHandler.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/MonoPlatformExecutionHandler.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,47 @@
+//
+// MonoPlatformExecutionHandler.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Services
+{
+ public class MonoPlatformExecutionHandler: NativePlatformExecutionHandler
+ {
+ public override IProcessAsyncOperation Execute (string command, string arguments, string workingDirectory, IConsole console)
+ {
+ string args = string.Format (@"--debug {0} {1}", command, arguments);
+
+ if (console is ExternalConsole)
+ return base.Execute ("mono", args, workingDirectory, console);
+ else
+ // The use of 'sh' is a workaround. Looks like there is a bug
+ // in mono, Process can't start a "mono" process.
+ return base.Execute ("sh", string.Format ("-c \"mono {0}\"", args), workingDirectory, console);
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/NativePlatformExecutionHandler.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/NativePlatformExecutionHandler.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/NativePlatformExecutionHandler.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -0,0 +1,41 @@
+//
+// NativePlatformExecutionHandler.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Diagnostics;
+
+namespace MonoDevelop.Services
+{
+ public class NativePlatformExecutionHandler: IExecutionHandler
+ {
+ public virtual IProcessAsyncOperation Execute (string command, string arguments, string workingDirectory, IConsole console)
+ {
+ return Runtime.ProcessService.StartConsoleProcess (command, arguments, workingDirectory, console, null);
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessService.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -6,13 +6,21 @@
using System.Diagnostics;
using MonoDevelop.Core.Services;
+using MonoDevelop.Core.AddIns.Codons;
+using MonoDevelop.Core.AddIns;
namespace MonoDevelop.Services
{
public class ProcessService : AbstractService
{
ProcessHostController externalProcess;
+ ExecutionHandlerCodon[] executionHandlers;
+ public override void InitializeService ()
+ {
+ executionHandlers = (ExecutionHandlerCodon[])(AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ExecutionHandlers").BuildChildItems(null)).ToArray(typeof(ExecutionHandlerCodon));
+ }
+
public ProcessWrapper StartProcess (string command, string arguments, string workingDirectory, EventHandler exited)
{
return StartProcess (command, arguments, workingDirectory, (ProcessEventHandler)null, (ProcessEventHandler)null, exited);
@@ -68,11 +76,11 @@
return p;
}
- public ProcessWrapper StartConsoleProcess (string command, string arguments, string workingDirectory, bool externalConsole, bool pauseBeforeExit, EventHandler exited)
+ public ProcessWrapper StartConsoleProcess (string command, string arguments, string workingDirectory, IConsole console, EventHandler exited)
{
- if (externalConsole) {
+ if (console == null || (console is ExternalConsole)) {
string additionalCommands = "";
- if (pauseBeforeExit)
+ if (!console.CloseOnDispose)
additionalCommands = @"echo; read -p 'Press any key to continue...' -n1;";
ProcessStartInfo psi = new ProcessStartInfo("xterm",
String.Format (@"-e ""cd {3} ; '{0}' {1} ; {2}""", command, arguments, additionalCommands, workingDirectory));
@@ -87,28 +95,24 @@
if (exited != null)
p.Exited += exited;
-
+
p.StartInfo = psi;
p.Start();
return p;
} else {
- // This should create an vte pad instead, but an output panel will be enough until we can do it
- IProgressMonitor monitor = Runtime.TaskService.GetOutputProgressMonitor ("Application Output", MonoDevelop.Gui.Stock.RunProgramIcon, true, true);
-
- ProcessMonitor pm = new ProcessMonitor ();
- pm.Exited = exited;
- pm.Monitor = monitor;
- pm.CancelHandler = new MonitorHandler(pm.OnCancelRequest);
-
- monitor.CancelRequested += pm.CancelHandler;
-
- ProcessWrapper pw = StartProcess (command, arguments, workingDirectory, monitor.Log, monitor.Log, new EventHandler (pm.OnExited));
- pm.ProcessWrapper = pw;
-
+ ProcessWrapper pw = StartProcess (command, arguments, workingDirectory, console.Out, console.Error, null);
+ new ProcessMonitor (console, pw, exited);
return pw;
}
}
+ public IExecutionHandler GetDefaultExecutionHandler (string platformId)
+ {
+ foreach (ExecutionHandlerCodon codon in executionHandlers)
+ if (codon.Platform == platformId) return codon.ExecutionHandler;
+ return null;
+ }
+
ProcessHostController GetHost (bool shared)
{
if (!shared)
@@ -140,33 +144,35 @@
class ProcessMonitor
{
- public IProgressMonitor Monitor;
- public EventHandler Exited;
+ public IConsole console;
+ EventHandler exited;
+ IAsyncOperation operation;
- public ProcessWrapper ProcessWrapper;
- public MonitorHandler CancelHandler;
+ public ProcessMonitor (IConsole console, IAsyncOperation operation, EventHandler exited)
+ {
+ this.exited = exited;
+ this.operation = operation;
+ this.console = console;
+ operation.Completed += new OperationHandler (OnOperationCompleted);
+ console.CancelRequested += new EventHandler (OnCancelRequest);
+ }
- public void OnExited (object sender, EventArgs args)
+ public void OnOperationCompleted (IAsyncOperation op)
{
- ProcessWrapper p = (ProcessWrapper) sender;
try {
- if (Exited != null)
- Exited (sender, args);
- p.WaitForOutput ();
+ if (exited != null)
+ exited (op, null);
} finally {
- Monitor.Dispose ();
+ console.Dispose ();
}
}
- public void OnCancelRequest (IProgressMonitor monitor) {
- if (ProcessWrapper != null) {
- if (!ProcessWrapper.HasExited) {
- ProcessWrapper.Kill();
- monitor.Log.WriteLine("Application stopped by user.");
- }
- }
+ void OnCancelRequest (object sender, EventArgs args)
+ {
+ operation.Cancel ();
+
//remove the cancel handler, it will be attached again when StartConsoleProcess is called
- monitor.CancelRequested -= CancelHandler;
+ console.CancelRequested -= new EventHandler (OnCancelRequest);
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessWrapper.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessWrapper.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessWrapper.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -7,13 +7,19 @@
{
public delegate void ProcessEventHandler(object sender, string message);
- public class ProcessWrapper : Process
+ public class ProcessWrapper : Process, IProcessAsyncOperation
{
private Thread captureOutputThread;
private Thread captureErrorThread;
ManualResetEvent endEventOut = new ManualResetEvent (false);
ManualResetEvent endEventErr = new ManualResetEvent (false);
+ bool done;
+ public ProcessWrapper ()
+ {
+ Exited += new EventHandler (OnExited);
+ }
+
public new void Start ()
{
base.Start ();
@@ -27,12 +33,6 @@
captureErrorThread.Start ();
}
- public void Abort ()
- {
- captureOutputThread.Abort ();
- captureErrorThread.Abort ();
- }
-
public void WaitForOutput ()
{
WaitForExit ();
@@ -66,7 +66,64 @@
}
endEventErr.Set ();
}
+
+ int IProcessAsyncOperation.ExitCode {
+ get { return ExitCode; }
+ }
+
+ void IAsyncOperation.Cancel ()
+ {
+ if (!done)
+ Kill ();
+ }
+
+ void IAsyncOperation.WaitForCompleted ()
+ {
+ WaitForOutput ();
+ }
+
+ void OnExited (object sender, EventArgs args)
+ {
+ try {
+ WaitForOutput ();
+ } finally {
+ lock (this) {
+ done = true;
+ if (completedEvent != null)
+ completedEvent (this);
+ }
+ }
+ }
+
+ event OperationHandler IAsyncOperation.Completed {
+ add {
+ bool raiseNow = false;
+ lock (this) {
+ if (done)
+ raiseNow = true;
+ else
+ completedEvent += value;
+ }
+ if (raiseNow)
+ value (this);
+ }
+ remove {
+ lock (this) {
+ completedEvent -= value;
+ }
+ }
+ }
+ bool IAsyncOperation.Success {
+ get { return done ? ExitCode == 0 : false; }
+ }
+
+ bool IAsyncOperation.IsCompleted {
+ get { return done; }
+ }
+
+ event OperationHandler completedEvent;
+
public event ProcessEventHandler OutputStreamChanged;
public event ProcessEventHandler ErrorStreamChanged;
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/ProjectService.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -343,8 +343,10 @@
{
if (currentRunOperation != null && !currentRunOperation.IsCompleted) return currentRunOperation;
- IProgressMonitor monitor = new NullProgressMonitor ();
- Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (ExecuteCombineEntryAsync), new object[] {entry, monitor});
+ IProgressMonitor monitor = new MessageDialogProgressMonitor ();
+ ExecutionContext context = new ExecutionContext (new DefaultExecutionHandlerFactory (), Runtime.TaskService);
+
+ Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (ExecuteCombineEntryAsync), new object[] {entry, monitor, context});
currentRunOperation = monitor.AsyncOperation;
return currentRunOperation;
}
@@ -354,9 +356,10 @@
object[] data = (object[]) ob;
CombineEntry entry = (CombineEntry) data[0];
IProgressMonitor monitor = (IProgressMonitor) data[1];
+ ExecutionContext context = (ExecutionContext) data[2];
OnBeforeStartProject ();
try {
- entry.Execute (monitor);
+ entry.Execute (monitor, context);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex);
} finally {
@@ -370,8 +373,10 @@
guiHelper.SetWorkbenchContext (WorkbenchContext.Debug);
- IProgressMonitor monitor = new NullProgressMonitor ();
- Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (DebugCombineEntryAsync), new object[] {entry, monitor});
+ IProgressMonitor monitor = new MessageDialogProgressMonitor ();
+ ExecutionContext context = new ExecutionContext (new DebugExecutionHandlerFactory (), Runtime.TaskService);
+
+ Runtime.DispatchService.ThreadDispatch (new StatefulMessageHandler (DebugCombineEntryAsync), new object[] {entry, monitor, context});
currentRunOperation = monitor.AsyncOperation;
return currentRunOperation;
}
@@ -381,8 +386,9 @@
object[] data = (object[]) ob;
CombineEntry entry = (CombineEntry) data[0];
IProgressMonitor monitor = (IProgressMonitor) data[1];
+ ExecutionContext context = (ExecutionContext) data[2];
try {
- entry.Debug (monitor);
+ entry.Execute (monitor, context);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex);
} finally {
@@ -413,9 +419,9 @@
guiHelper.SetWorkbenchContext (WorkbenchContext.Debug);
- IProgressMonitor monitor = new NullProgressMonitor ();
+ IProgressMonitor monitor = Runtime.TaskService.GetRunProgressMonitor ();
- Runtime.DebuggingService.Run (monitor, new string[] { executableFile });
+ Runtime.DebuggingService.Run ((IConsole) monitor, new string[] { executableFile });
DebugApplicationStopper disposer = new DebugApplicationStopper ();
disposer.Monitor = monitor;
@@ -853,15 +859,6 @@
projectBindings = (ProjectBindingCodon[])(AddInTreeSingleton.AddInTree.GetTreeNode("/SharpDevelop/Workbench/ProjectBindings").BuildChildItems(null)).ToArray(typeof(ProjectBindingCodon));
}
- string MakeValidName(string str)
- {
- string tmp = "";
- foreach (char ch in str) {
- tmp += ((byte)ch).ToString();
- }
- return tmp;
- }
-
void RestoreCombinePreferences (object data)
{
Combine combine = (Combine) data;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/OutputProgressMonitor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/OutputProgressMonitor.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/OutputProgressMonitor.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -23,9 +23,10 @@
namespace MonoDevelop.Services
{
- public class OutputProgressMonitor : BaseProgressMonitor
+ public class OutputProgressMonitor : BaseProgressMonitor, IConsole
{
DefaultMonitorPad outputPad;
+ event EventHandler stopRequested;
public OutputProgressMonitor (DefaultMonitorPad pad, string title, string icon)
{
@@ -81,5 +82,33 @@
{
return new InvalidOperationException ("Output progress monitor already disposed.");
}
+
+ protected override void OnCancelRequested ()
+ {
+ base.OnCancelRequested ();
+ if (stopRequested != null)
+ stopRequested (this, null);
+ }
+
+ TextReader IConsole.In {
+ get { return new StringReader (""); }
+ }
+
+ TextWriter IConsole.Out {
+ get { return Log; }
+ }
+
+ TextWriter IConsole.Error {
+ get { return Log; }
+ }
+
+ bool IConsole.CloseOnDispose {
+ get { return false; }
+ }
+
+ event EventHandler IConsole.CancelRequested {
+ add { stopRequested += value; }
+ remove { stopRequested -= value; }
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/TaskService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/TaskService.cs 2005-07-27 14:49:08 UTC (rev 2687)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Tasks/TaskService.cs 2005-07-27 14:54:34 UTC (rev 2688)
@@ -15,7 +15,7 @@
namespace MonoDevelop.Services
{
- public class TaskService : GuiSyncAbstractService
+ public class TaskService : GuiSyncAbstractService, IConsoleFactory
{
ArrayList tasks = new ArrayList();
string compilerOutput = String.Empty;
@@ -29,10 +29,9 @@
public IProgressMonitor GetBuildProgressMonitor ()
{
bool front = (bool) Runtime.Properties.GetProperty ("SharpDevelop.ShowOutputWindowAtBuild", true);
- return new AggregatedProgressMonitor (
- GetOutputProgressMonitor ("Build Output", MonoDevelop.Gui.Stock.BuildCombine, front, true),
- GetStatusProgressMonitor ("Building...", MonoDevelop.Gui.Stock.BuildCombine, false)
- );
+ AggregatedProgressMonitor mon = new AggregatedProgressMonitor (GetOutputProgressMonitor ("Build Output", MonoDevelop.Gui.Stock.BuildCombine, front, true));
+ mon.AddSlaveMonitor (GetStatusProgressMonitor ("Building...", MonoDevelop.Gui.Stock.BuildCombine, false));
+ return mon;
}
public IProgressMonitor GetRunProgressMonitor ()
@@ -50,7 +49,12 @@
return GetStatusProgressMonitor ("Saving...", Stock.SaveIcon, true);
}
+ public IConsole CreateConsole (bool closeOnDispose)
+ {
+ return (IConsole) GetOutputProgressMonitor ("Application Output", MonoDevelop.Gui.Stock.RunProgramIcon, true, true);
+ }
+
/******************************/
More information about the Monodevelop-patches-list
mailing list