[Mono-devel-list] A larger patch for the monodoc-browser

Philip Van Hoof spamfrommailing at freax.org
Wed May 14 16:50:35 EDT 2003


On Wed, 2003-05-14 at 22:08, Philip Van Hoof wrote:


> Hi there,
> 
> Because I wanted to learn gtk-sharp I decided to work on the monodoc-
> browser. I added a few things and cleaned up the code a little bit.

[CUT]

> - I finished the "Index"-tabpage: If you type in "System" and enter then
>   the listbox will be filled with all the classes in the namespace
>   "System". Clicking on such an item will take you to it's
>   documentation. Note: You can use Regular Expressions here.

And this extra patch adds a try-catch block for in case the user enters
an invalid Regular Expression .. ;)



[freax at pluisje browser]# diff -u browser.cs.freax browser.cs >
/home/freax/monodoc_patch_03.diff
[freax at pluisje browser]# pwd
/home/freax/cvs/monodoc/browser
[freax at pluisje browser]#


-- 
Philip Van Hoof a.k.a. freax
me at freax dot org
http://www.freax.be -- http://www.freax.eu.org -- http://www.freax.org


-------------- next part --------------
--- browser.cs.freax	2003-05-14 22:38:07.000000000 +0200
+++ browser.cs	2003-05-14 22:45:14.000000000 +0200
@@ -257,7 +257,17 @@
 	}
 
 	public void on_index_entry_activate (object o, EventArgs e) {
-		tree_browser.LookFor(index_entry.Text);
+		try {
+			tree_browser.LookFor(index_entry.Text);
+		} catch {
+			MessageDialog msgdlg = new MessageDialog (
+				MainWindow,
+				DialogFlags.Modal,
+				MessageType.Error,
+				ButtonsType.Ok,
+				"The Regular Expression that you typed is invalid");
+		}
+
 	}
 }
 
@@ -535,10 +545,8 @@
 	{
 		lookfor_store.Clear ();
 		TreeModel model = this.store;
-
 		// Compile a regular expression for this search
 		this.regex = new Regex(".*"+searchfor+".*");
-
 		// Loop each node
 		model.Foreach(new TreeModelForeachFunc (on_treeview_foreach));
 	}


More information about the Mono-devel-list mailing list