/[eiffelstudio]/trunk/Src/Eiffel/interface/graphical/tools/event_list_service/error_list/es_error_list_tool_panel.e
ViewVC logotype

Contents of /trunk/Src/Eiffel/interface/graphical/tools/event_list_service/error_list/es_error_list_tool_panel.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71346 - (show annotations)
Mon Dec 3 19:25:51 2007 UTC (12 years, 1 month ago) by paulb
File size: 32310 byte(s)
Supported optional selection exclusion for EB_GRID_EDITOR_TOKEN_ITEM to mirror that of the same functionality in EV_GRID_LABEL_ITEM.
Supported setting of selection background colors on EB_EDITOR_TOKEN_TEXT.
Updated the error list (and base implementation) tool to set correct grid selection colors and to disable selection for non applicable areas.
Error list is now-multiple select.
1 indexing
2 description: "[
3 An event list service {EVENT_LIST_S} tool to show all errors and warning event items in a single list in the EiffelStudio UI
4 ]"
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 ES_ERROR_LIST_TOOL_PANEL
12
13 inherit
14 ES_CLICKABLE_EVENT_LIST_TOOL_PANEL_BASE
15 redefine
16 build_tool_interface,
17 internal_recycle,
18 create_right_tool_bar_items,
19 is_appliable_event,
20 surpress_synchronization,
21 on_event_added,
22 on_event_removed,
23 update_content_applicable_widgets,
24 on_shown
25 end
26
27 ES_ERROR_LIST_COMMANDER_I
28 export
29 {ES_ERROR_LIST_COMMAND} all
30 end
31
32 create
33 make
34
35 feature {NONE} -- Iniitalization
36
37 build_tool_interface (a_widget: ES_GRID) is
38 -- Builds the tools user interface elements.
39 -- Note: This function is called prior to showing the tool for the first time.
40 --
41 -- `a_widget': A widget to build the tool interface using.
42 local
43 l_col: EV_GRID_COLUMN
44 l_session: SESSION_I
45 do
46 Precursor {ES_CLICKABLE_EVENT_LIST_TOOL_PANEL_BASE} (a_widget)
47 a_widget.set_column_count_to (position_column)
48
49 -- Create columns
50 l_col := a_widget.column (1)
51 l_col.set_width (20)
52 l_col := a_widget.column (category_column)
53 l_col.set_width (20)
54
55 l_col := a_widget.column (error_column)
56 l_col.set_title (interface_names.l_description)
57 l_col.set_width (100)
58
59 l_col := a_widget.column (context_column)
60 l_col.set_title (interface_names.l_context)
61 l_col.set_width (200)
62
63 l_col := a_widget.column (position_column)
64 l_col.set_title (interface_names.l_position)
65 l_col.set_width (80)
66
67 a_widget.enable_tree
68 a_widget.disable_row_height_fixed
69 a_widget.enable_auto_size_best_fit_column (error_column)
70 a_widget.enable_multiple_row_selection
71 a_widget.item_deactivate_actions.extend (agent (a_row: EV_GRID_ITEM)
72 do
73 -- Updates UI based on selection and row count.
74 update_content_applicable_widgets (grid_events.row_count > 0)
75 end)
76 a_widget.row_select_actions.extend (agent (a_row: EV_GRID_ROW)
77 do
78 -- Updates UI based on selection and row count.
79 update_content_applicable_widgets (grid_events.row_count > 0)
80 end)
81
82 -- Enable sorting
83 enable_sorting_on_columns (<<a_widget.column (category_column),
84 a_widget.column (error_column),
85 a_widget.column (context_column),
86 a_widget.column (position_column)>>)
87
88 -- Enable copying to clipboard
89 enable_copy_to_clipboard
90
91 -- Bind redirecting pick and drop actions
92 stone_director.bind (a_widget)
93
94 -- Set UI based on initial state
95 update_content_applicable_navigation_buttons
96
97 -- Hook up events for session data
98 if session_manager.is_service_available then
99 l_session := session_manager.service.retrieve (False)
100 l_session.value_changed_events.subscribe (agent on_session_value_changed)
101 if {l_expand: !BOOLEAN_REF} l_session.value_or_default (expand_errors_session_id, False) then
102 expand_errors := l_expand.item
103 if expand_errors then
104 expand_errors_button.enable_select
105 else
106 expand_errors_button.disable_select
107 end
108 end
109 end
110 end
111
112 feature {NONE} -- Clean up
113
114 internal_recycle is
115 -- Recycle tool.
116 do
117 if is_initialized then
118 stone_director.unbind (grid_events)
119
120 filter_widget.filter_changed_actions.prune (agent on_warnings_filter_changed)
121 errors_button.select_actions.prune (agent on_toogle_errors_button)
122 warnings_button.select_actions.prune (agent on_toogle_warnings_button)
123
124 if session_manager.is_service_available then
125 session_manager.service.retrieve (False).value_changed_events.unsubscribe (agent on_session_value_changed)
126 end
127
128 end
129 Precursor {ES_CLICKABLE_EVENT_LIST_TOOL_PANEL_BASE}
130 end
131
132 feature -- Access
133
134 error_count: NATURAL
135 -- Number of errors
136
137 warning_count: NATURAL
138 -- Number of warnings
139
140 feature {NONE} -- Status report
141
142 frozen surpress_synchronization: BOOLEAN
143 -- State to indicate if synchonization with the event list service should be suppressed
144 -- when initializing.
145
146 feature {NONE} -- User interface items
147
148 errors_button: SD_TOOL_BAR_TOGGLE_BUTTON
149 -- Toogle to show/hide error events
150
151 warnings_button: SD_TOOL_BAR_TOGGLE_BUTTON
152 -- Toogle to show/hide warning events
153
154 expand_errors_button: SD_TOOL_BAR_TOGGLE_BUTTON
155 -- Toogle to expanded error events automatically
156
157 error_info_button: SD_TOOL_BAR_BUTTON
158 -- Error information button
159
160 filter_button: SD_TOOL_BAR_POPUP_BUTTON
161 -- Filter button to filter information in list
162
163 filter_widget: ES_WARNINGS_FILTER_WIDGET
164 -- Filter widget
165
166 feature {NONE} -- Command items
167
168 error_info_command: EB_ERROR_INFORMATION_CMD
169 -- Error information command
170
171 go_to_next_error_command: ES_NEXT_ERROR_COMMAND
172 -- Go to next error command
173 do
174 Result := develop_window.commands.go_to_next_error_command
175 ensure
176 result_attached: Result /= Void
177 end
178
179 go_to_previous_error_command: ES_PREVIOUS_ERROR_COMMAND
180 -- Go to previous error command
181 do
182 Result := develop_window.commands.go_to_previous_error_command
183 ensure
184 result_attached: Result /= Void
185 end
186
187 go_to_next_warning_command: ES_NEXT_WARNING_COMMAND
188 -- Go to next warning command
189 do
190 Result := develop_window.commands.go_to_next_warning_command
191 ensure
192 result_attached: Result /= Void
193 end
194
195 go_to_previous_warning_command: ES_PREVIOUS_WARNING_COMMAND
196 -- Go to previous warning command
197 do
198 Result := develop_window.commands.go_to_previous_warning_command
199 ensure
200 result_attached: Result /= Void
201 end
202
203 feature {NONE} -- Query
204
205 event_context_stone (a_event_item: EVENT_LIST_ITEM_I): STONE
206 -- Retrieve an event item's context stone, if one is available
207 --
208 -- `a_event_item': An event item to retrieve a strone from.
209 -- `Result': A context stone, if any.
210 require
211 a_event_item_attached: a_event_item /= Void
212 is_appliable_event: is_appliable_event (a_event_item)
213 local
214 l_row: EV_GRID_ROW
215 l_error: ERROR
216 l_line: INTEGER
217 l_classi_stone: CLASSI_STONE
218 l_classc_stone: CLASSC_STONE
219 l_line_stone: LINE_STONE
220 do
221 l_row := find_event_row (a_event_item)
222 if l_row /= Void then
223 Result ?= l_row.item (context_column).data
224 if Result /= Void then
225 l_error ?= a_event_item.data
226 if l_error /= Void then
227 l_line := l_error.line
228 if l_line > 0 then
229 l_classc_stone ?= Result
230 if l_classc_stone /= Void then
231 create {COMPILED_LINE_STONE}Result.make_with_line (l_classc_stone.e_class, l_line, True)
232 else
233 l_classi_stone ?= Result
234 create {UNCOMPILED_LINE_STONE}Result.make_with_line (l_classi_stone.class_i, l_line, True)
235 end
236 l_line_stone ?= Result
237 if l_line_stone /= Void then
238 l_line_stone.set_should_line_be_selected (True)
239 if l_error.column > 0 then
240 l_line_stone.set_column_number (l_error.column)
241 end
242 end
243 end
244 end
245 end
246 end
247 end
248
249 is_appliable_event (a_event_item: EVENT_LIST_ITEM_I): BOOLEAN
250 -- Determines if event `a_event_item' can be shown with the current event list tool
251 do
252 Result := is_error_event (a_event_item) or is_warning_event (a_event_item)
253 end
254
255 is_error_event (a_event_item: EVENT_LIST_ITEM_I): BOOLEAN
256 -- Determines if event `a_event_item' is an error event
257 do
258 if a_event_item.type = {EVENT_LIST_ITEM_TYPES}.error then
259 Result := not is_warning_event (a_event_item) and then (({ERROR}) #? a_event_item.data) /= Void
260 end
261 ensure
262 not_is_warning_event: Result implies not is_warning_event (a_event_item)
263 end
264
265 is_warning_event (a_event_item: EVENT_LIST_ITEM_I): BOOLEAN
266 -- Determines if event `a_event_item' is an error event
267 require
268 a_event_item_attached: a_event_item /= Void
269 do
270 if a_event_item.type = {EVENT_LIST_ITEM_TYPES}.error then
271 Result := (({WARNING}) #? a_event_item.data) /= Void
272 end
273 ensure
274 not_is_error_event: Result implies not is_error_event (a_event_item)
275 end
276
277 feature -- Status report
278
279 show_errors: BOOLEAN
280 -- Indicates if errors should be shown
281 do
282 Result := not is_initialized or else errors_button.is_selected
283 end
284
285 show_warnings: BOOLEAN
286 -- Indicates if errors should be shown
287 do
288 Result := not is_initialized or else warnings_button.is_selected
289 end
290
291 expand_errors: BOOLEAN
292 -- Indicates if errors should be shown automatically
293
294 feature {ES_ERROR_LIST_TOOL} -- Navigation
295
296 go_to_next_error (a_cycle: BOOLEAN)
297 -- Goes to next error in the list.
298 --
299 -- `a_cycle': Specify true to jump back to the beginning of the list when reaching the end, False to perform
300 -- not action when the end has been reached.
301 do
302 if show_errors then
303 if error_count > 0 then
304 move_next (agent (a_item: EVENT_LIST_ITEM_I): BOOLEAN
305 require
306 a_item_attached: a_item /= Void
307 do
308 Result := is_error_event (a_item) and then
309 (event_context_stone (a_item) /= Void or
310 -- C compiler errors have not context stone so we need to account for this.
311 ({C_COMPILER_ERROR}) #? a_item.data /= Void)
312 end)
313 end
314 end
315 end
316
317 go_to_previous_error (a_cycle: BOOLEAN)
318 -- Goes to previous error in the list.
319 --
320 -- `a_cycle': Specify true to jump to the end of the list when reaching the start, False to perform
321 -- not action when the start has been reached.
322 do
323 if show_errors then
324 if error_count > 0 then
325 move_previous (agent (a_item: EVENT_LIST_ITEM_I): BOOLEAN
326 require
327 a_item_attached: a_item /= Void
328 do
329 Result := is_error_event (a_item) and then
330 (event_context_stone (a_item) /= Void or
331 -- C compiler errors have not context stone so we need to account for this.
332 ({C_COMPILER_ERROR}) #? a_item.data /= Void)
333 end)
334 end
335 end
336 end
337
338 go_to_next_warning (a_cycle: BOOLEAN)
339 -- Goes to next warning in the list.
340 --
341 -- `a_cycle': Specify true to jump back to the beginning of the list when reaching the end, False to perform
342 -- not action when the end has been reached.
343 do
344 if show_warnings then
345 if warning_count > 0 then
346 move_next (agent (a_item: EVENT_LIST_ITEM_I): BOOLEAN
347 require
348 a_item_attached: a_item /= Void
349 do
350 Result := is_warning_event (a_item) and then event_context_stone (a_item) /= Void
351 end)
352 end
353 end
354 end
355
356 go_to_previous_warning (a_cycle: BOOLEAN)
357 -- Goes to previous warning in the list.
358 --
359 -- `a_cycle': Specify true to jump to the end of the list when reaching the start, False to perform
360 -- not action when the start has been reached.
361 do
362 if show_warnings then
363 if warning_count > 0 then
364 move_previous (agent (a_item: EVENT_LIST_ITEM_I): BOOLEAN
365 require
366 a_item_attached: a_item /= Void
367 do
368 Result := is_warning_event (a_item) and then event_context_stone (a_item) /= Void
369 end)
370 end
371 end
372 end
373
374 feature {NONE} -- Basic operations
375
376 do_default_action (a_row: EV_GRID_ROW) is
377 -- Performs a default actions for a given row.
378 --
379 -- `a_row': The row the user requested an action to be performed on.
380 local
381 l_event_item: EVENT_LIST_ITEM_I
382 l_stone: STONE
383 l_error: C_COMPILER_ERROR
384 l_tool: ES_C_OUTPUT_TOOL_PANEL
385 do
386 l_event_item ?= a_row.data
387 if l_event_item /= Void then
388 l_error ?= l_event_item.data
389 if l_error /= Void then
390 -- Show the C/C++ compiler output
391 l_tool ?= develop_window.shell_tools.tool ({ES_C_OUTPUT_TOOL}).panel
392 if l_tool /= Void then
393 l_tool.scroll_to_end
394 l_tool.force_display
395 end
396 else
397 l_stone := event_context_stone (l_event_item)
398 if l_stone /= Void and then l_stone.is_valid then
399 (create {EB_CONTROL_PICK_HANDLER}).launch_stone (l_stone)
400 end
401 end
402 end
403 end
404
405 feature {NONE} -- Events
406
407 on_shown
408 -- Perform update actions when the tool is displayed.
409 do
410 Precursor
411 if filter_widget /= Void then
412 filter_widget.on_shown
413 end
414 end
415
416 on_event_added (a_service: EVENT_LIST_S; a_event_item: EVENT_LIST_ITEM_I)
417 -- Called when a event item is added to the event service.
418 --
419 -- `a_service': Event service where event was added.
420 -- `a_event_item': The event item added to the service.
421 local
422 l_applicable: BOOLEAN
423 do
424 l_applicable := is_appliable_event (a_event_item)
425 if l_applicable and not is_initialized then
426 -- We have to perform initialization to set the icon and counter.
427 -- Synchronization with the event list service is surpress to prevent duplication of event items being added.
428 surpress_synchronization := True
429 initialize
430 end
431
432 Precursor {ES_CLICKABLE_EVENT_LIST_TOOL_PANEL_BASE} (a_service, a_event_item)
433
434 if l_applicable then
435 if is_error_event (a_event_item) then
436 set_error_count (error_count + 1)
437 elseif is_warning_event (a_event_item) then
438 set_warning_count (warning_count + 1)
439 else
440 check False end
441 end
442 update_content_applicable_navigation_buttons
443 end
444 ensure then
445 is_initialized: is_appliable_event (a_event_item) implies is_initialized
446 end
447
448 on_event_removed (a_service: EVENT_LIST_S; a_event_item: EVENT_LIST_ITEM_I) is
449 -- Called after a event item has been removed from the service `a_service'
450 --
451 -- `a_service': Event service where the event was removed.
452 -- `a_event_item': The event item removed from the service.
453 local
454 l_applicable: BOOLEAN
455 do
456 l_applicable := is_appliable_event (a_event_item)
457 if l_applicable and not is_initialized then
458 -- We have to perform initialization to set the icon and counter
459 -- Synchronization with the event list service is surpress to prevent duplication of event items being added.
460 surpress_synchronization := True
461 initialize
462 end
463
464 Precursor {ES_CLICKABLE_EVENT_LIST_TOOL_PANEL_BASE} (a_service, a_event_item)
465 if l_applicable then
466 if is_error_event (a_event_item) then
467 set_error_count (error_count - 1)
468 elseif is_warning_event (a_event_item) then
469 set_warning_count (warning_count - 1)
470 else
471 check False end
472 end
473 update_content_applicable_navigation_buttons
474 end
475 ensure then
476 is_initialized: is_appliable_event (a_event_item) implies is_initialized
477 end
478
479 on_toogle_errors_button is
480 -- Called when `errors_button' is selected
481 local
482 l_row: EV_GRID_ROW
483 l_event_item: EVENT_LIST_ITEM_I
484 l_count, i: INTEGER
485 do
486 from
487 i := 1
488 l_count := grid_events.row_count
489 until
490 i > l_count
491 loop
492 l_row := grid_events.row (i)
493 l_event_item ?= l_row.data
494 if l_event_item /= Void then
495 if is_error_event (l_event_item) then
496 if show_errors then
497 l_row.show
498 else
499 l_row.hide
500 end
501 end
502 end
503 i := i + 1
504 end
505
506 update_content_applicable_navigation_buttons
507 end
508
509 on_toogle_warnings_button is
510 -- Called when `warnings_button' is selected
511 local
512 l_row: EV_GRID_ROW
513 l_event_item: EVENT_LIST_ITEM_I
514 l_warning: WARNING
515 l_filter_widget: like filter_widget
516 l_show: BOOLEAN
517 l_count, i: INTEGER
518 do
519 l_filter_widget := filter_widget
520 l_show := show_warnings
521 from
522 i := 1
523 l_count := grid_events.row_count
524 until
525 i > l_count
526 loop
527 l_row := grid_events.row (i)
528 l_event_item ?= l_row.data
529 if l_event_item /= Void then
530 if is_warning_event (l_event_item) then
531 l_warning ?= l_event_item.data
532 check l_warning_attached: l_warning /= Void end
533 if l_warning /= Void and then l_show and l_filter_widget.is_unfiltered (l_warning) then
534 l_row.show
535 else
536 l_row.hide
537 end
538 end
539 end
540 i := i + 1
541 end
542
543 update_content_applicable_navigation_buttons
544 end
545
546 on_toggle_expand_errors_button
547 -- Called when the expand error button is selected
548 local
549 l_expand: BOOLEAN
550 l_grid: like grid_events
551 l_row: EV_GRID_ROW
552 l_event_item: EVENT_LIST_ERROR_ITEM_I
553 l_count, i: INTEGER
554 do
555 l_expand := expand_errors_button.is_selected
556 if expand_errors /= l_expand then
557 expand_errors := l_expand
558 if session_manager.is_service_available then
559 session_manager.service.retrieve (False).set_value (l_expand, expand_errors_session_id)
560 end
561
562 -- Set applicable grid items and open/closed because on expanded status
563 l_grid := grid_events
564 from
565 i := 1
566 l_count := l_grid.row_count
567 until
568 i > l_count
569 loop
570 l_row := l_grid.row (i)
571 if l_row.is_expandable then
572 l_event_item ?= l_row.data
573 if l_event_item /= Void and then is_error_event (l_event_item) then
574 if l_expand then
575 l_row.expand
576 else
577 l_row.collapse
578 end
579 end
580 end
581 i := i + 1
582 end
583 end
584 ensure
585 expand_errors_set: expand_errors = expand_errors_button.is_selected
586 end
587
588 on_error_info
589 -- Call when the error information button is clicked
590 local
591 l_event: EVENT_LIST_ITEM_I
592 l_error: ERROR
593 do
594 if grid_events.selected_rows.is_empty then
595 error_info_command.execute
596 else
597 -- Retrieve event item set from {ES_EVENT_LIST_TOOL_PANEL_BASE}.on_event_added
598 l_event ?= grid_events.selected_rows.first.data
599 check
600 l_event_attached: l_event /= Void
601 end
602 -- Now retrieve error item
603 l_error ?= l_event.data
604 check
605 l_error_attached: l_error /= Void
606 end
607 error_info_command.execute_with_stone (create {ERROR_STONE}.make (l_error))
608 end
609 end
610
611 on_warnings_filter_changed (a_type: TYPE [ANY]; a_exact_only: BOOLEAN; a_exclude: BOOLEAN)
612 -- Called when the filter has been changed
613 local
614 l_filter: ES_WARNINGS_FILTER_WIDGET
615 l_grid: like grid_events
616 l_row: EV_GRID_ROW
617 l_event: EVENT_LIST_ITEM_I
618 l_warning: WARNING
619 l_count, i: INTEGER
620 do
621 l_filter := filter_widget
622 l_grid := grid_events
623 from l_count := l_grid.row_count; i := 1 until i > l_count loop
624 l_row := l_grid.row (i)
625 if a_exclude /= not l_row.is_show_requested then
626 l_event ?= l_row.data
627 if l_event /= Void and then is_warning_event (l_event) then
628 l_warning ?= l_event.data
629 if l_warning /= Void then
630 if not l_filter.is_unfiltered (l_warning) then
631 if a_exclude then
632 l_row.hide
633 end
634 else
635 if not a_exclude then
636 l_row.show
637 end
638 end
639 end
640 end
641 end
642
643 if l_row.subrow_count_recursive > 1 then
644 i := i + l_row.subrow_count_recursive
645 else
646 i := i + 1
647 end
648 end
649
650 if l_filter.filtered.is_empty then
651 filter_button.set_pixel_buffer (stock_pixmaps.errors_and_warnings_filter_icon_buffer)
652 filter_button.set_pixmap (stock_pixmaps.errors_and_warnings_filter_icon)
653 else
654 filter_button.set_pixel_buffer (stock_pixmaps.errors_and_warnings_filter_active_icon_buffer)
655 filter_button.set_pixmap (stock_pixmaps.errors_and_warnings_filter_active_icon)
656 end
657 end
658
659 on_session_value_changed (a_session: SESSION; a_id: STRING_8) is
660 -- Called when the session changes
661 require
662 not_is_recycled: not is_recycled
663 a_session_attached: a_session /= Void
664 a_session_is_interface_usable: a_session.is_interface_usable
665 do
666 if a_id.is_equal (expand_errors_session_id) then
667 -- Retrieve global session
668 if {l_expand: !BOOLEAN_REF} a_session.value_or_default (expand_errors_session_id, False) then
669 if expand_errors /= l_expand.item then
670 expand_errors := l_expand.item
671 if expand_errors then
672 expand_errors_button.enable_select
673 else
674 expand_errors_button.disable_select
675 end
676 on_toggle_expand_errors_button
677 end
678 end
679 end
680 end
681
682 feature {NONE} -- Factory
683
684 create_tool_bar_items: DS_ARRAYED_LIST [SD_TOOL_BAR_ITEM]
685 -- Available tool bar items
686 do
687 create errors_button.make
688 errors_button.set_text ("0 Errors")
689 errors_button.set_pixmap (stock_pixmaps.tool_error_icon)
690 errors_button.set_pixel_buffer (stock_pixmaps.tool_error_icon_buffer)
691 errors_button.enable_select
692 errors_button.select_actions.extend (agent on_toogle_errors_button)
693 errors_button.select_actions.compare_objects
694
695 create warnings_button.make
696 warnings_button.set_text ("0 Warnings")
697 warnings_button.set_pixmap (stock_pixmaps.tool_warning_icon)
698 warnings_button.set_pixel_buffer (stock_pixmaps.tool_warning_icon_buffer)
699 warnings_button.enable_select
700 warnings_button.select_actions.extend (agent on_toogle_warnings_button)
701 warnings_button.select_actions.compare_objects
702
703 create Result.make (3)
704 Result.put_last (errors_button)
705 Result.put_last (create {SD_TOOL_BAR_SEPARATOR}.make)
706 Result.put_last (warnings_button)
707 ensure then
708 errors_button_attached: errors_button /= Void
709 warnings_button_attached: warnings_button /= Void
710 end
711
712 create_right_tool_bar_items: DS_ARRAYED_LIST [SD_TOOL_BAR_ITEM]
713 -- Available tool bar items
714 local
715 l_button: SD_TOOL_BAR_BUTTON
716 do
717 create Result.make (8)
718
719 -- Navigation buttons
720 l_button := go_to_next_error_command.new_sd_toolbar_item (False)
721 Result.put_last (l_button)
722
723 l_button := go_to_previous_error_command.new_sd_toolbar_item (False)
724 Result.put_last (l_button)
725
726 l_button := go_to_next_warning_command.new_sd_toolbar_item (False)
727 Result.put_last (l_button)
728
729 l_button := go_to_previous_warning_command.new_sd_toolbar_item (False)
730 Result.put_last (l_button)
731
732 -- Separator
733 Result.put_last (create {SD_TOOL_BAR_SEPARATOR}.make)
734
735 -- Automatic expand error button
736 create expand_errors_button.make
737 expand_errors_button.set_pixmap (stock_pixmaps.errors_and_warnings_expand_errors_icon)
738 expand_errors_button.set_pixel_buffer (stock_pixmaps.errors_and_warnings_expand_errors_icon_buffer)
739 expand_errors_button.set_tooltip (interface_names.f_toogle_expand_errors)
740 expand_errors_button.select_actions.extend (agent on_toggle_expand_errors_button)
741 expand_errors_button.select_actions.compare_objects
742 Result.put_last (expand_errors_button)
743
744 create error_info_command.make
745 error_info_button := error_info_command.new_sd_toolbar_item (False)
746 -- We need to do something else, like handle grid selection
747 error_info_button.select_actions.wipe_out
748 error_info_button.select_actions.extend (agent on_error_info)
749 Result.put_last (error_info_button)
750
751 -- Filter pop up widget
752 create filter_widget.make
753 filter_widget.filter_changed_actions.extend (agent on_warnings_filter_changed)
754
755 -- Filter button
756 create filter_button.make
757 filter_button.set_pixmap (stock_pixmaps.metric_filter_icon)
758 filter_button.set_pixel_buffer (stock_pixmaps.metric_filter_icon_buffer)
759 filter_button.set_tooltip (interface_names.f_filter_warnings)
760 filter_button.set_popup_widget (filter_widget)
761
762 Result.put_last (filter_button)
763 ensure then
764 filter_button_attached: filter_button /= Void
765 end
766
767 feature {NONE} -- User interface manipulation
768
769 set_error_count (a_count: like error_count)
770 -- Sets `error_count' to `a_count'
771 local
772 l_text: STRING_32
773 do
774 error_count := a_count
775 create l_text.make (20)
776 l_text.append_natural_32 (a_count)
777 l_text.append_character (' ')
778 if a_count = 1 then
779 l_text.append_string (interface_names.b_error)
780 else
781 l_text.append_string (interface_names.b_errors)
782 end
783 errors_button.set_text (l_text)
784 update_tool_title_and_pixmap
785
786 ensure
787 error_count_set: error_count = a_count
788 end
789
790 set_warning_count (a_count: like warning_count)
791 -- Sets `warning_count' to `a_count'
792 local
793 l_text: STRING_32
794 do
795 warning_count := a_count
796 create l_text.make (20)
797 l_text.append_natural_32 (a_count)
798 l_text.append_character (' ')
799 if a_count = 1 then
800 l_text.append_string (interface_names.b_warning)
801 else
802 l_text.append_string (interface_names.b_warnings)
803 end
804 warnings_button.set_text (l_text)
805 update_tool_title_and_pixmap
806 ensure
807 warning_count_set: warning_count = a_count
808 end
809
810 update_tool_title_and_pixmap is
811 -- Sets the tool's title an pixmap based on the number of items existing in the list
812 local
813 l_title: STRING_32
814 l_buffer: EV_PIXEL_BUFFER
815 do
816 l_title := interface_names.t_errors_and_warnings_tool.twin
817 if item_count > 0 then
818 l_title := l_title + " (" + error_count.out + "|" + warning_count.out + ")"
819 if error_count > 0 and warning_count > 0 then
820 l_buffer := stock_pixmaps.tool_errors_list_with_errors_and_warnings_icon_buffer
821 elseif error_count > 0 then
822 l_buffer := stock_pixmaps.tool_errors_list_with_errors_icon_buffer
823 elseif warning_count > 0 then
824 l_buffer := stock_pixmaps.tool_errors_list_with_warnings_icon_buffer
825 else
826 check False end
827 end
828 end
829
830 if l_title /= Void and then not l_title.is_empty then
831 set_title (l_title)
832 end
833 if l_buffer /= Void then
834 set_icon (l_buffer)
835 else
836 set_icon (stock_pixmaps.tool_errors_list_with_errors_icon_buffer)
837 end
838 end
839
840 update_content_applicable_widgets (a_enable: BOOLEAN)
841 -- Updates widgets on tool that require content to exist
842 --
843 -- `a_enable': True to indicate there is content available, False otherwise
844 do
845 if a_enable and grid_events.selected_rows.count = 1 then
846 error_info_command.enable_sensitive
847 else
848 error_info_command.disable_sensitive
849 end
850 end
851
852 update_content_applicable_navigation_buttons
853 -- Updates content applicable navigation buttons
854 do
855 if error_count > 0 and errors_button.is_selected then
856 go_to_next_error_command.enable_sensitive
857 go_to_previous_error_command.enable_sensitive
858 else
859 go_to_next_error_command.disable_sensitive
860 go_to_previous_error_command.disable_sensitive
861 end
862
863 if warning_count > 0 and warnings_button.is_selected then
864 go_to_next_warning_command.enable_sensitive
865 go_to_previous_warning_command.enable_sensitive
866 else
867 go_to_next_warning_command.disable_sensitive
868 go_to_previous_warning_command.disable_sensitive
869 end
870 end
871
872 populate_event_grid_row_items (a_event_item: EVENT_LIST_ITEM_I; a_row: EV_GRID_ROW)
873 -- Populates a grid row's item on a given row using the event `a_event_item'.
874 --
875 -- `a_event_item': A event to base the creation of a grid row on.
876 -- `a_row': The row to create items on.
877 local
878 l_editor_item: EB_GRID_EDITOR_TOKEN_ITEM
879 l_gen: EB_EDITOR_TOKEN_GENERATOR
880 l_item: EV_GRID_LABEL_ITEM
881 l_error: ERROR
882 l_warning: WARNING
883 l_tip: EB_EDITOR_TOKEN_TOOLTIP
884 l_lines: LIST [EIFFEL_EDITOR_LINE]
885 l_content: LIST [EDITOR_TOKEN]
886 l_pixmap: EV_PIXMAP
887 l_row: EV_GRID_ROW
888 l_pos_token: EDITOR_TOKEN_NUMBER
889 l_line: EIFFEL_EDITOR_LINE
890 do
891 create l_item
892 a_row.set_item (1, l_item)
893
894 -- Set category pixmap item
895 create l_item
896 l_pixmap := category_icon_from_event_item (a_event_item)
897 if l_pixmap /= Void then
898 l_item.set_pixmap (l_pixmap)
899
900 -- Set string data for pixmap index, so it can be sorted.
901 l_item.set_data (a_event_item.category.out)
902 l_item.disable_full_select
903 end
904 a_row.set_item (category_column, l_item)
905
906 -- Set error information
907 l_error ?= a_event_item.data
908 if l_error /= Void then
909 create l_gen.make
910 l_error.trace_single_line (l_gen)
911
912 if l_gen.last_line /= Void and then l_gen.last_line.count > 0 then
913 l_editor_item := create_clickable_grid_item (l_gen.last_line)
914 else
915 create l_editor_item.make_with_text ("No error message found!")
916 end
917 l_editor_item.disable_full_select
918 if is_error_event (a_event_item) then
919 l_editor_item.set_pixmap (stock_pixmaps.tool_error_icon)
920 elseif is_warning_event (a_event_item) then
921 l_editor_item.set_pixmap (stock_pixmaps.tool_warning_icon)
922 else
923 check False end
924 end
925 l_editor_item.set_spacing ({ES_UI_CONSTANTS}.grid_editor_item_spacing)
926 a_row.set_item (error_column, l_editor_item)
927
928 -- Set row hieght
929 a_row.set_height (l_editor_item.label_font_height.max ({ES_UI_CONSTANTS}.grid_row_height))
930
931 -- Build full error text
932 create l_gen.make
933 l_gen.enable_multiline
934 l_error.trace (l_gen)
935 l_lines := l_gen.lines
936 if not l_lines.is_empty then
937 l_tip := create_clickable_tooltip (l_lines, l_editor_item, a_row)
938 a_row.select_actions.extend (agent l_tip.restart_tooltip_timer)
939
940 -- Sub row full error
941 a_row.insert_subrow (1)
942 l_row := a_row.subrow (1)
943 create l_item
944 l_item.disable_full_select
945 l_row.set_item (category_column, l_item)
946
947 l_editor_item := create_multiline_clickable_grid_item (l_lines, False)
948 l_row.set_height (l_tip.required_tooltip_height)
949 l_row.set_item (error_column, l_editor_item)
950 end
951
952 -- Context
953 l_error.trace_primary_context (l_gen)
954 if l_gen.last_line /= Void then
955 l_editor_item := create_clickable_grid_item (l_gen.last_line)
956 a_row.set_item (context_column, l_editor_item)
957 l_content := l_gen.last_line.content
958 if not l_content.is_empty then
959 -- Set context pebble
960 l_editor_item.set_data (l_gen.last_line.content.last.pebble)
961 end
962 end
963
964 -- Line and column number
965 l_editor_item := Void
966 if l_error.line > 0 then
967 -- Created position token
968 create l_pos_token.make (l_error.line.out + ", " + l_error.column.max (1).out)
969 l_pos_token.set_is_clickable (True)
970 l_pos_token.set_pebble (event_context_stone (a_event_item))
971
972 -- Create editor item
973 create l_line.make_empty_line
974 l_line.append_token (l_pos_token)
975 l_editor_item := create_clickable_grid_item (l_line)
976 end
977 a_row.set_item (position_column, l_editor_item)
978 end
979
980 -- Fill empty items
981 if l_row /= Void then
982 grid_events.grid_row_fill_empty_cells (l_row)
983 l_row.set_height (l_row.height + 2)
984 end
985 grid_events.grid_row_fill_empty_cells (a_row)
986 a_row.set_height (a_row.height + 2)
987
988 -- Set visibility
989 if is_error_event (a_event_item) then
990 if not show_errors then
991 a_row.hide
992 end
993 elseif is_warning_event (a_event_item) then
994 l_warning ?= l_error
995 check
996 l_warning_attached: l_warning /= Void
997 end
998 if not show_warnings or else filter_widget /= Void and then not filter_widget.is_unfiltered (l_warning) then
999 a_row.hide
1000 end
1001 else
1002 check False end
1003 end
1004
1005 -- Set expanded status
1006 if a_row.is_expandable and then is_error_event (a_event_item) then
1007 if expand_errors then
1008 a_row.expand
1009 elseif a_row.is_expanded then
1010 a_row.collapse
1011 end
1012 end
1013 end
1014
1015 feature {NONE} -- Constants
1016
1017 category_column: INTEGER = 2
1018 error_column: INTEGER = 3
1019 context_column: INTEGER = 4
1020 position_column: INTEGER = 5
1021
1022 expand_errors_session_id: STRING_8 = "com.eiffel.error_list.expand_errors"
1023
1024 invariant
1025 errors_button_attached: is_initialized implies errors_button /= Void
1026 warnings_button_attached: is_initialized implies warnings_button /= Void
1027 filter_button_attached: is_initialized implies filter_button /= Void
1028 expand_errors_button_attached: is_initialized implies expand_errors_button /= Void
1029 item_count_matches_error_and_warning_count: error_count + warning_count = item_count
1030
1031 ;indexing
1032 copyright: "Copyright (c) 1984-2007, Eiffel Software"
1033 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
1034 licensing_options: "http://www.eiffel.com/licensing"
1035 copying: "[
1036 This file is part of Eiffel Software's Eiffel Development Environment.
1037
1038 Eiffel Software's Eiffel Development Environment is free
1039 software; you can redistribute it and/or modify it under
1040 the terms of the GNU General Public License as published
1041 by the Free Software Foundation, version 2 of the License
1042 (available at the URL listed under "license" above).
1043
1044 Eiffel Software's Eiffel Development Environment is
1045 distributed in the hope that it will be useful, but
1046 WITHOUT ANY WARRANTY; without even the implied warranty
1047 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1048 See the GNU General Public License for more details.
1049
1050 You should have received a copy of the GNU General Public
1051 License along with Eiffel Software's Eiffel Development
1052 Environment; if not, write to the Free Software Foundation,
1053 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1054 ]"
1055 source: "[
1056 Eiffel Software
1057 356 Storke Road, Goleta, CA 93117 USA
1058 Telephone 805-685-1006, Fax 805-685-6869
1059 Website http://www.eiffel.com
1060 Customer support http://support.eiffel.com
1061 ]"
1062
1063 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date ID Revision

  ViewVC Help
Powered by ViewVC 1.1.23