[MonoDevelop] code completion database druid

Iain McCoy iain@mccoy.id.au
Wed, 25 Feb 2004 01:55:07 +1100


--=-K6ciL4OLYw5iLsU1LePL
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello,

I've attached my druid patch; it seems to work fine against r1002. I
think it does pretty much what you'd expect. There's a few bits of code
in there that need to be revised - I plan to do that, I just thought I'd
submit something that worked before the release.

This basically tears out the entire code completion wizard system and
replaces it. There's a bunch of reused bits of old code, especially in
the various database generators themselves.

It seems to do the right things and generally work as expected, but I
wouldn't be surprised to find that my testing has missed something
crucial :)

Cheers,
-- 
Iain McCoy <iain@mccoy.id.au>

--=-K6ciL4OLYw5iLsU1LePL
Content-Disposition: attachment; filename=md-druid.patch
Content-Type: text/x-patch; name=md-druid.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

diff -urN MonoDevelop.pristine/src/Main/Base/Commands/AutostartCommands.cs MonoDevelop.changes/src/Main/Base/Commands/AutostartCommands.cs
--- MonoDevelop.pristine/src/Main/Base/Commands/AutostartCommands.cs	2004-02-23 13:50:08.000000000 +1100
+++ MonoDevelop.changes/src/Main/Base/Commands/AutostartCommands.cs	2004-02-25 00:45:32.000000000 +1100
@@ -21,6 +21,7 @@
 using ICSharpCode.SharpDevelop.Services;
 using ICSharpCode.SharpDevelop.Gui;
 using ICSharpCode.SharpDevelop.Gui.Dialogs;
+using ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard;
 using ICSharpCode.SharpDevelop.Gui.ErrorHandlers;
 
 using SA = ICSharpCode.SharpAssembly.Assembly;
@@ -49,13 +50,21 @@
 	
 	public class StartCodeCompletionWizard : AbstractCommand
 	{
-		public override void Run()
+		private string CreateCodeCompletionDir()
 		{
-			PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-			string path = propertyService.GetProperty("SharpDevelop.CodeCompletion.DataDirectory", String.Empty).ToString();
 			FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-			string codeCompletionTemp = fileUtilityService.GetDirectoryNameWithSeparator(path);
-			string codeCompletionProxyFile = codeCompletionTemp + "CodeCompletionProxyDataV02.bin";
+			PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
+			string path = propertyService.DataDirectory + System.IO.Path.DirectorySeparatorChar + "CodeCompletionData";
+			if (!Directory.Exists(path))
+				Directory.CreateDirectory(path);
+			propertyService.SetProperty ("SharpDevelop.CodeCompletion.DataDirectory", path);
+			propertyService.SaveProperties ();
+			return fileUtilityService.GetDirectoryNameWithSeparator(path);
+		}
+		public override void Run()
+		{
+			string path = CreateCodeCompletionDir();
+			string codeCompletionProxyFile = path + "CodeCompletionProxyDataV02.bin";
 
 			if (!File.Exists(codeCompletionProxyFile)) {
 				RunWizard();
@@ -66,29 +75,11 @@
 		
 		void RunWizard()
 		{
-			IProperties customizer = new DefaultProperties();
-			
 			if (SplashScreenForm.SplashScreen.Visible) {
 				SplashScreenForm.SplashScreen.Hide();
 			}
-			PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-			
-			customizer.SetProperty("SharpDevelop.CodeCompletion.DataDirectory",
-			                       propertyService.GetProperty("SharpDevelop.CodeCompletion.DataDirectory", String.Empty));
 			
-			WizardDialog wizard = new WizardDialog("Initialize Code Completion Database", customizer, "/SharpDevelop/CompletionDatabaseWizard");
-			propertyService.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", customizer.GetProperty("SharpDevelop.CodeCompletion.DataDirectory", String.Empty));
-			
-			wizard.Run ();
-			wizard.Hide ();
-			wizard.Destroy ();
-
-			// restart  & exit 
-			ServiceManager.Services.UnloadAllServices();
-			// FIXME: handle this elegantly
-			// is it really necessary to restart here?
-			//System.Diagnostics.Process.Start(Path.Combine (Application.StartupPath, "SharpDevelop.exe"));
-			Gtk.Application.Quit ();
+			(new GenerateDatabase()).Start();
 		}
 	}
 	
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs	2004-02-14 16:57:43.000000000 +1100
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs	1970-01-01 10:00:00.000000000 +1000
@@ -1,135 +0,0 @@
-// <file>
-//     <copyright see="prj:///doc/copyright.txt"/>
-//     <license see="prj:///doc/license.txt"/>
-//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-//     <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-using Gtk;
-using MonoDevelop.Gui.Widgets;
-
-using ICSharpCode.SharpDevelop.Internal.Project;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.Services;
-using ICSharpCode.Core.AddIns.Codons;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
-{
-	public class ChooseLocationPanel : AbstractWizardPanel
-	{
-		IProperties properties;
-		static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-		
-		RadioButton specifyLocationRadioButton;
-		RadioButton sharpDevelopDirRadioButton;
-		FolderEntry fEntry;
-		
-		public override bool ReceiveDialogMessage(DialogMessage message)
-		{
-			if (message == DialogMessage.Cancel) {
-				properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", String.Empty);
-			} else if (message == DialogMessage.Next || message == DialogMessage.OK) {
-				string path = null;				
-				if (specifyLocationRadioButton.Active) {
-					path = fEntry.Path.TrimEnd (System.IO.Path.DirectorySeparatorChar);
-				} else if (sharpDevelopDirRadioButton.Active) {
-					FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-					PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-				
-					path = propertyService.DataDirectory + 
-					       System.IO.Path.DirectorySeparatorChar + "CodeCompletionData"; 
-				} else {
-					PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-					path = propertyService.ConfigDirectory + "CodeCompletionTemp";
-				}
-				
-				if (!Directory.Exists(path)) {
-					Directory.CreateDirectory(path);
-				}
-				
-				properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", path);
-				propertyService.SetProperty ("SharpDevelop.CodeCompletion.DataDirectory", path);
-				propertyService.SaveProperties ();
-			}
-	    		return true;
-		}
-		
-		void SetEnableStatus(object sender, EventArgs e)
-		{
-			try
-			{
-				fEntry.Sensitive = specifyLocationRadioButton.Active;
-			}
-			catch
-			{
-			}
-			
-			SetFinishedState(sender, e);
-		}
-		
-		void SetFinishedState(object sender, EventArgs e)
-		{
-			FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-			try
-			{
-				EnableFinish = EnableNext = !specifyLocationRadioButton.Active ||
-  			                            (fileUtilityService.IsValidFileName(fEntry.Path) && 
-  			                            Directory.Exists(fEntry.Path));
-			}
-			catch
-			{
-			}
-		}
-		
-		void SetValues(object sender, EventArgs e)
-		{
-			properties = (IProperties)CustomizationObject;
-		}
-		
-		static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-		
-		public ChooseLocationPanel() : base()
-		{
-			VBox mainVBox = new VBox (false, 0);
-			NextWizardPanelID = "CreateDatabasePanel";
-			
-			fEntry = new FolderEntry ("Choose completion database location");
-			fEntry.DefaultPath = Environment.GetEnvironmentVariable ("HOME");
-			fEntry.PathChanged += new EventHandler (SetFinishedState);
-			
-			ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-			
-			RadioButton appDirRadioButton = new RadioButton ("Use current user's application directory");
-			appDirRadioButton.Active = true;
-			appDirRadioButton.Toggled += new EventHandler (SetEnableStatus);
-
-			//FIXME: only should be sensitive if you can write to it
-			sharpDevelopDirRadioButton = new RadioButton (appDirRadioButton, "Use SharpDevelop application directory");
-			sharpDevelopDirRadioButton.Toggled += new EventHandler (SetEnableStatus);
-			specifyLocationRadioButton = new RadioButton (appDirRadioButton, "Specify code completion database location");
-			specifyLocationRadioButton.Toggled += new EventHandler (SetEnableStatus);
-
-			TextView t = new TextView ();
-			t.Buffer.Text = resourceService.GetString ("Dialog.Wizards.CodeCompletionDatabaseWizard.ChooseLocationPanel.DescriptionText");
-			t.Editable = false;
-			t.CursorVisible = false;
-			t.WrapMode = Gtk.WrapMode.Word;
-			
-			HBox hbox = new HBox (false, 0);
-			hbox.PackStart (fEntry);
-		
-			mainVBox.PackStart (t, true, true, 0);
-			mainVBox.PackStart (specifyLocationRadioButton, false, true, 6);
-			mainVBox.PackStart (hbox, false, true, 6);
-			mainVBox.PackStart (sharpDevelopDirRadioButton, false, true, 6);
-			mainVBox.PackStart (appDirRadioButton, false, true, 6);
-			this.Add (mainVBox);
-		
-			SetFinishedState(this, EventArgs.Empty);
-			SetEnableStatus(this, EventArgs.Empty);
-			CustomizationObjectChanged += new EventHandler(SetValues);
-		}
-	}
-}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/CreateDatabasePanel.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/CreateDatabasePanel.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/CreateDatabasePanel.cs	2004-01-22 13:11:24.000000000 +1100
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/CreateDatabasePanel.cs	1970-01-01 10:00:00.000000000 +1000
@@ -1,177 +0,0 @@
-// <file>
-//     <copyright see="prj:///doc/copyright.txt"/>
-//     <license see="prj:///doc/license.txt"/>
-//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-//     <version value="$version"/>
-// </file>
-
-using System;
-using Gtk;
-
-using ICSharpCode.SharpDevelop.Internal.Project;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.Services;
-using ICSharpCode.SharpDevelop.Services;
-
-using ICSharpCode.Core.AddIns.Codons;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
-{
-	public class CreateDatabasePanel : AbstractWizardPanel, IProgressMonitor
-	{
-		IProperties properties;
-		GLib.IdleHandler iterate;
-		bool finished = false;
-		bool began = false;
-		int         totalWork = 0;
-		static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-		CheckButton fastCreationCheckBox = new CheckButton ("Enable fast database creation (=slower code completion)");
-		
-		public override bool ReceiveDialogMessage(DialogMessage message)
-		{
-	    	return true;
-		}
-		
-		void SetValues(object sender, EventArgs e)
-		{
-			properties = (IProperties)CustomizationObject;
-		}
-		
-		void StartCreation(object sender, EventArgs e)
-		{
-			ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-			if (began) {
-				SetProgressBarValue(0);
-				createButton.Label = resourceService.GetString("Dialog.Wizards.CodeCompletionDatabaseWizard.CreateDatabasePanel.StartCreationButton");
-				EnableCancel = EnablePrevious = true;
-				//fastCreationCheckBox.Active = true;
-			} else {
-				began = true;
-				EnableCancel = EnablePrevious = false;
-				//fastCreationCheckBox.Active = false;
-				iterate = new GLib.IdleHandler (CreateDatabase);
-				GLib.Idle.Add (iterate);
-				
-				createButton.Label = resourceService.GetString("Dialog.Wizards.CodeCompletionDatabaseWizard.CreateDatabasePanel.CancelCreationButton");
-			}
-		}
-				// changed to work during GLib.Idle
-		bool CreateDatabase()
-		{
-			try {
-				DefaultParserService parserService  = (DefaultParserService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(DefaultParserService));
-				string path  = properties.GetProperty("SharpDevelop.CodeCompletion.DataDirectory", String.Empty);
-				//Console.WriteLine (path);
-				if (fastCreationCheckBox.Active) {
-					parserService.GenerateCodeCompletionDatabaseFast(path, this);
-				} else {
-					parserService.GenerateEfficientCodeCompletionDatabase(path, this);
-				}
-			} catch (Exception e) {
-				ResourceService resourceService = (ResourceService) ServiceManager.Services.GetService (typeof (IResourceService));
-				MessageService messageService = (MessageService) ServiceManager.Services.GetService (typeof (IMessageService));
-				//Console.WriteLine (e.ToString ());
-				messageService.ShowError (resourceService.GetString("Dialog.Wizards.CodeCompletionDatabaseWizard.CreateDatabasePanel.CreateDbErrorMessage") + "\n" + e.ToString());
-				//throw e;
-			}
-			
-			//Console.WriteLine (!finished);
-			return !finished;
-		}
-
-		Gtk.Button createButton;
-		Gtk.ProgressBar progressBar;
-
-		static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-		public CreateDatabasePanel() : base()
-		{
-
-			createButton = new Gtk.Button ("Start database creation");
-			progressBar = new Gtk.ProgressBar ();
-			progressBar.BarStyle = Gtk.ProgressBarStyle.Continuous;
-		
-			NextWizardPanelID = "CreationSuccessful";
-			
-			EnableFinish      = false;
-			EnableNext        = false;
-			CustomizationObjectChanged += new EventHandler(SetValues);
-			
-			ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-			Gtk.TextView t = new Gtk.TextView ();
-			t.Buffer.Text = resourceService.GetString("Dialog.Wizards.CodeCompletionDatabaseWizard.CreateDatabasePanel.PanelDescription");
-			t.WrapMode = Gtk.WrapMode.Word;
-			t.Editable = false;
-			t.CursorVisible = false;
-			
-			Gtk.VBox mainbox = new Gtk.VBox (false, 2);
-			mainbox.PackStart (t);
-			mainbox.PackStart (fastCreationCheckBox, false, false, 2);
-			mainbox.PackStart (createButton, false, false, 2);
-			mainbox.PackStart (progressBar, false, false, 2);
-		
-			this.Add (mainbox);
-			
-			createButton.Clicked += new EventHandler(StartCreation);
-		}
-		
-		void SetButtonFinish(int val)
-		{
-			ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-			createButton.Label = resourceService.GetString("Dialog.Wizards.CodeCompletionDatabaseWizard.CreateDatabasePanel.FinishedCreationButton");
-			createButton.Sensitive = false;
-			progressBar.Sensitive = false;
-			EnableCancel = EnablePrevious = false;
-			EnableFinish = true;
-			FinishPanel();
-		}
-		
-		void SetProgressBarLimit(int val)
-		{
-		}
-		void SetProgressBarValue(int val)
-		{
-		}
-		
-		delegate void SetValue(int val);
-		
-		public void BeginTask(string name, int totalWork)
-		{
-			this.totalWork = totalWork;
-		}
-		
-		
-		public void Worked(int work, string status)
-		{
-			double tmp = (double) ((double)work / (double)totalWork);
-			progressBar.Fraction = tmp;
-			progressBar.Text = status;
-
-			while(Gtk.Application.EventsPending ()) {
-				Gtk.Application.RunIteration (true);
-			}
-		}
-		
-		public void Done()
-		{
-			finished = true;
-			progressBar.Fraction = 1;
-			SetButtonFinish (1);
-		}
-		
-		public bool Canceled {
-			get {
-				return false;
-			}
-			set {
-			}
-		}
-		
-		public string TaskName {
-			get {
-				return String.Empty;
-			}
-			set {
-			}
-		}
-	}
-}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/CreateDBGenerator.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/CreateDBGenerator.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/CreateDBGenerator.cs	1970-01-01 10:00:00.000000000 +1000
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/CreateDBGenerator.cs	2004-02-25 00:45:32.000000000 +1100
@@ -0,0 +1,30 @@
+using System;
+using System.IO;
+using Gtk;
+
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+
+using ICSharpCode.Core.AddIns.Codons;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
+{
+	public class CreateDBGenerator : CreatingGenerator, IDatabaseGenerator
+	{
+		public bool Fast;
+		public void Generate(IProgressMonitor progress)
+		{
+			DefaultParserService parserService  = (DefaultParserService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(DefaultParserService));
+			Console.WriteLine("using path " + path);
+			if (Fast) {
+				Console.WriteLine("Creating DB with fast process");
+				parserService.GenerateCodeCompletionDatabaseFast(path, progress);
+			} else {
+				Console.WriteLine("Creating DB with slow process");
+				parserService.GenerateEfficientCodeCompletionDatabase(path, progress);
+			}
+		}
+	}
+}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/CreatingGenerator.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/CreatingGenerator.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/CreatingGenerator.cs	1970-01-01 10:00:00.000000000 +1000
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/CreatingGenerator.cs	2004-02-25 00:45:32.000000000 +1100
@@ -0,0 +1,18 @@
+using System;
+using System.IO;
+using Gtk;
+
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+
+using ICSharpCode.Core.AddIns.Codons;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
+{
+	public abstract class CreatingGenerator
+	{
+		public string path;
+	}
+}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs	2004-01-29 08:34:46.000000000 +1100
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs	1970-01-01 10:00:00.000000000 +1000
@@ -1,41 +0,0 @@
-// <file>
-//     <copyright see="prj:///doc/copyright.txt"/>
-//     <license see="prj:///doc/license.txt"/>
-//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-//     <version value="$version"/>
-// </file>
-
-using System;
-using Gtk;
-
-using ICSharpCode.SharpDevelop.Internal.Project;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.Services;
-using ICSharpCode.SharpDevelop.Services;
-
-using ICSharpCode.Core.AddIns.Codons;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
-{
-	public class CreationFinishedPanel : AbstractWizardPanel
-	{
-		static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-		
-		public override bool ReceiveDialogMessage(DialogMessage message)
-		{
-	    		return true;
-		}
-		
-		static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-		public CreationFinishedPanel() : base()
-		{
-			EnableFinish      = true;
-			EnableNext        = false;
-			EnablePrevious    = false;
-			EnableCancel      = false;
-			IsLastPanel       = true;
-			
-			this.Add (new Label ("Creation Finished"));
-		}
-	}
-}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/druid.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/druid.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/druid.cs	1970-01-01 10:00:00.000000000 +1000
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/druid.cs	2004-02-25 01:51:31.000000000 +1100
@@ -0,0 +1,194 @@
+using System;
+using Gtk;
+using Gnome;
+
+using MonoDevelop.Gui.Widgets;
+using ICSharpCode.Core.Services;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard {
+class MethodSelectionPage : DruidPageStandard {
+	internal RadioButton generateDatabase;
+	internal RadioButton useExisting;
+	internal RadioButton download;
+	
+	internal MethodSelectionPage(CodeCompletionDruid druid) : base() {
+		generateDatabase = new RadioButton("Generate a code completion database");
+		useExisting = new RadioButton(generateDatabase, "Use a code completion database already on this computer");
+		download = new RadioButton(generateDatabase, "Download a code completion database");
+		this.NextClicked += new NextClickedHandler(druid.GoToMethodPage);
+		AppendItem("", generateDatabase, "");
+		AppendItem("", useExisting, "");
+//		AppendItem("", download, "");
+	}
+}
+
+
+class GenerateDatabasePage : DetailsPageBase {
+	internal RadioButton heavy;
+	internal RadioButton light;
+	
+	internal GenerateDatabasePage(CodeCompletionDruid druid) : base(druid) {
+		heavy = new RadioButton("Heavy process");
+		light = new RadioButton(heavy, "Light process");
+		AppendItem("", heavy, "This process is slower and more memory-intensive than the light process, but will enable faster code completion");
+		AppendItem("", light, "This process will take less time and memory to produce the code completion database, but code completion will be slower");
+	}
+}
+
+class UseExistingPage : DetailsPageBase {
+	internal MonoDevelop.Gui.Widgets.FolderEntry filename;
+	
+	internal UseExistingPage(CodeCompletionDruid druid) : base(druid) {
+		filename = new FolderEntry("Select code completion database");
+		filename.DefaultPath = System.IO.Directory.GetCurrentDirectory();
+		AppendItem("Where is the code completion database you would like to copy", filename, "");
+	}
+}
+
+class DownloadPage : DetailsPageBase {
+	internal Gtk.Entry uri;
+	
+	internal DownloadPage(CodeCompletionDruid druid) : base(druid) {
+		uri = new Gtk.Entry();
+		AppendItem("Where would you like to download the code completion database from?", uri, "");
+	}
+}
+
+abstract class DetailsPageBase : DruidPageStandard {
+	internal CodeCompletionDruid druid;
+
+	internal DetailsPageBase(CodeCompletionDruid Druid)
+	{
+		this.druid = Druid;
+		this.NextClicked += new NextClickedHandler(MoveNext);
+		this.BackClicked += new BackClickedHandler(MoveBack);
+	}
+
+	internal void MoveNext(object sender, NextClickedArgs args)
+	{
+		druid.PreviousPage = this;
+		druid.ShowLast();
+		args.RetVal = true;
+	}
+
+	internal void MoveBack(object sender, BackClickedArgs args)
+	{
+		druid.ShowMain();
+		args.RetVal = true;
+	}
+}
+
+
+public delegate void DruidFinished(object sender, IDatabaseGenerator generator);
+public delegate void DruidCanceled(object sender);
+
+class CodeCompletionDruid : Druid {
+	internal DruidPageEdge startPage = GetStartPage();
+	internal MethodSelectionPage methodSelectionPage;
+	internal GenerateDatabasePage generateDatabasePage;
+	internal UseExistingPage useExistingPage;
+	internal DownloadPage downloadPage;
+	internal DruidPageEdge endPage;
+
+	internal DruidPage PreviousPage;
+
+	public event DruidFinished Finished;
+	public event DruidCanceled Canceled;
+	public CodeCompletionDruid() : base()
+	{
+		methodSelectionPage = new MethodSelectionPage(this);
+		generateDatabasePage = new GenerateDatabasePage(this);
+		useExistingPage = new UseExistingPage(this);
+		downloadPage = new DownloadPage(this);
+		endPage = GetEndPage();
+
+		this.Cancel += new EventHandler(HandleCancel);
+
+		AppendPage(startPage);
+		AppendPage(methodSelectionPage);
+		AppendPage(generateDatabasePage);
+		AppendPage(useExistingPage);
+		AppendPage(downloadPage);
+		AppendPage(endPage);
+	}
+
+
+	internal void BackToMethodSelection(object sender, BackClickedArgs args)
+	{
+		this.Page = methodSelectionPage;
+	}
+
+	internal static DruidPageEdge GetStartPage()
+	{
+		DruidPageEdge page = new DruidPageEdge(EdgePosition.Start);
+		page.Text = "This druid will guide you through the process of creating a code completion database";
+		return page;
+	}
+
+	internal DruidPageEdge GetEndPage()
+	{
+		DruidPageEdge page = new DruidPageEdge(EdgePosition.Finish);
+		page.Text = "Click Accept to start the database creation process";
+		page.BackClicked += new BackClickedHandler(GoToPrev);
+		page.FinishClicked += new FinishClickedHandler(EndOfWizard);
+		return page;
+	}
+
+	internal void GoToPrev(object sender, BackClickedArgs args)
+	{
+		Page = PreviousPage;
+		args.RetVal = true;
+	}
+	
+	internal void EndOfWizard(object sender, FinishClickedArgs args)
+	{
+		Console.WriteLine("Finishing druid");
+		IDatabaseGenerator generator = null;
+		if (methodSelectionPage.generateDatabase.Active) {
+			generator = (IDatabaseGenerator)new CreateDBGenerator();
+			if (generateDatabasePage.light.Active)
+				((CreateDBGenerator)generator).Fast = true;
+		} else if (methodSelectionPage.useExisting.Active) {
+			generator = (IDatabaseGenerator)new UseExistingDBGenerator();
+			((UseExistingDBGenerator)generator).Path = useExistingPage.filename.Path;
+	//	} else if (methodSelectionPage.download.Active) {
+		}
+		if (Finished != null)
+			Finished(this, generator);
+	}
+
+	internal void ShowLast()
+	{
+		Page = endPage;
+	}
+	
+	internal void ShowMain()
+	{
+		Console.WriteLine("Showing main page...");
+		Page = methodSelectionPage;
+	}
+	
+	internal void GoToMethodPage(object sender, NextClickedArgs args)
+	{
+		if (methodSelectionPage.generateDatabase.Active) {
+			Page = generateDatabasePage;
+		} else if (methodSelectionPage.useExisting.Active) {
+			Page = useExistingPage;
+		} else if (methodSelectionPage.download.Active) {
+			Page = downloadPage;
+		}
+		args.RetVal = true;
+	}
+
+	internal void HandleCancel(object sender, EventArgs args)
+	{
+		MessageService messageService = (MessageService)ServiceManager.Services.GetService(typeof(MessageService));
+		bool really = messageService.AskQuestion("Are you sure you want to skip database creation? You will not have code completion functionality.", "Are you sure?");
+		Console.WriteLine("Really? " + really);
+		if (really) {
+			this.Destroy();
+			this.Canceled(this);
+		}
+	}
+}
+}
Binary files MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/.druid.cs.swp and MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/.druid.cs.swp differ
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/Exceptions.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/Exceptions.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/Exceptions.cs	1970-01-01 10:00:00.000000000 +1000
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/Exceptions.cs	2004-02-25 00:45:32.000000000 +1100
@@ -0,0 +1,18 @@
+using System;
+using Gtk;
+
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+
+using ICSharpCode.Core.AddIns.Codons;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
+{
+	public class PathNotCodeCompletionDatabaseException : ApplicationException
+	{
+		public PathNotCodeCompletionDatabaseException(string message) : base(message){}
+		public PathNotCodeCompletionDatabaseException(string message, Exception inner) : base(message, inner){}
+	}
+}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/GenerateDatabase.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/GenerateDatabase.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/GenerateDatabase.cs	1970-01-01 10:00:00.000000000 +1000
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/GenerateDatabase.cs	2004-02-25 01:39:02.000000000 +1100
@@ -0,0 +1,118 @@
+using System;
+using Gtk;
+
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
+{
+	class ProgressMonitorBar : Gtk.ProgressBar, IProgressMonitor
+	{
+		private bool canceled;
+		public void BeginTask(string name, int totalWork)
+		{
+			this.DiscreteBlocks = (uint)totalWork;
+		}
+				
+		public void Worked(int work, string status)
+		{
+			double f = (double)work / this.DiscreteBlocks;
+			Console.WriteLine("% is {0}", f);
+			this.Fraction = f;
+		}
+		public void Done()
+		{
+			this.Fraction = 1;
+		}
+		public bool Canceled {
+			get { return canceled;  }
+			set { canceled = value; }
+		}
+		public string TaskName {
+			get { return ""; }
+			set {  ;}
+		}
+	}
+
+	class GeneratorProgress : Gtk.Window
+	{
+		Gtk.Button cancel;
+		IDatabaseGenerator generator;
+		ProgressMonitorBar progress;
+		
+		public GeneratorProgress (IDatabaseGenerator generator) : base("Code completion database generator")
+		{
+			this.generator = generator;
+			
+			Gtk.VBox vb = new Gtk.VBox(false, 6);
+			this.Add(vb);
+				
+			vb.Add(new Gtk.Label("Creating database..."));
+
+			progress = new ProgressMonitorBar();
+			vb.Add(progress);
+
+			cancel = new Gtk.Button("Cancel");
+			cancel.Clicked += new EventHandler(DoCancel);
+			vb.Add(cancel);
+			this.ShowAll();
+			while (Gtk.Application.EventsPending ())
+				Gtk.Application.RunIteration ();
+		
+			generator.Generate(progress);
+			this.Destroy();
+		}
+
+		private void DoCancel(object sender, EventArgs args)
+		{
+			((Button)sender).Sensitive = false;
+			progress.Canceled = true;
+		}
+	}
+	
+	class GenerateDatabase {
+		Window druidHost;
+		
+		public void Start()
+		{
+			CodeCompletionDruid druid = new CodeCompletionDruid();
+			druidHost = new Gtk.Window("Code completion database druid");
+			druidHost.Add(druid);
+			druid.Finished += new DruidFinished(GotDruidData);
+			druid.Canceled += new DruidCanceled(DruidCanceled);
+			druidHost.ShowAll();
+
+		}
+
+		void GotDruidData(object sender, IDatabaseGenerator gen)
+		{
+			try {
+				druidHost.Destroy();
+				PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
+				string path = propertyService.GetProperty("SharpDevelop.CodeCompletion.DataDirectory", String.Empty);
+
+				if (gen is CreatingGenerator)
+					((CreatingGenerator)gen).path = path;
+
+				GeneratorProgress gp = new GeneratorProgress(gen);
+			} catch (Exception e) {
+				Console.WriteLine("Failed with exception " + e.GetType().Name + ": " + e.Message);
+				//FIXME: display error message
+				Start();
+			}
+/*			// restart  & exit 
+			ServiceManager.Services.UnloadAllServices();
+			// FIXME: handle this elegantly
+			// is it really necessary to restart here?
+			//System.Diagnostics.Process.Start(Path.Combine (Application.StartupPath, "SharpDevelop.exe"));
+			Gtk.Application.Quit ();*/
+
+		}
+
+		public void DruidCanceled(object o)
+		{
+			druidHost.Destroy();
+		}
+	}
+}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/IDatabaseGenerator.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/IDatabaseGenerator.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/IDatabaseGenerator.cs	1970-01-01 10:00:00.000000000 +1000
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/IDatabaseGenerator.cs	2004-02-25 00:45:32.000000000 +1100
@@ -0,0 +1,24 @@
+// <file>
+//     <copyright see="prj:///doc/copyright.txt"/>
+//     <license see="prj:///doc/license.txt"/>
+//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+//     <version value="$version"/>
+// </file>
+
+using System;
+using Gtk;
+
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+
+using ICSharpCode.Core.AddIns.Codons;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
+{
+	public interface IDatabaseGenerator
+	{
+		void Generate(IProgressMonitor monitor);
+	}
+}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/SetupPanel.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/SetupPanel.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/SetupPanel.cs	2004-01-10 11:25:20.000000000 +1100
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/SetupPanel.cs	1970-01-01 10:00:00.000000000 +1000
@@ -1,71 +0,0 @@
-// <file>
-//     <copyright see="prj:///doc/copyright.txt"/>
-//     <license see="prj:///doc/license.txt"/>
-//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-//     <version value="$version"/>
-// </file>
-
-using System;
-using Gtk;
-
-using ICSharpCode.SharpDevelop.Internal.Project;
-using ICSharpCode.Core.Properties;
-
-using ICSharpCode.Core.Services;
-using ICSharpCode.Core.AddIns.Codons;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
-{
-	public class SetupPanel : AbstractWizardPanel
-	{
-		static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-		
-		RadioButton useExistingRadioButton;
-		RadioButton createNewRadioButton;
-		RadioButton skipCreationRadioButton;
-		
-		void SetSuccessor(object sender, EventArgs e)
-		{
-			IsLastPanel = skipCreationRadioButton.Active;
-			
-			if (createNewRadioButton.Active) {
-				NextWizardPanelID = "ChooseLocationPanel";
-			} else if (useExistingRadioButton.Active) {
-				NextWizardPanelID = "UseExistingFilePanel";
-			}
-		}
-		
-		static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-		
-		public SetupPanel() : base()
-		{
-			ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-			string text = resourceService.GetString("Dialog.Wizards.CodeCompletionDatabaseWizard.SetupPanel.DescriptionText");
-			VBox mainVBox = new VBox (false, 0);
-
-			useExistingRadioButton = new RadioButton ("Use existing code completion database");
-			
-			createNewRadioButton = new RadioButton (useExistingRadioButton, "Create new code completion database");
-			createNewRadioButton.Active = true;
-			
-			skipCreationRadioButton = new RadioButton (useExistingRadioButton, "Do not create code completion database now");
-			TextView t = new TextView ();
-			t.Buffer.Text = text;
-
-			t.WrapMode = Gtk.WrapMode.Word;
-			t.Editable = false;
-			t.CursorVisible = false;
-
-			mainVBox.PackStart (t);
-			mainVBox.PackStart (useExistingRadioButton, false, true, 6);
-			mainVBox.PackStart (createNewRadioButton, false, true, 6);
-			mainVBox.PackStart (skipCreationRadioButton, false, true, 6);
-			this.Add (mainVBox);
-			
-			// FIXME: use an event that is only fired once
-			skipCreationRadioButton.Toggled += new EventHandler(SetSuccessor);
-			createNewRadioButton.Toggled += new EventHandler(SetSuccessor);
-			useExistingRadioButton.Toggled += new EventHandler(SetSuccessor);
-		}
-	}
-}
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs	2004-02-14 15:59:03.000000000 +1100
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs	1970-01-01 10:00:00.000000000 +1000
@@ -1,93 +0,0 @@
-// <file>
-//     <copyright see="prj:///doc/copyright.txt"/>
-//     <license see="prj:///doc/license.txt"/>
-//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-//     <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-using Gtk;
-
-using ICSharpCode.SharpDevelop.Internal.Project;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.Services;
-
-using MonoDevelop.Gui.Widgets;
-using ICSharpCode.Core.AddIns.Codons;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
-{
-	public class UseExistingFilePanel : AbstractWizardPanel
-	{
-		static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-		IProperties properties;
-		FolderEntry fEntry;
-		
-		public override bool ReceiveDialogMessage(DialogMessage message)
-		{
-			switch (message) {
-				case DialogMessage.Activated:
-					SetFinishedState(this, EventArgs.Empty);
-					break;
-				case DialogMessage.Prev:
-					EnableFinish = false;
-					break;
-			}
-			return true;
-		}
-
-		void OnPathChanged (object sender, EventArgs e)
-		{
-			SetFinishedState (sender, e);
-		}
-		
-		void SetFinishedState(object sender, EventArgs e)
-		{
-			FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-			string path = fEntry.Path;
-
-			EnableFinish = fileUtilityService.IsValidFileName(path) &&
-			               Directory.Exists(path) && 
-			               File.Exists(fileUtilityService.GetDirectoryNameWithSeparator(path) + "CodeCompletionProxyDataV02.bin");
-			if (EnableFinish) {
-				properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", path);
-				propertyService.SetProperty ("SharpDevelop.CodeCompletion.DataDirectory", path);
-				propertyService.SaveProperties ();
-			}
-		}
-		
-		void SetValues(object sender, EventArgs e)
-		{
-			properties = (IProperties)CustomizationObject;
-		}
-		
-		static PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-		public UseExistingFilePanel()
-		{
-			IsLastPanel       = true;
-			ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-			
-			VBox mainVBox  = new VBox (false, 0);
-			
-			TextView textBox = new TextView ();
-			textBox.WrapMode = WrapMode.Word;
-			textBox.Buffer.Text = resourceService.GetString ("Dialog.Wizards.CodeCompletionDatabaseWizard.UseExistingFilePanel.PanelDescription");
-			mainVBox.PackStart (textBox, false, true, 0);
-			mainVBox.PackStart (new Label ("Specify location of existing code completion database."));
-			
-			fEntry = new FolderEntry ("Select existing database location");
-			fEntry.DefaultPath = Environment.GetEnvironmentVariable ("HOME");
-			fEntry.PathChanged += new EventHandler (OnPathChanged);
-
-			HBox hbox = new HBox (false, 0);
-			hbox.PackStart (fEntry, false, true, 0);
-			SetFinishedState(this, EventArgs.Empty);
-			CustomizationObjectChanged += new EventHandler(SetValues);
-			
-			mainVBox.PackStart (hbox, false, true, 6);
-			this.Add (mainVBox);
-		}
-	}
-}
-
diff -urN MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingGenerator.cs MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingGenerator.cs
--- MonoDevelop.pristine/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingGenerator.cs	1970-01-01 10:00:00.000000000 +1000
+++ MonoDevelop.changes/src/Main/Base/Gui/CompletionDatabaseWizard/UseExistingGenerator.cs	2004-02-25 00:45:32.000000000 +1100
@@ -0,0 +1,40 @@
+using System;
+using System.IO;
+using Gtk;
+
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+
+using ICSharpCode.Core.AddIns.Codons;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels.CompletionDatabaseWizard
+{
+	public class UseExistingDBGenerator : IDatabaseGenerator
+	{
+		public string Path;
+		// changed to work during GLib.Idle
+		public void Generate(IProgressMonitor progress)
+		{
+			progress.BeginTask("Referencing existing database", 2);
+			FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+
+			if (!fileUtilityService.IsValidFileName(Path))
+				throw new PathNotCodeCompletionDatabaseException(Path + " is not a valid file name\n");
+			if (!Directory.Exists(Path))
+				throw new PathNotCodeCompletionDatabaseException("Directory " + Path + " does not exist");
+			if (!File.Exists(fileUtilityService.GetDirectoryNameWithSeparator(Path) + "CodeCompletionProxyDataV02.bin"))
+				throw new PathNotCodeCompletionDatabaseException(Path + " does not contain valid code completion data");
+
+
+			PropertyService propertyService = (PropertyService) ServiceManager.Services.GetService (typeof(PropertyService));
+			IProperties properties = (IProperties)propertyService;
+
+			properties.SetProperty("SharpDevelop.CodeCompletion.DataDirectory", Path);
+			propertyService.SetProperty ("SharpDevelop.CodeCompletion.DataDirectory", Path);
+			propertyService.SaveProperties ();
+			progress.Worked(2, "Referenced existing database");
+		}
+	}
+}
diff -urN MonoDevelop.pristine/src/Main/Base/Makefile.am MonoDevelop.changes/src/Main/Base/Makefile.am
--- MonoDevelop.pristine/src/Main/Base/Makefile.am	2004-02-22 16:16:51.000000000 +1100
+++ MonoDevelop.changes/src/Main/Base/Makefile.am	2004-02-25 00:45:32.000000000 +1100
@@ -120,11 +120,13 @@
 ./Gui/PadContentCollection.cs \
 ./Gui/PixbufList.cs \
 ./Gui/AbstractSecondaryViewContent.cs \
-./Gui/CompletionDatabaseWizard/CreateDatabasePanel.cs \
-./Gui/CompletionDatabaseWizard/CreationFinishedPanel.cs \
-./Gui/CompletionDatabaseWizard/UseExistingFilePanel.cs \
-./Gui/CompletionDatabaseWizard/SetupPanel.cs \
-./Gui/CompletionDatabaseWizard/ChooseLocationPanel.cs \
+./Gui/CompletionDatabaseWizard/CreateDBGenerator.cs \
+./Gui/CompletionDatabaseWizard/CreatingGenerator.cs \
+./Gui/CompletionDatabaseWizard/GenerateDatabase.cs \
+./Gui/CompletionDatabaseWizard/druid.cs \
+./Gui/CompletionDatabaseWizard/Exceptions.cs \
+./Gui/CompletionDatabaseWizard/IDatabaseGenerator.cs \
+./Gui/CompletionDatabaseWizard/UseExistingGenerator.cs \
 ./Gui/ViewContentCollection.cs \
 ./Gui/IWorkbenchWindow.cs \
 ./Gui/HtmlControl/IHTMLDocument2.cs \
diff -urN MonoDevelop.pristine/src/Main/Base/Services/ParserService/DefaultParserService.cs MonoDevelop.changes/src/Main/Base/Services/ParserService/DefaultParserService.cs
--- MonoDevelop.pristine/src/Main/Base/Services/ParserService/DefaultParserService.cs	2004-02-18 13:10:33.000000000 +1100
+++ MonoDevelop.changes/src/Main/Base/Services/ParserService/DefaultParserService.cs	2004-02-25 00:45:32.000000000 +1100
@@ -132,6 +132,16 @@
 				this.myClass           = c;
 			}
 		}
+
+		private bool ContinueWithProcess(IProgressMonitor progressMonitor)
+		{
+			while (Gtk.Application.EventsPending ())
+				Gtk.Application.RunIteration ();
+			if (progressMonitor.Canceled)
+				return false;
+			else
+				return true;
+		}
 		
 		public void GenerateCodeCompletionDatabaseFast(string createPath, IProgressMonitor progressMonitor)
 		{
@@ -167,10 +177,14 @@
 					if (progressMonitor != null) {
 						progressMonitor.Worked(i, "Writing database...");
 					}
+					if (!ContinueWithProcess(progressMonitor))
+						return;
 				} catch (Exception e) {
 					Console.WriteLine(e.ToString());
 				}
 				System.GC.Collect();
+				if (!ContinueWithProcess(progressMonitor))
+					return;
 			}
 
 			classWriter.Close();
@@ -204,6 +218,8 @@
 					Console.WriteLine(e.ToString());
 				}
 				System.GC.Collect();
+				if (!ContinueWithProcess(progressMonitor))
+					return;
 			}
 					
 			// create all class proxies
@@ -216,6 +232,8 @@
 				if (progressMonitor != null) {
 					progressMonitor.Worked(assemblyList.Length + (i * assemblyList.Length) / frameworkAssemblyInformation.Classes.Count, "Generating database...");
 				}
+				if (!ContinueWithProcess(progressMonitor))
+					return;
 			}
 
 			// write all classes and proxies to the disc
@@ -232,6 +250,8 @@
 				if (progressMonitor != null) {
 					progressMonitor.Worked(2 * assemblyList.Length + (i * assemblyList.Length) / frameworkAssemblyInformation.Classes.Count, "Writing database...");
 				}
+				if (!ContinueWithProcess(progressMonitor))
+					return;
 			}
 
 			classWriter.Close();

--=-K6ciL4OLYw5iLsU1LePL--