Author: mkrueger
Date: 2007-05-15 04:59:42 -0400 (Tue, 15 May 2007)
New Revision: 77395

Added:
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CompilerResult.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ExecutionContext.cs
Modified:
   branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.SolutionPad/FileNodeBuilder.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IProject.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/MSBuildProject.cs
   
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
   branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
Log:
worked on compilation & execution

Modified: branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
===================================================================
--- branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am  
2007-05-15 08:07:45 UTC (rev 77394)
+++ branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am  
2007-05-15 08:59:42 UTC (rev 77395)
@@ -275,6 +275,8 @@
        MonoDevelop.Ide.Projects.Item/ProjectItem.cs \
        MonoDevelop.Ide.Projects.Item/ProjectItemFactory.cs \
        MonoDevelop.Ide.Projects.Item/UnknownProjectItem.cs \
+       MonoDevelop.Ide.Projects/CompilerResult.cs \
+       MonoDevelop.Ide.Projects/ExecutionContext.cs \
        MonoDevelop.Ide.Projects/IProject.cs \
        MonoDevelop.Ide.Projects/MSBuildProject.cs \
        MonoDevelop.Ide.Projects/ProjectEventArgs.cs \

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
  2007-05-15 08:07:45 UTC (rev 77394)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
  2007-05-15 08:59:42 UTC (rev 77395)
@@ -66,8 +66,9 @@
                
                protected override void Run ()
                {
-                       if (IdeApp.ProjectOperations.CurrentOpenCombine != 
null) {
-                               IAsyncOperation op = 
IdeApp.ProjectOperations.Build (IdeApp.ProjectOperations.CurrentOpenCombine);
+                       
+                       if (MonoDevelop.Ide.Projects.ProjectService.Solution != 
null) {
+                               IAsyncOperation op = 
MonoDevelop.Ide.Projects.ProjectService.BuildSolution ();
                                op.Completed += new OperationHandler 
(ExecuteCombine);
                        } else {
                                doc = IdeApp.Workbench.ActiveDocument;
@@ -91,7 +92,7 @@
                {
                        if (op.Success)
                                // FIXME: check RunWithWarnings
-                               IdeApp.ProjectOperations.Execute 
(IdeApp.ProjectOperations.CurrentOpenCombine);
+                               
MonoDevelop.Ide.Projects.ProjectService.StartSolution ();
                }
                
                void ExecuteFile (IAsyncOperation op)
@@ -104,25 +105,25 @@
        
        internal class RunEntryHandler: CommandHandler
        {
-               CombineEntry entry;
+               MonoDevelop.Ide.Projects.IProject entry;
                
                protected override void Run ()
                {
-                       entry = 
IdeApp.ProjectOperations.CurrentSelectedCombineEntry;
-                       IAsyncOperation op = IdeApp.ProjectOperations.Build 
(entry);
+                       entry = 
MonoDevelop.Ide.Projects.ProjectService.ActiveProject;
+                       IAsyncOperation op = 
MonoDevelop.Ide.Projects.ProjectService.BuildProject (entry);
                        op.Completed += new OperationHandler (ExecuteCombine);
                }
                
                protected override void Update (CommandInfo info)
                {
-                       info.Enabled = 
IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null && 
-                                                       
IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted;
+                       info.Enabled = 
MonoDevelop.Ide.Projects.ProjectService.ActiveProject != null && 
+                                                       
MonoDevelop.Ide.Projects.ProjectService.CurrentRunOperation.IsCompleted;
                }
                
                void ExecuteCombine (IAsyncOperation op)
                {
                        if (op.Success)
-                               IdeApp.ProjectOperations.Execute (entry);
+                               
MonoDevelop.Ide.Projects.ProjectService.StartProject (entry);
                }
        }
        
@@ -138,8 +139,8 @@
                                return;
                        }
                        
-                       if (IdeApp.ProjectOperations.CurrentOpenCombine != 
null) {
-                               IAsyncOperation op = 
IdeApp.ProjectOperations.Build (IdeApp.ProjectOperations.CurrentOpenCombine);
+                       if (MonoDevelop.Ide.Projects.ProjectService.Solution != 
null) {
+                               IAsyncOperation op = 
MonoDevelop.Ide.Projects.ProjectService.BuildSolution ();
                                op.Completed += new OperationHandler 
(ExecuteCombine);
                        } else {
                                doc = IdeApp.Workbench.ActiveDocument;
@@ -172,8 +173,9 @@
                
                void ExecuteCombine (IAsyncOperation op)
                {
-                       if (op.Success)
-                               IdeApp.ProjectOperations.Debug 
(IdeApp.ProjectOperations.CurrentOpenCombine);
+                       // TODO:
+//                     if (op.Success)
+//                             IdeApp.ProjectOperations.Debug 
(IdeApp.ProjectOperations.CurrentOpenCombine);
                }
                
                void ExecuteFile (IAsyncOperation op)
@@ -216,11 +218,10 @@
        {
                protected override void Run ()
                {
-                       if (IdeApp.ProjectOperations.CurrentOpenCombine != 
null) {
-                               if 
(IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null)
-                                       IdeApp.ProjectOperations.Build 
(IdeApp.ProjectOperations.CurrentSelectedCombineEntry);
-                       }
-                       else if (IdeApp.Workbench.ActiveDocument != null) {
+                       if (MonoDevelop.Ide.Projects.ProjectService.Solution != 
null) {
+                               if 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject != null)
+                                       
MonoDevelop.Ide.Projects.ProjectService.BuildProject 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject);
+                       } else if (IdeApp.Workbench.ActiveDocument != null) {
                                IdeApp.Workbench.ActiveDocument.Save ();
                                IdeApp.Workbench.ActiveDocument.Build ();
                        }
@@ -259,9 +260,9 @@
        {
                protected override void Run ()
                {
-                       if (IdeApp.ProjectOperations.CurrentOpenCombine != 
null) {
-                               if 
(IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null)
-                                       IdeApp.ProjectOperations.Rebuild 
(IdeApp.ProjectOperations.CurrentSelectedCombineEntry);
+                       if (MonoDevelop.Ide.Projects.ProjectService.Solution != 
null) {
+                               if 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject != null)
+                                       
MonoDevelop.Ide.Projects.ProjectService.RebuildProject 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject);
                        }
                        else if (IdeApp.Workbench.ActiveDocument != null) {
                                IdeApp.Workbench.ActiveDocument.Save ();
@@ -295,13 +296,12 @@
        {
                protected override void Run ()
                {
-                       IdeApp.ProjectOperations.Build 
(IdeApp.ProjectOperations.CurrentOpenCombine);
+                       MonoDevelop.Ide.Projects.ProjectService.BuildSolution 
();
                }
                
                protected override void Update (CommandInfo info)
                {
-                       info.Enabled = 
IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted &&
-                                                       
(IdeApp.ProjectOperations.CurrentOpenCombine != null);
+                       info.Enabled = 
MonoDevelop.Ide.Projects.ProjectService.Solution != null && 
MonoDevelop.Ide.Projects.ProjectService.CurrentBuildOperation.IsCompleted;
                }
        }
        
@@ -309,13 +309,12 @@
        {
                protected override void Run ()
                {
-                       IdeApp.ProjectOperations.Rebuild 
(IdeApp.ProjectOperations.CurrentOpenCombine);
+                       MonoDevelop.Ide.Projects.ProjectService.RebuildSolution 
();
                }
                
                protected override void Update (CommandInfo info)
                {
-                       info.Enabled = 
IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted &&
-                                                       
(IdeApp.ProjectOperations.CurrentOpenCombine != null);
+                       info.Enabled = 
MonoDevelop.Ide.Projects.ProjectService.Solution != null && 
MonoDevelop.Ide.Projects.ProjectService.CurrentBuildOperation.IsCompleted;
                }
        }
        
@@ -323,12 +322,12 @@
        {
                protected override void Run ()
                {
-                       IdeApp.ProjectOperations.Clean 
(IdeApp.ProjectOperations.CurrentOpenCombine);
+                       MonoDevelop.Ide.Projects.ProjectService.CleanSolution 
();
                }
                
                protected override void Update (CommandInfo info)
                {
-                       info.Enabled = 
IdeApp.ProjectOperations.CurrentOpenCombine != null;
+                       info.Enabled = 
MonoDevelop.Ide.Projects.ProjectService.Solution != null;
                }
        }
        
@@ -336,14 +335,14 @@
        {
                protected override void Run ()
                {
-                       IdeApp.ProjectOperations.Clean 
(IdeApp.ProjectOperations.CurrentSelectedCombineEntry);
+                       MonoDevelop.Ide.Projects.ProjectService.CleanProject 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject);
                }
                
                protected override void Update (CommandInfo info)
                {
-                       if 
(IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null) {
-                               info.Enabled = 
IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null;
-                               info.Text = info.Description = 
GettextCatalog.GetString ("Clean {0}", 
IdeApp.ProjectOperations.CurrentSelectedCombineEntry.Name);
+                       if 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject != null) {
+                               info.Enabled = 
MonoDevelop.Ide.Projects.ProjectService.ActiveProject != null;
+                               info.Text = info.Description = 
GettextCatalog.GetString ("Clean {0}", Path.GetFileNameWithoutExtension 
(MonoDevelop.Ide.Projects.ProjectService.ActiveProject.FileName));
                        } else {
                                info.Enabled = false;
                        }

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs
     2007-05-15 08:07:45 UTC (rev 77394)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs
     2007-05-15 08:59:42 UTC (rev 77395)
@@ -41,8 +41,8 @@
 using MonoDevelop.Projects.Parser;
 using MonoDevelop.Projects.CodeGeneration;
 using MonoDevelop.Components;
+using Mono.Addins;
 using MonoDevelop.Core;
-using Mono.Addins;
 using MonoDevelop.Core.Properties;
 using MonoDevelop.Core.Execution;
 using MonoDevelop.Core.ProgressMonitoring;

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.SolutionPad/FileNodeBuilder.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.SolutionPad/FileNodeBuilder.cs
      2007-05-15 08:07:45 UTC (rev 77394)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.SolutionPad/FileNodeBuilder.cs
      2007-05-15 08:59:42 UTC (rev 77395)
@@ -52,6 +52,10 @@
                        get { return typeof(FileNode); }
                }
                
+               public override Type CommandHandlerType {
+                       get { return typeof(FileNodeCommandHandler); }
+               }
+               
                public override string GetNodeName (ITreeNavigator thisNode, 
object dataObject)
                {
                        FileNode fileNode = dataObject as FileNode;
@@ -98,6 +102,17 @@
                        // todo: code behind files
                        return false;
                }
+               
        }
+       
+       public class FileNodeCommandHandler: NodeCommandHandler
+       {
+               public override void ActivateItem ()
+               {
+                       FileNode fileNode = CurrentNode.DataItem as FileNode;
+                       if (fileNode != null) 
+                               IdeApp.Workbench.OpenDocument 
(fileNode.FileName);
+               }
+       }
 }
 

Added: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CompilerResult.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CompilerResult.cs
   2007-05-15 08:07:45 UTC (rev 77394)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/CompilerResult.cs
   2007-05-15 08:59:42 UTC (rev 77395)
@@ -0,0 +1,103 @@
+//
+// CompilerResult.cs
+//
+// Author:
+//   Mike Krüger <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 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.CodeDom.Compiler;
+
+namespace MonoDevelop.Ide.Projects
+{
+       public class CompilerResult
+       {
+               CompilerResults compilerResults = new CompilerResults (null);
+               string output;
+               
+               public CompilerResults CompilerResults {
+                       get { return compilerResults; }
+               }
+               
+               public string Output {
+                       get { return output; }
+                       set { output = value; }
+               }
+               
+               public int Warnings {
+                       get {
+                               if (compilerResults == null) 
+                                       return 0;
+                               int result = 0;
+                               foreach (CompilerError err in 
compilerResults.Errors) {
+                                       if (err.IsWarning) 
+                                               result++;
+                               }
+                               return result;
+                       }
+               }
+               
+               public int Errors {
+                       get {
+                               if (compilerResults == null) 
+                                       return 0;
+                               int result = 0;
+                               foreach (CompilerError err in 
compilerResults.Errors) {
+                                       if (!err.IsWarning) 
+                                               result++;
+                               }
+                               return result;
+                       }
+               }
+
+               public CompilerResult ()
+               {
+               }
+               public CompilerResult (CompilerResults compilerResults, string 
output)
+               {
+                       this.compilerResults = compilerResults;
+                       this.output          = output;
+               }
+               
+               public void AddError (string text)
+               {
+                       AddError (null, 0, 0, null, text);
+               }
+               public void AddError (string file, int line, int col, string 
errorNum, string text)
+               {
+                       compilerResults.Errors.Add (new CompilerError (file, 
line, col, errorNum, text));
+               }
+               
+               public void AddWarning (string text)
+               {
+                       AddWarning (null, 0, 0, null, text);
+               }
+               public void AddWarning (string file, int line, int col, string 
errorNum, string text)
+               {
+                       CompilerError ce = new CompilerError (file, line, col, 
errorNum, text);
+                       ce.IsWarning = true;
+                       compilerResults.Errors.Add (ce);
+               }
+       }
+}

Added: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ExecutionContext.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ExecutionContext.cs
 2007-05-15 08:07:45 UTC (rev 77394)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ExecutionContext.cs
 2007-05-15 08:59:42 UTC (rev 77395)
@@ -0,0 +1,58 @@
+//
+// 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;
+using MonoDevelop.Core.Execution;
+
+namespace MonoDevelop.Ide.Projects
+{
+       [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.Core.Execution.ExternalConsoleFactory.Instance; }
+               }
+       }
+}
\ No newline at end of file

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IProject.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IProject.cs
 2007-05-15 08:07:45 UTC (rev 77394)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/IProject.cs
 2007-05-15 08:59:42 UTC (rev 77395)
@@ -28,6 +28,8 @@
 
 using System;
 using System.Collections.Generic;
+
+using MonoDevelop.Core;
 using MonoDevelop.Ide.Projects.Item;
 
 namespace MonoDevelop.Ide.Projects
@@ -46,5 +48,8 @@
                List<ProjectItem> Items {
                        get;
                }
+               
+               CompilerResult Build (IProgressMonitor monitor);
+               void Start (IProgressMonitor monitor, ExecutionContext context);
        }
 }

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/MSBuildProject.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/MSBuildProject.cs
   2007-05-15 08:07:45 UTC (rev 77394)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/MSBuildProject.cs
   2007-05-15 08:59:42 UTC (rev 77395)
@@ -32,6 +32,8 @@
 using System.IO;
 using System.Xml;
 
+using MonoDevelop.Core;
+using MonoDevelop.Core.Execution;
 using MonoDevelop.Ide.Projects.Item;
 
 namespace MonoDevelop.Ide.Projects
@@ -69,6 +71,48 @@
                        this.fileName = fileName;
                }
                
+               public CompilerResult Build (IProgressMonitor monitor)
+               {
+                       string responseFileName = Path.GetTempFileName ();
+                       Console.WriteLine ("response file:" + responseFileName);
+                       using (StreamWriter writer = new StreamWriter 
(responseFileName)) {
+                               writer.WriteLine("/noconfig");
+                               writer.WriteLine("/nologo");
+                               writer.WriteLine("/codepage:utf8");
+                               writer.WriteLine("/t:exe");
+                               
+                               writer.WriteLine("\"/out:{0}\"", "a.exe");
+                               
+                               foreach (ProjectItem item in this.Items) {
+                                       if (item is ProjectFile) {
+                                               writer.WriteLine("\"{0}\"", 
item.Include);
+                                       }
+                               }
+                       }
+                       
+                       string output = Path.GetTempFileName ();
+                       string error = Path.GetTempFileName ();
+                       
+                       using (StreamWriter outWriter = new StreamWriter 
(output)) {
+                               using (StreamWriter errWriter = new 
StreamWriter (error)) {
+                                       ProcessWrapper pw = 
Runtime.ProcessService.StartProcess ("gmcs", "\"@" + responseFileName + "\"", 
BasePath, outWriter, errWriter, delegate {});
+                                       pw.WaitForExit();
+                               }
+                       }
+                       
+                       return new CompilerResult();
+               }
+               
+               public void Start (IProgressMonitor monitor, ExecutionContext 
context)
+               {
+                       Runtime.ProcessService.StartConsoleProcess ( 
Path.Combine(BasePath, "a.exe"),
+                                                                   "",
+                                                                   BasePath,
+                                                                   
context.ConsoleFactory.CreateConsole (true),
+                                                                   delegate 
{});
+               }
+
+#region I/O
                void ReadPropertyGroup (XmlReader reader)
                {
                        ProjectReadHelper.ReadList (reader, "PropertyGroup", 
delegate() {
@@ -119,5 +163,6 @@
                        }
                        return result;
                }
+#endregion
        }
 }

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
===================================================================
--- 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
   2007-05-15 08:07:45 UTC (rev 77394)
+++ 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Projects/ProjectService.cs
   2007-05-15 08:59:42 UTC (rev 77395)
@@ -30,6 +30,17 @@
 using System.IO;
 using System.Collections.Generic;
 
+using MonoDevelop.Core;
+using MonoDevelop.Core.Properties;
+using MonoDevelop.Core.Execution;
+using MonoDevelop.Core.ProgressMonitoring;
+using MonoDevelop.Core.Gui;
+using MonoDevelop.Core.Gui.ProgressMonitoring;
+using MonoDevelop.Core.Gui.Dialogs;
+using MonoDevelop.Ide.Tasks;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.Gui.Dialogs;
+
 namespace MonoDevelop.Ide.Projects
 {
        public static class ProjectService
@@ -75,8 +86,149 @@
                public static bool IsSolution (string fileName)
                {
                        return Path.GetExtension (fileName) == ".sln";
-               }
+               }
                
+               static IAsyncOperation currentBuildOperation = 
NullAsyncOperation.Success;
+               public static IAsyncOperation CurrentBuildOperation {
+                       get { return currentBuildOperation; }
+                       set { currentBuildOperation = value; }
+               }
+               
+               public static IAsyncOperation BuildSolution ()
+               {
+                       if (currentBuildOperation != null && 
!currentBuildOperation.IsCompleted) {
+                               return currentBuildOperation;
+                       }
+                       IProgressMonitor monitor = new 
MessageDialogProgressMonitor ();
+                       ExecutionContext context = new ExecutionContext (new 
DefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
+
+                       Services.DispatchService.ThreadDispatch (new 
StatefulMessageHandler (BuildSolutionAsync), new object[] {Solution, monitor, 
context});
+                       currentRunOperation = monitor.AsyncOperation;
+                       
+                       return currentRunOperation;
+               }
+               static void BuildSolutionAsync (object data)
+               {
+                       Console.WriteLine ("1");
+                       object[] array = (object[])data;
+                       Solution solution = array[0] as Solution;
+                       if (solution == null) 
+                               return;
+                       Console.WriteLine ("2");
+                       IProgressMonitor monitor = array[1] as IProgressMonitor;
+                       ExecutionContext context = array[2] as ExecutionContext;
+                       
+                       foreach (SolutionItem item in solution.Items) {
+                               SolutionProject project = item as 
SolutionProject;
+                               if (project == null)
+                                       continue;
+                               Console.WriteLine (" build:" + 
project.Location);
+                               BuildProject (project.Project);
+                       }
+               }
+               
+               public static IAsyncOperation RebuildSolution ()
+               {
+                       if (currentBuildOperation != null && 
!currentBuildOperation.IsCompleted) {
+                               return currentBuildOperation;
+                       }
+                       return null;
+               }
+               
+               public static IAsyncOperation CleanSolution ()
+               {
+                       return null;
+               }
+               
+               public static IAsyncOperation BuildProject (IProject project)
+               {
+                       if (currentBuildOperation != null && 
!currentBuildOperation.IsCompleted) {
+                               return currentBuildOperation;
+                       }
+                       IProgressMonitor monitor = new 
MessageDialogProgressMonitor ();
+                       ExecutionContext context = new ExecutionContext (new 
DefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
+
+                       Services.DispatchService.ThreadDispatch (new 
StatefulMessageHandler (BuildSolutionAsync), new object[] {project, monitor, 
context});
+                       currentRunOperation = monitor.AsyncOperation;
+                       return currentRunOperation;
+                       
+                       project.Build (null);
+                       return null;
+               }
+               static void BuildProjectAsync (object data)
+               {
+                       object[] array = (object[])data;
+                       IProject project = array[0] as IProject;
+                       if (project == null) 
+                               return;
+                       IProgressMonitor monitor = array[1] as IProgressMonitor;
+                       ExecutionContext context = array[2] as ExecutionContext;
+                       
+                       project.Build (null);
+               }
+               
+               public static IAsyncOperation RebuildProject (IProject project)
+               {
+                       if (currentBuildOperation != null && 
!currentBuildOperation.IsCompleted) {
+                               return currentBuildOperation;
+                       }
+                       
+                       return null;
+               }
+               public static IAsyncOperation CleanProject (IProject project)
+               {
+                       return null;
+               }
+               
+               static IAsyncOperation currentRunOperation = 
NullAsyncOperation.Success;
+               public static IAsyncOperation CurrentRunOperation {
+                       get { return currentRunOperation; }
+                       set { currentRunOperation = value; }
+               }
+               
+               public static IAsyncOperation StartSolution ()
+               {
+                       foreach (SolutionItem item in Solution.Items) {
+                               SolutionProject project = item as 
SolutionProject;
+                               if (project == null)
+                                       continue;
+                               return StartProject (project.Project);
+                       }
+                       return null;
+               }
+               
+               public static IAsyncOperation StartProject(IProject project)
+               {
+                       if (currentRunOperation != null && 
!currentRunOperation.IsCompleted) {
+                               return currentRunOperation;
+                       }
+
+                       IProgressMonitor monitor = new 
MessageDialogProgressMonitor ();
+                       ExecutionContext context = new ExecutionContext (new 
DefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
+
+                       Services.DispatchService.ThreadDispatch (new 
StatefulMessageHandler (StartProjectAsync), new object[] {project, monitor, 
context});
+                       currentRunOperation = monitor.AsyncOperation;
+                       return currentRunOperation;
+               }
+               
+               static void StartProjectAsync (object data)
+               {
+                       object[] array = (object[])data;
+                       IProject project = array[0] as IProject;
+                       if (project == null) 
+                               return;
+                       IProgressMonitor monitor = array[1] as IProgressMonitor;
+                       ExecutionContext context = array[2] as ExecutionContext;
+                       //OnBeforeStartProject ();
+                       try {
+                               project.Start (monitor, context);
+                       } catch (Exception ex) {
+                               monitor.ReportError (GettextCatalog.GetString 
("Execution failed."), ex);
+                       } finally {
+                               monitor.Dispose ();
+                       }
+               }
+               
                public static event EventHandler<ProjectEventArgs>  
ActiveProjectChanged;
                public static void OnActiveProjectChanged (ProjectEventArgs e)
                {

Modified: 
branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
===================================================================
--- branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp  
2007-05-15 08:07:45 UTC (rev 77394)
+++ branches/mkrueger/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp  
2007-05-15 08:59:42 UTC (rev 77395)
@@ -320,6 +320,8 @@
     <File name="./MonoDevelop.Ide.Gui.Pads.SolutionPad/DirectoryNode.cs" 
subtype="Code" buildaction="Compile" />
     <File 
name="./MonoDevelop.Ide.Gui.Pads.SolutionPad/DirectoryNodeBuilder.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./MonoDevelop.Ide.Gui.Pads.SolutionPad/FileNodeBuilder.cs" 
subtype="Code" buildaction="Compile" />
+    <File name="./MonoDevelop.Ide.Projects/ExecutionContext.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="./MonoDevelop.Ide.Projects/CompilerResult.cs" subtype="Code" 
buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="False" refto="gecko-sharp, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=ccf7d78a55e9f021" />

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to