~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionsDialog.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
                public ExceptionsDialog()
51
51
                {
52
52
                        this.Build();
53
 
 
 
53
                        
54
54
                        storeExceptions = new ListStore (typeof(String));
55
55
                        treeExceptions.Selection.Mode = SelectionMode.Multiple;
56
56
                        treeExceptions.Model = storeExceptions;
57
57
                        treeExceptions.AppendColumn ("", new CellRendererText (), "text", 0);
58
58
                        tstateExc = new TreeViewState (treeExceptions, 0);
59
59
                        storeExceptions.SetSortColumnId (0, SortType.Ascending);
60
 
 
 
60
                        
61
61
                        storeSelection = new ListStore (typeof(String));
62
62
                        treeSelected.Selection.Mode = SelectionMode.Multiple;
63
63
                        treeSelected.Model = storeSelection;
69
69
                                selectedClasses.Add (cp.ExceptionName);
70
70
                        
71
71
                        LoadExceptions ();
72
 
 
 
72
                        
73
73
                        FillSelection ();
74
74
                        FillExceptions ();
75
75
                }
76
 
 
 
76
                
77
77
                void LoadExceptions ()
78
78
                {
79
79
                        classes.Add ("System.Exception");
82
82
                                foreach (var t in dom.FindType (typeof (Exception)).GetSubTypeDefinitions ())
83
83
                                        classes.Add (t.ReflectionName);
84
84
                        } else {
85
 
                                // no nead to unload this assembly context, it's not cached.
86
 
                                var unresolvedAssembly = TypeSystemService.LoadAssemblyContext (Runtime.SystemAssemblyService.CurrentRuntime, MonoDevelop.Core.Assemblies.TargetFramework.Default, typeof(Uri).Assembly.FullName);
87
 
                                var mscorlib = TypeSystemService.LoadAssemblyContext (Runtime.SystemAssemblyService.CurrentRuntime, MonoDevelop.Core.Assemblies.TargetFramework.Default, typeof(object).Assembly.FullName);
88
 
                                var dom = new ICSharpCode.NRefactory.TypeSystem.Implementation.SimpleCompilation (unresolvedAssembly, mscorlib);
89
 
                                foreach (var t in dom.FindType (typeof (Exception)).GetSubTypeDefinitions ())
90
 
                                        classes.Add (t.ReflectionName);
 
85
                                // no need to unload this assembly context, it's not cached.
 
86
                                var unresolvedAssembly = TypeSystemService.LoadAssemblyContext (Runtime.SystemAssemblyService.CurrentRuntime, MonoDevelop.Core.Assemblies.TargetFramework.Default, typeof(Uri).Assembly.Location);
 
87
                                var mscorlib = TypeSystemService.LoadAssemblyContext (Runtime.SystemAssemblyService.CurrentRuntime, MonoDevelop.Core.Assemblies.TargetFramework.Default, typeof(object).Assembly.Location);
 
88
                                if (unresolvedAssembly != null && mscorlib != null) {
 
89
                                        var dom = new ICSharpCode.NRefactory.TypeSystem.Implementation.SimpleCompilation (unresolvedAssembly, mscorlib);
 
90
                                        foreach (var t in dom.FindType (typeof (Exception)).GetSubTypeDefinitions ())
 
91
                                                classes.Add (t.ReflectionName);
 
92
                                }
91
93
                        }
92
94
                }
93
 
 
 
95
                
94
96
                void FillExceptions ()
95
97
                {
96
98
                        tstateExc.Save ();
97
99
                        storeExceptions.Clear ();
98
 
                        string filter = entryFilter.Text.ToLower ();
 
100
                        string filter = entryFilter.Text;
99
101
                        foreach (string t in classes) {
100
 
                                if ((filter.Length == 0 || t.ToLower().IndexOf (filter) != -1) && !selectedClasses.Contains (t))
 
102
                                if ((filter.Length == 0 || t.IndexOf (filter, StringComparison.OrdinalIgnoreCase) != -1) && !selectedClasses.Contains (t))
101
103
                                        storeExceptions.AppendValues (t);
102
104
                        }
103
105
                        tstateExc.Load ();
107
109
                                        treeExceptions.Selection.SelectIter (it);
108
110
                        }
109
111
                }
110
 
 
 
112
                
111
113
                void FillSelection ()
112
114
                {
113
115
                        tstateSel.Save ();
121
123
                                        treeSelected.Selection.SelectIter (it);
122
124
                        }
123
125
                }
124
 
 
 
126
                
125
127
                protected virtual void OnEntryFilterChanged (object sender, System.EventArgs e)
126
128
                {
127
129
                        if (!updateScheduled) {
133
135
                                });
134
136
                        }
135
137
                }
136
 
 
 
138
                
137
139
                protected virtual void OnButtonAddClicked (object sender, System.EventArgs e)
138
140
                {
139
141
                        foreach (TreePath path in treeExceptions.Selection.GetSelectedRows ()) {
147
149
                        FillSelection ();
148
150
                        FillExceptions ();
149
151
                }
150
 
 
 
152
                
151
153
                protected virtual void OnButtonRemoveClicked (object sender, System.EventArgs e)
152
154
                {
153
155
                        foreach (TreePath path in treeSelected.Selection.GetSelectedRows ()) {
161
163
                        FillSelection ();
162
164
                        FillExceptions ();
163
165
                }
164
 
 
 
166
                
165
167
                void SelectNearest (TreeView view)
166
168
                {
167
169
                        ListStore store = (ListStore) view.Model;
182
184
                                return;
183
185
                        }
184
186
                }
185
 
 
186
 
                protected virtual void OnEntryFilterActivated (object sender, System.EventArgs e)
 
187
                
 
188
                protected virtual void OnEntryFilterActivated (object sender, EventArgs e)
187
189
                {
188
190
                        OnButtonAddClicked (null, null);
189
191
                }
190
 
 
191
 
                protected virtual void OnButtonOkClicked (object sender, System.EventArgs e)
 
192
                
 
193
                protected virtual void OnButtonOkClicked (object sender, EventArgs e)
192
194
                {
193
195
                        foreach (Catchpoint cp in new List<Catchpoint> (DebuggingService.Breakpoints.GetCatchpoints ())) {
194
196
                                if (!selectedClasses.Contains (cp.ExceptionName))
199
201
                        foreach (string exc in selectedClasses)
200
202
                                DebuggingService.Breakpoints.AddCatchpoint (exc);
201
203
                }
202
 
 
 
204
                
203
205
                [GLib.ConnectBefore]
204
206
                protected virtual void OnTreeSelectedKeyPressEvent (object o, Gtk.KeyPressEventArgs args)
205
207
                {
208
210
                                args.RetVal = true;
209
211
                        }
210
212
                }
211
 
 
 
213
                
212
214
                [GLib.ConnectBefore]
213
215
                protected virtual void OnTreeSelectedButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
214
216
                {
215
217
                        if (args.Event.Button == 1 && args.Event.Type == Gdk.EventType.TwoButtonPress)
216
218
                                OnButtonRemoveClicked (o, args);
217
219
                }
218
 
 
 
220
                
219
221
                [GLib.ConnectBefore]
220
222
                protected virtual void OnTreeExceptionsKeyPressEvent (object o, Gtk.KeyPressEventArgs args)
221
223
                {
224
226
                                args.RetVal = true;
225
227
                        }
226
228
                }
227
 
 
 
229
                
228
230
                [GLib.ConnectBefore]
229
231
                protected virtual void OnTreeExceptionsButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
230
232
                {