[Monodevelop-patches-list] r2155 - trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Mon Jan 24 18:30:17 EST 2005


Author: lluis
Date: 2005-01-24 18:30:17 -0500 (Mon, 24 Jan 2005)
New Revision: 2155

Modified:
   trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/ChangeLog
   trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs
   trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs
Log:
2005-01-24  Lluis Sanchez Gual  <lluis at novell.com>

	* JavaBindingCompilerServices.cs: 
	* JavaLanguageBinding.cs: Use the new progress monitor API.
	


Modified: trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/ChangeLog	2005-01-24 23:30:04 UTC (rev 2154)
+++ trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/ChangeLog	2005-01-24 23:30:17 UTC (rev 2155)
@@ -1,3 +1,8 @@
+2005-01-24  Lluis Sanchez Gual  <lluis at novell.com>
+
+	* JavaBindingCompilerServices.cs: 
+	* JavaLanguageBinding.cs: Use the new progress monitor API.
+	
 2005-01-16  John Luke  <john.luke at gmail.com>
 
 	* Makefile.am: remove FormattingStrategy from build

Modified: trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs	2005-01-24 23:30:04 UTC (rev 2154)
+++ trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/JavaBindingCompilerServices.cs	2005-01-24 23:30:17 UTC (rev 2155)
@@ -36,7 +36,7 @@
 			return "javac";
 		}
 		
-		public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
+		public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration, IProgressMonitor monitor)
 		{
 			JavaCompilerParameters compilerparameters = (JavaCompilerParameters) configuration.CompilationParameters;
 			if (compilerparameters == null) compilerparameters = new JavaCompilerParameters ();
@@ -94,40 +94,38 @@
 
 			StreamReader output;
 			StreamReader error;
-			DoCompilation (compiler, args, tf, configuration, compilerparameters, out output, out error);
+			DoCompilation (monitor, compiler, args, tf, configuration, compilerparameters, out output, out error);
 			ICompilerResult cr = ParseOutput (tf, error);			
 			
 			return cr;
 		}
 
-		private void DoCompilation (string compiler, string args, TempFileCollection tf, DotNetProjectConfiguration configuration, JavaCompilerParameters compilerparameters, out StreamReader output, out StreamReader error)
+		private void DoCompilation (IProgressMonitor monitor, string compiler, string args, TempFileCollection tf, DotNetProjectConfiguration configuration, JavaCompilerParameters compilerparameters, out StreamReader output, out StreamReader error)
 		{
-            ProcessStartInfo si = new ProcessStartInfo (compiler, args);
-			si.RedirectStandardOutput = true;
-            si.RedirectStandardError = true;
-			si.UseShellExecute = false;
-			Process p = new Process ();
-           	p.StartInfo = si;
-            p.Start ();
-
-			IStatusBarService sbs = (IStatusBarService)ServiceManager.GetService (typeof (IStatusBarService));
-			sbs.SetMessage ("Compiling...");
-
-			while (!p.HasExited) {
-				((SdStatusBar)sbs.Control).Pulse();
-				while (Gtk.Application.EventsPending ())
-					Gtk.Application.RunIteration ();
-				System.Threading.Thread.Sleep (100);
-			}
+			try {
+				monitor.BeginTask (null, 2);
+				monitor.Log.WriteLine ("Compiling Java source code ...");
+				ProcessStartInfo si = new ProcessStartInfo (compiler, args);
+				si.RedirectStandardOutput = true;
+				si.RedirectStandardError = true;
+				si.UseShellExecute = false;
+				Process p = new Process ();
+				p.StartInfo = si;
+				p.Start ();
+				p.WaitForExit ();
+				
+				monitor.Step (1);
+				monitor.Log.WriteLine ("Generating assembly ...");
+				CompileToAssembly (configuration, compilerparameters);
 			
-			CompileToAssembly (configuration, compilerparameters);
-			((SdStatusBar) sbs.Control).Done ();
-		
-			// FIXME: avoid having a full buffer
-			// perhaps read one line and append parsed output
-			// and then return cr at end 
-			output = p.StandardOutput;
-			error = p.StandardError;
+				// FIXME: avoid having a full buffer
+				// perhaps read one line and append parsed output
+				// and then return cr at end 
+				output = p.StandardOutput;
+				error = p.StandardError;
+			} finally {
+				monitor.EndTask ();
+			}
         }
 
 		void CompileToAssembly (DotNetProjectConfiguration configuration, JavaCompilerParameters compilerparameters)
@@ -146,14 +144,7 @@
 			Process p = new Process ();
            	p.StartInfo = si;
             p.Start ();
-
-			IStatusBarService sbs = (IStatusBarService)ServiceManager.GetService (typeof (IStatusBarService));
-			while (!p.HasExited) {
-				((SdStatusBar)sbs.Control).Pulse();
-				while (Gtk.Application.EventsPending ())
-					Gtk.Application.RunIteration ();
-				System.Threading.Thread.Sleep (100);
-			}
+			p.WaitForExit ();
 		}
 		
 		ICompilerResult ParseOutput (TempFileCollection tf, StreamReader errorStream)

Modified: trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs	2005-01-24 23:30:04 UTC (rev 2154)
+++ trunk/MonoDevelop/Core/src/AddIns/BackendBindings/JavaBinding/JavaLanguageBinding.cs	2005-01-24 23:30:17 UTC (rev 2155)
@@ -45,10 +45,10 @@
 			return compilerServices.CanCompile(fileName);
 		}
 		
-		public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration)
+		public ICompilerResult Compile (ProjectFileCollection projectFiles, ProjectReferenceCollection references, DotNetProjectConfiguration configuration, IProgressMonitor monitor)
 		{
 			Debug.Assert(compilerServices != null);
-			return compilerServices.Compile (projectFiles, references, configuration);
+			return compilerServices.Compile (projectFiles, references, configuration, monitor);
 		}
 		
 		public void GenerateMakefile (Project project, Combine parentCombine)




More information about the Monodevelop-patches-list mailing list