[Gtk-sharp-list] Re: [Mono-devel-list] A larger patch for the monodoc-browser

Philip Van Hoof spamfrommailing@freax.org
14 May 2003 22:50:35 +0200


--=-LBBwqwlZ5SVQ9M+2dS+z
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

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@pluisje browser]# diff -u browser.cs.freax browser.cs >
/home/freax/monodoc_patch_03.diff
[freax@pluisje browser]# pwd
/home/freax/cvs/monodoc/browser
[freax@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



--=-LBBwqwlZ5SVQ9M+2dS+z
Content-Disposition: attachment; filename=monodoc_patch_03.diff
Content-Type: text/plain; name=monodoc_patch_03.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

--- 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));
 	}

--=-LBBwqwlZ5SVQ9M+2dS+z--