/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/debug_tool/eb_exception_handler_cmd.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/debug_tool/eb_exception_handler_cmd.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 61886 - (show annotations)
Sun Jul 30 05:49:26 2006 UTC (13 years, 4 months ago) by manus
File size: 7932 byte(s)
EiffelStudio docking branch. It only contains modified classes needed to get the docking version of EiffelStudio.
1 indexing
2
3 description:
4 "Command to manage exception handling."
5 legal: "See notice at end of class."
6 status: "See notice at end of class."
7 date: "$Date$"
8 revision: "$Revision$"
9
10 class
11 EB_EXCEPTION_HANDLER_CMD
12
13 inherit
14 EB_TOOLBARABLE_AND_MENUABLE_COMMAND
15 redefine
16 tooltext
17 end
18
19 EB_CONSTANTS
20
21 EB_SHARED_DEBUG_TOOLS
22
23 EB_SHARED_WINDOW_MANAGER
24
25 create
26 make
27
28 feature {NONE} -- Initialization
29
30 make is
31 -- Initialize `Current'.
32 do
33 -- create accelerator.make_with_key_combination (
34 -- create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_f5),
35 -- True, False, True)
36 -- accelerator.actions.extend (agent execute)
37 end
38
39 feature -- Formatting
40
41 execute is
42 -- Pause the execution.
43 do
44 if handler_dialog = Void or else handler_dialog.is_destroyed then
45 build_handler_dialog
46 end
47
48 handler_dialog.show_relative_to_window (window_manager.last_focused_window.window)
49 handler_dialog.raise
50 end
51
52 feature -- Dialog
53
54 build_handler_dialog is
55 local
56 dialog: ES_EXCEPTION_HANDLER_DIALOG
57 app_exec: APPLICATION_EXECUTION
58 do
59 app_exec := Eb_debugger_manager.application
60 if app_exec.exceptions_handler.handling_mode_is_by_name then
61 check app_exec.is_dotnet end
62 create dialog
63 dialog.set_handler (app_exec.exceptions_handler)
64 handler_dialog := dialog
65 else
66 check app_exec.is_classic end
67 build_handler_by_code_dialog
68 end
69
70 end
71
72 handler_dialog: EV_DIALOG
73
74 feature {NONE} -- Attributes
75
76 description: STRING is
77 -- What appears in the customize dialog box.
78 do
79 Result := tooltip
80 end
81
82 tooltip: STRING is
83 -- Tooltip displayed on `Current's buttons.
84 do
85 Result := Interface_names.e_Dbg_exception_handler
86 end
87
88 tooltext: STRING is
89 -- Text displayed on `Current's buttons.
90 do
91 Result := Interface_names.b_Dbg_exception_handler
92 end
93
94 name: STRING is "Exception_handler"
95 -- Name of the command.
96
97 menu_name: STRING is
98 -- Menu entry corresponding to `Current'.
99 once
100 Result := Interface_names.m_Dbg_exception_handler
101 end
102
103 pixmap: EV_PIXMAP is
104 -- Pixmap representing `Current' on buttons.
105 do
106 Result := pixmaps.icon_pixmaps.debug_exception_handling_icon
107 end
108
109 feature -- Handler dialog by code
110
111 build_handler_by_code_dialog is
112 local
113 vb: EV_VERTICAL_BOX
114 glab: EV_GRID_LABEL_ITEM
115 g_row: EV_GRID_ROW
116 bt: EV_BUTTON
117 except_meanings: EXCEPTION_CODE_MEANING
118 c: INTEGER
119 app_excep_handler: DBG_EXCEPTION_HANDLER
120 fr: EV_FRAME
121 do
122 app_excep_handler := Eb_debugger_manager.application.exceptions_handler
123 if not app_excep_handler.handling_mode_is_by_code then
124 app_excep_handler.set_handling_by_code_mode
125 end
126
127 create handler_dialog
128 handler_dialog.set_title (interface_names.m_dbg_exception_handler)
129 handler_dialog.set_icon_pixmap (pixmaps.icon_pixmaps.general_dialog_icon)
130
131 create fr
132 create vb
133 fr.extend (vb)
134 create cb_ignore_external.make_with_text ("Ignore external exceptions")
135 cb_ignore_external.select_actions.extend (agent handle_ignore_external_changed)
136 vb.extend (cb_ignore_external)
137 create cb_handle_exception.make_with_text ("Enable exception handling")
138 cb_handle_exception.select_actions.extend (agent handle_exception_changed)
139 vb.extend (cb_handle_exception)
140
141 create vb
142 vb.set_padding_width (5)
143 vb.set_border_width (5)
144 vb.extend (fr)
145 vb.disable_item_expand (fr)
146
147 from
148 create except_meanings
149 create grid
150 grid.enable_border
151 grid.hide_header
152 grid.insert_new_rows (except_meanings.number_of_codes, 1)
153 c := 1
154 until
155 c > except_meanings.number_of_codes
156 loop
157 g_row := grid.row (c)
158 g_row.set_data (c)
159 create glab.make_with_text (c.out + ": " + except_meanings.exception_code_meaning (c))
160 glab.set_pixmap (pixmap_for_role (app_excep_handler.exception_role_for_code (c)))
161 g_row.set_item (1, glab)
162 c := c + 1
163 end
164 grid.enable_last_column_use_all_width
165 grid.column (1).resize_to_content
166 grid.set_minimum_height (grid.row_height * grid.row_count.min (10))
167 grid.pointer_double_press_item_actions.extend (agent double_clicked_on_grid_cell)
168 vb.extend (grid)
169
170 create bt.make_with_text_and_action ("Close", agent handler_dialog.hide)
171 vb.extend (bt)
172 vb.disable_item_expand (bt)
173 handler_dialog.extend (vb)
174 handler_dialog.set_default_cancel_button (bt)
175 handler_dialog.set_size (300, 400)
176 disable_grid
177 end
178
179 pixmap_for_role (r: INTEGER): EV_PIXMAP is
180 do
181 inspect r
182 when {DBG_EXCEPTION_HANDLER}.role_continue then
183 Result := continue_pixmap
184 when {DBG_EXCEPTION_HANDLER}.role_stop then
185 Result := stop_pixmap
186 else
187 check should_not_occur: False end
188 Result := stop_pixmap
189 end
190 end
191
192 grid: ES_GRID
193
194 cb_ignore_external,
195 cb_handle_exception: EV_CHECK_BUTTON
196
197 Continue_pixmap: EV_PIXMAP is
198 once
199 Result := pixmaps.icon_pixmaps.debug_run_icon
200 end
201
202 Stop_pixmap: EV_PIXMAP is
203 once
204 Result := pixmaps.icon_pixmaps.debug_pause_icon
205 end
206
207 handle_ignore_external_changed is
208 do
209 debugger_manager.application.exceptions_handler.ignore_external_exceptions (cb_ignore_external.is_selected)
210 end
211
212 handle_exception_changed is
213 do
214 if cb_handle_exception.is_selected then
215 debugger_manager.application.exceptions_handler.enable_exception_handling
216 enable_grid
217 else
218 debugger_manager.application.exceptions_handler.disable_exception_handling
219 disable_grid
220 end
221 end
222
223 disable_grid is
224 require
225 grid /= Void
226 do
227 grid.disable_sensitive
228 grid.set_background_color ((create {EV_STOCK_COLORS}).Color_read_only)
229 grid.set_foreground_color ((create {EV_STOCK_COLORS}).Color_3d_shadow)
230 end
231
232 enable_grid is
233 require
234 grid /= Void
235 do
236 grid.enable_sensitive
237 grid.set_default_colors
238 end
239
240 double_clicked_on_grid_cell (ax, ay, abut: INTEGER; gi: EV_GRID_ITEM) is
241 local
242 glab: EV_GRID_LABEL_ITEM
243 g_row: EV_GRID_ROW
244 ir: INTEGER_REF
245 ecode: INTEGER
246 app_excep_handler: DBG_EXCEPTION_HANDLER
247 do
248 app_excep_handler := eb_debugger_manager.application.exceptions_handler
249 if abut = 1 and then gi /= Void and then gi.is_parented then
250 glab ?= gi
251 if glab /= Void then
252 g_row := gi.row
253 ir ?= g_row.data
254 if ir /= Void then
255 ecode := ir.item
256 inspect
257 app_excep_handler.exception_role_for_code (ecode)
258 when {DBG_EXCEPTION_HANDLER}.role_continue then
259 app_excep_handler.catch_exception_by_code (ecode)
260 else
261 app_excep_handler.ignore_exception_by_code (ecode)
262 end
263 glab.set_pixmap (pixmap_for_role (app_excep_handler.exception_role_for_code (ecode)))
264 end
265 end
266 end
267 end
268
269 indexing
270 copyright: "Copyright (c) 1984-2006, Eiffel Software"
271 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
272 licensing_options: "http://www.eiffel.com/licensing"
273 copying: "[
274 This file is part of Eiffel Software's Eiffel Development Environment.
275
276 Eiffel Software's Eiffel Development Environment is free
277 software; you can redistribute it and/or modify it under
278 the terms of the GNU General Public License as published
279 by the Free Software Foundation, version 2 of the License
280 (available at the URL listed under "license" above).
281
282 Eiffel Software's Eiffel Development Environment is
283 distributed in the hope that it will be useful, but
284 WITHOUT ANY WARRANTY; without even the implied warranty
285 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
286 See the GNU General Public License for more details.
287
288 You should have received a copy of the GNU General Public
289 License along with Eiffel Software's Eiffel Development
290 Environment; if not, write to the Free Software Foundation,
291 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
292 ]"
293 source: "[
294 Eiffel Software
295 356 Storke Road, Goleta, CA 93117 USA
296 Telephone 805-685-1006, Fax 805-685-6869
297 Website http://www.eiffel.com
298 Customer support http://support.eiffel.com
299 ]"
300
301 end

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23