/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 61201 - (show annotations)
Tue Jul 11 23:58:16 2006 UTC (13 years, 7 months ago) by manus
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 141188 byte(s)
Removed `Send to' menu as it only contains `external editor' which is now directly under File.

1 indexing
2 description : "Window holding a project tool"
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date : "$Date$"
6 revision : "$Revision$"
7 author : "$Author$"
8
9 class
10 EB_DEVELOPMENT_WINDOW
11
12 inherit
13 EB_TOOL_MANAGER
14 redefine
15 make,
16 init_size_and_position,
17 window_displayed,
18 init_commands,
19 build_menu_bar,
20 build_menus,
21 build_file_menu,
22 build_edit_menu,
23 build_view_menu,
24 build_tools_menu,
25 build_favorites_menu,
26 refresh,
27 recycle,
28 destroy_imp,
29 destroy,
30 position,
31 pos_container
32 end
33
34 EB_FILEABLE
35 export {NONE}
36 set_position,
37 set_pos_container
38 redefine
39 set_stone,
40 reset,
41 stone,
42 on_text_saved,
43 perform_check_before_save,
44 check_passed,
45 update_save_symbol,
46 position,
47 pos_container
48 select
49 set_stone
50 end
51
52 EB_FILEABLE
53 rename
54 set_stone as old_set_stone
55 export {NONE}
56 old_set_stone,
57 set_position,
58 set_pos_container
59 redefine
60 reset,
61 stone,
62 on_text_saved,
63 perform_check_before_save,
64 check_passed,
65 update_save_symbol,
66 position,
67 pos_container
68 end
69
70
71 -- Shared tools & contexts
72
73 SHARED_EIFFEL_PROJECT
74
75 PROJECT_CONTEXT
76
77 EB_SHARED_MANAGERS
78
79 EB_SHARED_GRAPHICAL_COMMANDS
80
81 EB_SHARED_PREFERENCES
82 export
83 {NONE} all
84 end
85
86 EV_STOCK_PIXMAPS
87
88 EB_CONFIRM_SAVE_CALLBACK
89
90 -- Errors
91 EB_GRAPHICAL_ERROR_MANAGER
92
93 TEXT_OBSERVER
94 redefine
95 on_text_reset, on_text_edited,
96 on_text_back_to_its_last_saved_state,
97 on_text_fully_loaded, on_cursor_moved
98 end
99
100 EV_KEY_CONSTANTS
101 export
102 {NONE} All
103 end
104
105 EIFFEL_ENV
106 export
107 {NONE} All
108 end
109
110 SHARED_TEXT_ITEMS
111 export
112 {NONE} All
113 end
114
115 create {EB_WINDOW_MANAGER}
116 make,
117 make_with_session_data,
118 make_as_context_tool,
119 make_as_editor
120
121 feature {NONE} -- Initialization
122
123 make_as_context_tool is
124 -- Create a new development window and expand the context tool.
125 do
126 make
127 -- Perform window setting from `show_actions', as the
128 -- resizing executed as a result only works correctly
129 -- while the window is displayed.
130 window.show_actions.extend (agent set_context_mode)
131 end
132
133 set_context_mode is
134 -- Set `current' into context mode, that is the context tool
135 -- maximized, and the non editor panel is hidden.
136 do
137 if not context_tool.shown then
138 context_tool.show
139 end
140 if not unified_stone then
141 toggle_stone_cmd.execute
142 end
143 context_tool.explorer_bar_item.maximize
144 close_all_bars_except (right_panel)
145 end
146
147 make_as_editor is
148 -- Create a new development window and expand the editor tool.
149 do
150 make
151 -- Perform window setting from `show_actions', as the resizing executed
152 -- must be performed after `current' is displayed.
153 window.show_actions.extend (agent (editor_tool.explorer_bar_item).maximize)
154 window.show_actions.extend (agent close_all_bars_except (right_panel))
155 end
156
157 make_with_session_data (a_session_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA) is
158 -- Recreate a previously existing development window using `a_session_data'.
159 local
160 l_class_i: CLASS_I
161 l_class_c_stone: CLASSC_STONE
162 l_cluster_string, l_class_string, l_feature_string: STRING
163 do
164 internal_development_window_data := a_session_data
165 make
166 -- Attempt to reload last edited class of `Current'.
167 if a_session_data.file_name /= Void then
168 conf_todo
169 -- l_class_i := eiffel_universe.class_with_file_name (a_session_data.file_name)
170 if l_class_i /= Void and then l_class_i.compiled then
171 -- Create compiled class stone and target `Current' to it.
172 create l_class_c_stone.make (l_class_i.compiled_class)
173 set_stone_after_check (l_class_c_stone)
174 if a_session_data.editor_position > 0 then
175 editor_tool.text_area.display_line_when_ready (a_session_data.editor_position, False)
176 end
177 end
178 end
179 if context_tool /= Void then
180 -- Presumption is made that if the strings are not void then they represent
181 -- valid entities in the project.
182 l_cluster_string := a_session_data.context_cluster_string
183 l_class_string := a_session_data.context_class_string
184 l_feature_string := a_session_data.context_feature_string
185 if l_feature_string /= Void then
186 context_tool.address_manager.feature_address.set_text (l_feature_string)
187 context_tool.address_manager.class_address.set_text (l_class_string)
188 context_tool.address_manager.execute_with_feature
189 elseif l_class_string /= Void then
190 context_tool.address_manager.class_address.set_text (l_class_string)
191 context_tool.address_manager.execute_with_class
192 elseif l_cluster_string /= Void then
193 context_tool.address_manager.cluster_address.set_text (l_cluster_string)
194 context_tool.address_manager.execute_with_cluster
195 end
196 -- Set the appropriate notebook tab
197 context_tool.notebook.select_item (context_tool.notebook.i_th (a_session_data.context_tab_index))
198 end
199 end
200
201 make is
202 -- Create a new development window.
203 do
204 unified_stone := preferences.development_window_data.context_unified_stone
205 -- Build the history manager, the address manager, ...
206 create history_manager.make (Current)
207 create address_manager.make (Current, False)
208 build_viewpoints
209 build_formatters
210 address_manager.set_formatters (managed_main_formatters)
211 address_manager.set_viewpoints (view_points_widget)
212
213
214 -- Init commands, build interface, build menus, ...
215 Precursor
216
217 initialized := False -- Reset the flag since initialization is not yet complete.
218 set_up_accelerators
219
220 window.focus_in_actions.extend(agent on_focus)
221
222 -- Create the toolbars.
223 build_toolbars_area
224 container.put_front (toolbars_area)
225 container.disable_item_expand (toolbars_area)
226
227 -- Update widgets visibilities
228 window.show_actions.extend (agent update)
229 status_bar.remove_cursor_position
230 address_manager.set_output_line (status_bar.label)
231
232 -- Finish initializing the main editor formatters
233 end_build_formatters
234
235 address_manager.disable_formatters
236 if Eiffel_project.manager.is_project_loaded then
237 on_project_created
238 on_project_loaded
239 elseif Eiffel_project.manager.is_created then
240 on_project_unloaded
241 on_project_created
242 else
243 on_project_unloaded
244 end
245
246 -- Create feature position table
247 create feature_positions.make (1)
248 feature_positions.compare_objects
249
250 window.move_actions.force_extend (agent window_moved)
251
252 initialized := True
253 is_destroying := False
254 end
255
256 init_size_and_position is
257 -- Initialize window size.
258 local
259 screen: EB_STUDIO_SCREEN
260 l_x, l_y: INTEGER
261 do
262 create screen
263 window.set_size (
264 development_window_data.width.min (screen.width),
265 development_window_data.height.min (screen.height))
266 l_x := development_window_data.x_position
267 if l_x < screen.virtual_left or l_x > screen.virtual_right then
268 -- Somehow screens have changed, reset it to 0
269 l_x := 0
270 end
271 l_y := development_window_data.y_position
272 if l_y < screen.virtual_top or l_y > screen.virtual_bottom then
273 -- Somehow screens have changed, reset it to 0
274 l_y := 0
275 end
276 window.set_position (l_x, l_y)
277 end
278
279 window_displayed is
280 -- `Current' has been displayed on screen.
281 do
282 -- Minimize or Maximize window if needed.
283 if development_window_data.is_maximized then
284 window.maximize
285 elseif development_window_data.is_minimized then
286 window.minimize
287 end
288 end
289
290 init_commands is
291 -- Initialize commands.
292 local
293 accel: EV_ACCELERATOR
294 do
295 Precursor
296 create toolbarable_commands.make (15)
297
298 -- Open, save, ...
299 toolbarable_commands.extend (new_editor_cmd)
300
301 toolbarable_commands.extend (new_context_tool_cmd)
302
303 create open_cmd.make (Current)
304 toolbarable_commands.extend (open_cmd)
305
306 create save_cmd.make (Current)
307 toolbarable_commands.extend (save_cmd)
308
309 create save_as_cmd.make (Current)
310 if editor_tool = Void or else editor_tool.text_area.is_empty then
311 save_as_cmd.disable_sensitive
312 else
313 save_as_cmd.enable_sensitive
314 end
315
316 create shell_cmd.make (Current)
317 toolbarable_commands.extend (shell_cmd)
318
319 create print_cmd.make (Current)
320 if is_empty then
321 print_cmd.disable_sensitive
322 else
323 print_cmd.enable_sensitive
324 end
325 toolbarable_commands.extend (print_cmd)
326
327 -- Compilation
328 create c_workbench_compilation_cmd.make_workbench (Current)
329 create c_finalized_compilation_cmd.make_finalized (Current)
330 if has_dll_generation then
331 create show_dynamic_lib_tool.make
332 show_dynamic_lib_tool.set_menu_name (Interface_names.m_new_dynamic_lib)
333 show_dynamic_lib_tool.add_agent (agent show_dynamic_library_dialog)
334 end
335 if has_profiler then
336 create show_profiler
337 end
338
339 -- Undo/redo, cut, copy, paste.
340 create undo_cmd.make (Current)
341 toolbarable_commands.extend (undo_cmd)
342
343 create redo_cmd.make (Current)
344 toolbarable_commands.extend (redo_cmd)
345
346 create editor_paste_cmd.make (Current)
347 toolbarable_commands.extend (editor_paste_cmd)
348
349 create new_cluster_cmd.make (Current)
350 toolbarable_commands.extend (new_cluster_cmd)
351
352 create new_library_cmd.make (Current)
353 toolbarable_commands.extend (new_library_cmd)
354
355 create new_assembly_cmd.make (Current)
356 toolbarable_commands.extend (new_assembly_cmd)
357
358 create new_class_cmd.make (Current)
359 toolbarable_commands.extend (new_class_cmd)
360
361 create delete_class_cluster_cmd.make (Current)
362 toolbarable_commands.extend (delete_class_cluster_cmd)
363
364 create new_feature_cmd.make (Current)
365 toolbarable_commands.extend (new_feature_cmd)
366
367 create toggle_feature_alias_cmd.make (Current)
368 toolbarable_commands.extend (toggle_feature_alias_cmd)
369
370 create toggle_feature_signature_cmd.make (Current)
371 toolbarable_commands.extend (toggle_feature_signature_cmd)
372
373 create toggle_feature_assigner_cmd.make (Current)
374 toolbarable_commands.extend (toggle_feature_assigner_cmd)
375
376 create toggle_stone_cmd.make (Current)
377 toolbarable_commands.extend (toggle_stone_cmd)
378
379 create send_stone_to_context_cmd.make
380 send_stone_to_context_cmd.set_pixmap (pixmaps.icon_pixmaps.context_sync_icon)
381 send_stone_to_context_cmd.set_tooltip (Interface_names.e_send_stone_to_context)
382 send_stone_to_context_cmd.set_menu_name (Interface_names.m_send_stone_to_context)
383 send_stone_to_context_cmd.set_name ("Send_to_context")
384 send_stone_to_context_cmd.set_tooltext (Interface_names.b_send_stone_to_context)
385 send_stone_to_context_cmd.add_agent (agent send_stone_to_context)
386 create accel.make_with_key_combination (
387 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_down), False, True, False
388 )
389 accel.actions.extend (agent send_stone_to_context)
390 send_stone_to_context_cmd.set_accelerator (accel)
391 send_stone_to_context_cmd.disable_sensitive
392 toolbarable_commands.extend (send_stone_to_context_cmd)
393
394 toolbarable_commands.extend (window_manager.minimize_all_cmd)
395 window_manager.minimize_all_cmd.enable_sensitive
396 toolbarable_commands.extend (window_manager.raise_all_cmd)
397 window_manager.raise_all_cmd.enable_sensitive
398
399 toolbarable_commands.extend (New_development_window_cmd)
400 -- Show tool/toolbar commands (will be filled when tools will
401 -- be created)
402 create show_tool_commands.make (7)
403 create show_toolbar_commands.make (3)
404
405 new_feature_cmd.disable_sensitive
406 toggle_feature_alias_cmd.disable_sensitive
407 toggle_feature_signature_cmd.disable_sensitive
408 toggle_feature_assigner_cmd.disable_sensitive
409
410 create editors.make (5)
411 end
412
413 set_up_accelerators is
414 -- Fill the accelerator of `window' with the accelerators of the `toolbarable_commands'.
415 local
416 cmds: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
417 i: INTEGER
418 do
419 --| Accelerators related to toolbarable_commands
420 from
421 cmds := toolbarable_commands
422 cmds.start
423 until
424 cmds.after
425 loop
426 if cmds.item.accelerator /= Void then
427 window.accelerators.extend (cmds.item.accelerator)
428 end
429 cmds.forth
430 end
431
432 --| Accelerators related to debugging toolbarable_commands
433 from
434 cmds := Eb_debugger_manager.toolbarable_commands
435 cmds.start
436 until
437 cmds.after
438 loop
439 if
440 cmds.item.accelerator /= Void
441 then
442 window.accelerators.extend (cmds.item.accelerator)
443 end
444 cmds.forth
445 end
446
447 --| Accelerators related to external commands
448 from
449 i := 0
450 until
451 i > 9
452 loop
453 window.accelerators.extend (edit_external_commands_cmd.accelerators.item (i))
454 i := i + 1
455 end
456 end
457
458 build_formatters is
459 -- Build all formatters used.
460 local
461 form: EB_CLASS_TEXT_FORMATTER
462 accel: EV_ACCELERATOR
463 do
464 create managed_class_formatters.make (17)
465 managed_class_formatters.extend (create {EB_CLICKABLE_FORMATTER}.make (Current))
466 managed_class_formatters.extend (create {EB_FLAT_FORMATTER}.make (Current))
467 managed_class_formatters.extend (create {EB_SHORT_FORMATTER}.make (Current))
468 managed_class_formatters.extend (create {EB_FLAT_SHORT_FORMATTER}.make (Current))
469 managed_class_formatters.extend (Void)
470 managed_class_formatters.extend (create {EB_ANCESTORS_FORMATTER}.make (Current))
471 managed_class_formatters.extend (create {EB_DESCENDANTS_FORMATTER}.make (Current))
472 managed_class_formatters.extend (create {EB_CLIENTS_FORMATTER}.make (Current))
473 managed_class_formatters.extend (create {EB_SUPPLIERS_FORMATTER}.make (Current))
474 managed_class_formatters.extend (Void)
475 managed_class_formatters.extend (create {EB_ATTRIBUTES_FORMATTER}.make (Current))
476 managed_class_formatters.extend (create {EB_ROUTINES_FORMATTER}.make (Current))
477 managed_class_formatters.extend (create {EB_INVARIANTS_FORMATTER}.make (Current))
478 managed_class_formatters.extend (create {EB_CREATORS_FORMATTER}.make (Current))
479 managed_class_formatters.extend (create {EB_DEFERREDS_FORMATTER}.make (Current))
480 managed_class_formatters.extend (create {EB_ONCES_FORMATTER}.make (Current))
481 managed_class_formatters.extend (create {EB_EXTERNALS_FORMATTER}.make (Current))
482 managed_class_formatters.extend (create {EB_EXPORTED_FORMATTER}.make (Current))
483
484 create managed_feature_formatters.make (12)
485 managed_feature_formatters.extend (create {EB_BASIC_FEATURE_FORMATTER}.make (Current))
486 managed_feature_formatters.extend (create {EB_ROUTINE_FLAT_FORMATTER}.make (Current))
487 managed_feature_formatters.extend (Void)
488 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current, 0))
489 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
490 {DEPEND_UNIT}.is_in_assignment_flag))
491 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
492 {DEPEND_UNIT}.is_in_creation_flag))
493 managed_feature_formatters.extend (Void)
494
495 managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current, 0))
496 managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current,
497 {DEPEND_UNIT}.is_in_assignment_flag))
498 managed_feature_formatters.extend (create {EB_CALLEES_FORMATTER}.make (Current,
499 {DEPEND_UNIT}.is_in_creation_flag))
500 managed_feature_formatters.extend (Void)
501
502 managed_feature_formatters.extend (create {EB_IMPLEMENTERS_FORMATTER}.make (Current))
503 managed_feature_formatters.extend (create {EB_ROUTINE_ANCESTORS_FORMATTER}.make (Current))
504 managed_feature_formatters.extend (create {EB_ROUTINE_DESCENDANTS_FORMATTER}.make (Current))
505 managed_feature_formatters.extend (Void)
506 managed_feature_formatters.extend (create {EB_HOMONYMS_FORMATTER}.make (Current))
507
508
509 create managed_main_formatters.make (6)
510
511 create {EB_BASIC_TEXT_FORMATTER} form.make (Current)
512 create accel.make_with_key_combination (
513 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_t),
514 True, False, True)
515 accel.actions.extend (agent form.execute)
516 form.set_accelerator (accel)
517 form.set_viewpoints (view_points_combo)
518 form.post_execution_action.extend (agent update_viewpoints)
519 managed_main_formatters.extend (form)
520
521 create {EB_CLICKABLE_FORMATTER} form.make (Current)
522 create accel.make_with_key_combination (
523 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_c),
524 True, False, True)
525 accel.actions.extend (agent form.execute)
526 form.set_accelerator (accel)
527 form.set_viewpoints (view_points_combo)
528 form.post_execution_action.extend (agent update_viewpoints)
529 managed_main_formatters.extend (form)
530
531 create {EB_FLAT_FORMATTER} form.make (Current)
532 create accel.make_with_key_combination (
533 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_f),
534 True, False, True)
535 accel.actions.extend (agent form.execute)
536 form.set_accelerator (accel)
537 form.set_viewpoints (view_points_combo)
538 form.post_execution_action.extend (agent update_viewpoints)
539 managed_main_formatters.extend (form)
540
541 create {EB_SHORT_FORMATTER} form.make (Current)
542 create accel.make_with_key_combination (
543 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_o),
544 True, False, True)
545 accel.actions.extend (agent form.execute)
546 form.set_accelerator (accel)
547 form.set_viewpoints (view_points_combo)
548 form.post_execution_action.extend (agent update_viewpoints)
549 managed_main_formatters.extend (form)
550
551 create {EB_FLAT_SHORT_FORMATTER} form.make (Current)
552 create accel.make_with_key_combination (
553 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_i),
554 True, False, True)
555 accel.actions.extend (agent form.execute)
556 form.set_accelerator (accel)
557 form.set_viewpoints (view_points_combo)
558 form.post_execution_action.extend (agent update_viewpoints)
559 managed_main_formatters.extend (form)
560 end
561
562 end_build_formatters is
563 -- Finish initialization of formatters (associate them with editor
564 -- and select a formatter).
565 local
566 f_ind: INTEGER
567 do
568 from
569 managed_class_formatters.start
570 until
571 managed_class_formatters.after
572 loop
573 if managed_class_formatters.item /= Void then
574 managed_class_formatters.item.set_manager (context_tool)
575 end
576 managed_class_formatters.forth
577 end
578 from
579 managed_feature_formatters.start
580 until
581 managed_feature_formatters.after
582 loop
583 if managed_feature_formatters.item /= Void then
584 managed_feature_formatters.item.set_manager (context_tool)
585 end
586 managed_feature_formatters.forth
587 end
588 from
589 managed_main_formatters.start
590 until
591 managed_main_formatters.after
592 loop
593 managed_main_formatters.item.set_editor (editor_tool.text_area)
594 managed_main_formatters.item.on_shown
595 if managed_main_formatters.item.accelerator /= Void then
596 window.accelerators.extend (managed_main_formatters.item.accelerator)
597 end
598 managed_main_formatters.forth
599 end
600
601 (managed_main_formatters @ 1).enable_select;
602
603 -- We now select the correct class formatter.
604 f_ind := preferences.context_tool_data.default_class_formatter_index
605 --| This takes the formatter separators in consideration.
606 if f_ind > 4 then
607 f_ind := f_ind + 1
608 end
609 if f_ind > 8 then
610 f_ind := f_ind + 1
611 end
612 if f_ind < 1 or f_ind > managed_class_formatters.count then
613 f_ind := 6
614 end
615 (managed_class_formatters @ f_ind).enable_select;
616 -- We now select the correct feature formatter.
617 f_ind := preferences.context_tool_data.default_feature_formatter_index
618 if f_ind > 2 then
619 f_ind := f_ind + 1
620 end
621 if f_ind < 1 or f_ind > managed_feature_formatters.count then
622 f_ind := 2
623 end
624 managed_class_formatters.i_th (f_ind).enable_select
625 end
626
627 build_tools is
628 -- Build all tools that can take place in this window and put them
629 -- in `left_tools' or `bottom_tools'.
630 local
631 show_cmd: EB_SHOW_TOOL_COMMAND
632 l_accel: EV_ACCELERATOR
633 l_shortcut_preference: SHORTCUT_PREFERENCE
634 do
635 lock_update
636 -- Build the features tool
637 create features_tool.make (Current)
638 features_tool.attach_to_explorer_bar (left_panel)
639 left_tools.extend (features_tool.explorer_bar_item)
640 create show_cmd.make (Current, features_tool.explorer_bar_item)
641 show_tool_commands.extend (show_cmd)
642 toolbarable_commands.extend (show_cmd)
643 add_recyclable (features_tool)
644
645 -- Build the breakpoints tool
646 create breakpoints_tool.make (Current)
647 breakpoints_tool.attach_to_explorer_bar (left_panel)
648 left_tools.extend (breakpoints_tool.explorer_bar_item)
649 create show_cmd.make (Current, breakpoints_tool.explorer_bar_item)
650 show_tool_commands.extend (show_cmd)
651 toolbarable_commands.extend (show_cmd)
652 add_recyclable (breakpoints_tool)
653
654 -- Build the cluster tool
655 create cluster_tool.make (Current, Current)
656 cluster_tool.attach_to_explorer_bar (left_panel)
657 left_tools.extend (cluster_tool.explorer_bar_item)
658 create show_cmd.make (Current, cluster_tool.explorer_bar_item)
659 show_tool_commands.extend (show_cmd)
660 toolbarable_commands.extend (show_cmd)
661 add_recyclable (cluster_tool)
662
663 -- Build the favorites tool
664 create favorites_tool.make (Current, favorites_manager)
665 favorites_tool.attach_to_explorer_bar (left_panel)
666 left_tools.extend (favorites_tool.explorer_bar_item)
667 create show_cmd.make (Current, favorites_tool.explorer_bar_item)
668 show_tool_commands.extend (show_cmd)
669 toolbarable_commands.extend (show_cmd)
670 add_recyclable (favorites_tool)
671
672 -- Build the properties tool
673 create properties_tool.make (Current)
674 properties_tool.attach_to_explorer_bar (left_panel)
675 left_tools.extend (properties_tool.explorer_bar_item)
676 create show_cmd.make (Current, properties_tool.explorer_bar_item)
677 show_tool_commands.extend (show_cmd)
678 toolbarable_commands.extend (show_cmd)
679 add_recyclable (properties_tool)
680
681 -- Build the windows tool (formerly known as Selector tool)
682 create windows_tool.make (Current)
683 windows_tool.attach_to_explorer_bar (left_panel)
684 left_tools.extend (windows_tool.explorer_bar_item)
685 create show_cmd.make (Current, windows_tool.explorer_bar_item)
686 show_tool_commands.extend (show_cmd)
687 toolbarable_commands.extend (show_cmd)
688 add_recyclable (windows_tool)
689
690 -- Build the search tool
691 create search_tool.make (Current)
692 search_tool.attach_to_explorer_bar (right_panel)
693 bottom_tools.extend (search_tool.explorer_bar_item)
694 create show_cmd.make (Current, search_tool.explorer_bar_item)
695 l_shortcut_preference := preferences.editor_data.shortcuts.item ("show_search_panel")
696 create l_accel.make_with_key_combination (l_shortcut_preference.key, l_shortcut_preference.is_ctrl, l_shortcut_preference.is_alt, l_shortcut_preference.is_shift)
697 l_accel.actions.extend (agent search_tool.prepare_search)
698 show_cmd.set_accelerator (l_accel)
699 show_tool_commands.extend (show_cmd)
700 toolbarable_commands.extend (show_cmd)
701 add_recyclable (search_tool)
702
703 -- Build the editor tool
704 create editor_tool.make (Current)
705 editor_tool.attach_to_explorer_bar (right_panel)
706 bottom_tools.extend (editor_tool.explorer_bar_item)
707 editor_tool.text_area.add_edition_observer(save_cmd)
708 editor_tool.text_area.add_edition_observer(save_as_cmd)
709 editor_tool.text_area.add_edition_observer(print_cmd)
710 editor_tool.text_area.add_edition_observer(Current)
711 editor_tool.text_area.add_edition_observer(search_tool)
712 editor_tool.text_area.drop_actions.set_veto_pebble_function (agent can_drop)
713 editor_tool.text_area.add_cursor_observer (Current)
714 create show_cmd.make(Current, editor_tool.explorer_bar_item)
715 show_tool_commands.extend (show_cmd)
716 toolbarable_commands.extend (show_cmd)
717
718 -- The minimim height masks a bug on windows to do with the sizing of the editors
719 -- scroll bars, which were affecting the resizing although they should not have done so.
720 -- Having a default minimum height on the editor is perfectly reasonable.
721 editor_tool.widget.set_minimum_height (20)
722 add_recyclable (editor_tool)
723
724 -- Build the context tool
725 create context_tool.make (Current)
726 context_tool.attach_to_explorer_bar (right_panel)
727 bottom_tools.extend (context_tool.explorer_bar_item)
728 create show_cmd.make (Current, context_tool.explorer_bar_item)
729 show_tool_commands.extend (show_cmd)
730 toolbarable_commands.extend (show_cmd)
731 add_recyclable (context_tool)
732
733 -- Build the refactoring tools
734 toolbarable_commands.extend (refactoring_manager.pull_command)
735 toolbarable_commands.extend (refactoring_manager.rename_command)
736 toolbarable_commands.extend (refactoring_manager.undo_command)
737 toolbarable_commands.extend (refactoring_manager.redo_command)
738
739 -- Set the flag "Tools initialized"
740 tools_initialized := True
741
742 -- Initialize undo / redo accelerators
743 create undo_accelerator.make_with_key_combination (
744 create {EV_KEY}.make_with_code (Key_z), True, False, False)
745 if has_case then
746 undo_accelerator.actions.extend (agent (context_tool.editor.undo_cmd).on_ctrl_z)
747 end
748 create redo_accelerator.make_with_key_combination (
749 create {EV_KEY}.make_with_code (Key_y), True, False, False)
750 if has_case then
751 redo_accelerator.actions.extend (agent (context_tool.editor.redo_cmd).on_ctrl_y)
752 end
753 window.accelerators.extend (undo_accelerator)
754 window.accelerators.extend (redo_accelerator)
755 unlock_update
756 end
757
758 build_viewpoints is
759 -- Build viewpoint selection list
760 local
761 l_label: EV_LABEL
762 do
763 create view_points_widget
764 create l_label.make_with_text (interface_names.l_viewpoints)
765 view_points_widget.extend (l_label)
766 view_points_widget.disable_item_expand (l_label)
767
768 create view_points_combo
769 view_points_combo.disable_sensitive
770 view_points_combo.select_actions.extend (agent on_viewpoint_changed)
771 view_points_combo.disable_edit
772 view_points_combo.set_minimum_width (120)
773
774 view_points_widget.extend (view_points_combo)
775 view_points_widget.disable_item_expand (view_points_combo)
776 end
777
778 feature -- Access
779
780 group: CONF_GROUP is
781 -- Group of current class. Void if none.
782 local
783 classi_stone: CLASSI_STONE
784 cluster_stone: CLUSTER_STONE
785 do
786 classi_stone ?= stone
787 if classi_stone /= Void then
788 Result := classi_stone.group
789 end
790 cluster_stone ?= stone
791 if cluster_stone /= Void then
792 Result := cluster_stone.group
793 end
794 end
795
796 class_name: STRING is
797 -- Name of the current class, Void if none.
798 local
799 class_stone: CLASSI_STONE
800 do
801 class_stone ?= stone
802 if class_stone /= Void then
803 Result := class_stone.class_name
804 end
805 end
806
807 feature_name: STRING is
808 -- Name of the current feature, Void if none.
809 local
810 feature_stone: FEATURE_STONE
811 do
812 feature_stone ?= stone
813 if feature_stone /= Void then
814 Result := feature_stone.feature_name
815 end
816 end
817
818 feature -- Status setting
819
820 disable_sensitive is
821 -- Disable sensitivity of all widgets.
822 do
823 window.disable_sensitive
824 end
825
826 enable_sensitive is
827 -- Enable sensitivity of all widgets.
828 do
829 window.enable_sensitive
830 end
831
832 feature -- Window Settings
833
834 set_initialized is
835 -- Set `initialized' to True.
836 do
837 initialized := True
838 end
839
840 set_text (a_text: STRING) is
841 -- Assign `a_text' to `text'.
842 require
843 a_text_not_void: a_text /= Void
844 do
845 editor_tool.text_area.set_editor_text (a_text)
846 ensure
847 --| FIXME This needs to work: text_assigned: text.is_equal (a_text)
848 --| FIXME changed_flag_set: changed
849 end
850
851 feature -- Window Properties
852
853 changed: BOOLEAN is
854 -- Has something been changed and not yet been saved?
855 do
856 Result := editor_tool.changed
857 end
858
859 is_empty: BOOLEAN is
860 -- Does `Current's text is empty?
861 do
862 Result := editor_tool = Void or else editor_tool.text_area.is_empty
863 end
864
865 text: STRING is
866 -- Text representing Current
867 do
868 Result := editor_tool.text_area.text
869 end
870
871 pixmap: EV_PIXMAP is
872 -- Pixmap representing Current window.
873 do
874 Result := pixmaps.icon_pixmaps.general_dialog_icon
875 end
876
877 feature -- Pulldown Menus
878
879 metric_menu: EV_MENU
880 -- Menu for entries of metric tool.
881
882 format_menu: EV_MENU
883 -- ID Menu for formats.
884 -- Only used during debugging
885
886 compile_menu: EV_MENU
887 -- Compile ID menu.
888
889 debug_menu: EV_MENU
890 -- Debug ID menu.
891
892 debugging_tools_menu: EV_MENU
893 -- Debugging tools menu item
894
895 active_menus (erase: BOOLEAN) is
896 -- Enable all the menus and if `erase' clean
897 -- the content of the Project tool.
898 do
899 compile_menu.enable_sensitive
900 if erase then
901 output_manager.clear
902 end
903 end
904
905 disable_menus is
906 -- Disable all the menus.
907 do
908 compile_menu.disable_sensitive
909 end
910
911 update_debug_menu is
912 -- Update debug menu
913 do
914 Eb_debugger_manager.update_debugging_tools_menu_from (Current)
915 end
916
917 feature -- Modifiable menus
918
919 melt_menu_item: EV_MENU_ITEM
920 -- Melt menu entry
921
922 freeze_menu_item: EV_MENU_ITEM
923 -- Freeze menu entry
924
925 finalize_menu_item: EV_MENU_ITEM
926 -- Finalize menu entry
927
928 feature -- Update
929
930 synchronize is
931 -- Synchronize stones.
932 local
933 st: STONE
934 l_text_area: EB_SMART_EDITOR
935 do
936 during_synchronization := True
937 favorites_manager.refresh
938 context_tool.synchronize
939 cluster_tool.synchronize
940 history_manager.synchronize
941 features_tool.synchronize
942 breakpoints_tool.synchronize
943 -- Update main views
944 managed_main_formatters.i_th (2).invalidate
945 managed_main_formatters.i_th (3).invalidate
946 managed_main_formatters.i_th (4).invalidate
947 managed_main_formatters.i_th (5).invalidate
948 if stone /= Void then
949 st := stone.synchronized_stone
950 end
951 l_text_area := editor_tool.text_area
952 l_text_area.update_click_list (False)
953 if l_text_area.file_loaded then
954 editor_tool.text_area.check_document_modifications_and_reload
955 end
956 set_stone (st)
957 update_save_symbol
958 address_manager.refresh
959 during_synchronization := False
960 search_tool.rebuild_scope_list
961 end
962
963 synchronize_routine_tool_to_default is
964 -- Synchronize the editor tool to the debug format.
965 do
966 --| FIXME ARNAUD: To be implemented
967 end
968
969 clear_object_tool is
970 -- Clear the contents of the object tool if shown.
971 do
972 --| FIXME ARNAUD: To be implemented
973 end
974
975 build_menus is
976 -- Build all menus displayed in the development window.
977 do
978 -- Build each menu
979 build_file_menu
980 build_edit_menu
981 build_view_menu
982 build_favorites_menu
983 build_project_menu
984 build_debug_menu
985 build_tools_menu
986 build_window_menu
987 build_help_menu
988 -- Build the menu bar.
989 build_menu_bar
990 end
991
992 build_debug_menu is
993 -- Build the `Debug' menu through the debugger_manager.
994 local
995 conv_mit: EB_COMMAND_MENU_ITEM
996 do
997 debug_menu := Eb_debugger_manager.new_debug_menu
998 from
999 debug_menu.start
1000 until
1001 debug_menu.after
1002 loop
1003 conv_mit ?= debug_menu.item
1004 if conv_mit /= Void then
1005 add_recyclable (conv_mit)
1006 end
1007 debug_menu.forth
1008 end
1009 --| Debugging tools menu
1010 debugging_tools_menu := Eb_debugger_manager.new_debugging_tools_menu
1011 debug_menu.extend (create {EV_MENU_SEPARATOR})
1012 debug_menu.extend (debugging_tools_menu)
1013 update_debug_menu
1014 end
1015
1016 build_menu_bar is
1017 -- Build the menu bar
1018 local
1019 mb: EV_MENU_BAR
1020 do
1021 check
1022 window.menu_bar /= Void implies not window.menu_bar.is_empty
1023 -- If a menu bar was already present, it shouldn't be empty.
1024 end
1025 if window.menu_bar /= Void then
1026 mb := window.menu_bar
1027 from
1028 mb.start
1029 mb.forth
1030 until
1031 mb.after
1032 loop
1033 mb.remove
1034 end
1035 else
1036 create mb
1037 window.set_menu_bar (mb)
1038 mb.extend (file_menu)
1039 end
1040
1041 if Eiffel_project.manager.is_created then
1042 mb.extend (edit_menu)
1043 mb.extend (view_menu)
1044 mb.extend (favorites_menu)
1045 mb.extend (project_menu)
1046 mb.extend (debug_menu)
1047 else
1048 mb.extend (view_menu)
1049 end
1050 mb.extend (tools_menu)
1051 mb.extend (window_menu)
1052 mb.extend (help_menu)
1053
1054 estudio_debug_cmd.attach_window (window)
1055 end
1056
1057 feature -- Graphical Interface
1058
1059 build_general_toolbar is
1060 -- Set up the general toolbar (New, Save, Search, Shell, Undo, Redo, ...)
1061 local
1062 cell: EV_CELL
1063 hsep: EV_HORIZONTAL_SEPARATOR
1064 hbox: EV_HORIZONTAL_BOX
1065 do
1066 -- Create the toolbar.
1067 create general_toolbar
1068 general_customizable_toolbar := development_window_data.retrieve_general_toolbar (toolbarable_commands)
1069 if development_window_data.show_text_in_general_toolbar then
1070 general_customizable_toolbar.enable_important_text
1071 elseif development_window_data.show_all_text_in_general_toolbar then
1072 general_customizable_toolbar.enable_text_displayed
1073 end
1074
1075 create hbox
1076 hbox.extend (general_customizable_toolbar.widget)
1077 hbox.disable_item_expand (general_customizable_toolbar.widget)
1078
1079 -- Generate the toolbar.
1080 general_customizable_toolbar.update_toolbar
1081
1082 -- Cell to fill in empty space and receive the right click menu holder.
1083 create cell
1084 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1085 hbox.extend (cell)
1086
1087 -- Create the vertical layout (separator + toolbar)
1088 create hsep
1089 general_toolbar.set_padding (2)
1090 general_toolbar.extend (hsep)
1091 general_toolbar.disable_item_expand (hsep)
1092 general_toolbar.extend (hbox)
1093
1094 -- Create the command to show/hide this toolbar.
1095 create show_general_toolbar_command.make (general_toolbar, Interface_names.m_general_toolbar)
1096 show_toolbar_commands.extend (show_general_toolbar_command)
1097 if development_window_data.show_general_toolbar then
1098 show_general_toolbar_command.enable_visible
1099 else
1100 show_general_toolbar_command.disable_visible
1101 end
1102
1103 end
1104
1105 build_address_toolbar is
1106 -- Set up the address toolbar (Back, Forward, Current, Class name, feature name, ...)
1107 local
1108 tb: EV_TOOL_BAR
1109 -- address_bar: EV_HORIZONTAL_BOX -- Contains "Class" + Combobox + "Feature" + Combobox + "Format" + Combobox
1110 hsep: EV_HORIZONTAL_SEPARATOR
1111 hbox: EV_HORIZONTAL_BOX -- Contains HistoryToolbar (back, forth, current) + `address_bar'
1112 cell: EV_CELL
1113 accel: EV_ACCELERATOR
1114 do
1115 -- Create the toolbar
1116 create address_toolbar
1117 create hsep
1118 create hbox
1119 -- create address_bar
1120 create tb
1121 address_toolbar.set_padding (2)
1122 address_toolbar.extend (hsep)
1123 address_toolbar.disable_item_expand (hsep)
1124 address_toolbar.extend (hbox)
1125
1126 hbox.extend (tb)
1127 hbox.disable_item_expand (tb)
1128 -- hbox.extend (address_bar)
1129 -- hbox.disable_item_expand (address_bar)
1130
1131 -- Back icon
1132 tb.extend (history_manager.back_command.new_toolbar_item (False))
1133
1134 -- Forward icon
1135 tb.extend (history_manager.forth_command.new_toolbar_item (False))
1136
1137 -- Set up the accelerators.
1138 create accel.make_with_key_combination (
1139 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_right), False, True, False
1140 )
1141 accel.actions.extend (agent on_forth)
1142 window.accelerators.extend (accel)
1143
1144 create accel.make_with_key_combination (
1145 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_left), False, True, False
1146 )
1147 accel.actions.extend (agent on_back)
1148 window.accelerators.extend (accel)
1149
1150 ------------------------------------------
1151 -- Address bar (Class name & feature name)
1152 ------------------------------------------
1153 hbox.extend (address_manager.widget)
1154 -- editor_tool.text_area.add_cursor_observer (address_manager)
1155
1156 -- Create the command to show/hide this toolbar.
1157 create show_address_toolbar_command.make (address_toolbar, Interface_names.m_address_toolbar)
1158 show_toolbar_commands.extend (show_address_toolbar_command)
1159
1160 if development_window_data.show_address_toolbar then
1161 show_address_toolbar_command.enable_visible
1162 else
1163 show_address_toolbar_command.disable_visible
1164 end
1165
1166 -- Cell to fill in empty space and receive the right click menu holder.
1167 create cell
1168 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1169 hbox.extend (cell)
1170 end
1171
1172 build_project_toolbar is
1173 -- Build toolbar corresponding to the project options bar
1174 local
1175 cell: EV_CELL
1176 hsep: EV_HORIZONTAL_SEPARATOR
1177 hbox: EV_HORIZONTAL_BOX
1178 do
1179 create project_toolbar
1180 create hsep
1181 project_toolbar.extend (hsep)
1182 project_toolbar.disable_item_expand (hsep)
1183
1184 -- Generate the toolbar.
1185 create hbox
1186 project_customizable_toolbar := Eb_debugger_manager.new_toolbar
1187 hbox.extend (project_customizable_toolbar.widget)
1188 hbox.disable_item_expand (project_customizable_toolbar.widget)
1189
1190 project_customizable_toolbar.update_toolbar
1191
1192 -- Create the command to show/hide this toolbar.
1193 create show_project_toolbar_command.make (project_toolbar, Interface_names.m_project_toolbar)
1194 show_toolbar_commands.extend (show_project_toolbar_command)
1195 if development_window_data.show_project_toolbar then
1196 show_project_toolbar_command.enable_visible
1197 else
1198 show_project_toolbar_command.disable_visible
1199 end
1200
1201 -- Cell to fill in empty space and receive the right click menu holder.
1202 create cell
1203 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1204 hbox.extend (cell)
1205 project_toolbar.extend (hbox)
1206 end
1207
1208 build_refactoring_toolbar is
1209 -- Build refactoring toolbar.
1210 local
1211 cell: EV_CELL
1212 hsep: EV_HORIZONTAL_SEPARATOR
1213 hbox: EV_HORIZONTAL_BOX
1214 do
1215 -- Create the toolbar.
1216 create refactoring_toolbar
1217 refactoring_customizable_toolbar := development_window_data.retrieve_refactoring_toolbar (toolbarable_commands)
1218 if development_window_data.show_text_in_refactoring_toolbar then
1219 refactoring_customizable_toolbar.enable_important_text
1220 elseif development_window_data.show_all_text_in_refactoring_toolbar then
1221 refactoring_customizable_toolbar.enable_text_displayed
1222 end
1223
1224 create hbox
1225 hbox.extend (refactoring_customizable_toolbar.widget)
1226 hbox.disable_item_expand (refactoring_customizable_toolbar.widget)
1227
1228 -- Generate the toolbar.
1229 refactoring_customizable_toolbar.update_toolbar
1230
1231 -- Cell to fill in empty space and receive the right click menu holder.
1232 create cell
1233 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1234 hbox.extend (cell)
1235
1236 -- Create the vertical layout (separator + toolbar)
1237 create hsep
1238 refactoring_toolbar.set_padding (2)
1239 refactoring_toolbar.extend (hsep)
1240 refactoring_toolbar.disable_item_expand (hsep)
1241 refactoring_toolbar.extend (hbox)
1242
1243 -- Create the command to show/hide this toolbar.
1244 create show_refactoring_toolbar_command.make (refactoring_toolbar, Interface_names.m_refactoring_toolbar)
1245 show_toolbar_commands.extend (show_refactoring_toolbar_command)
1246 if development_window_data.show_refactoring_toolbar then
1247 show_refactoring_toolbar_command.enable_visible
1248 else
1249 show_refactoring_toolbar_command.disable_visible
1250 end
1251 end
1252
1253
1254 feature {NONE} -- Menu Building
1255
1256 build_file_menu is
1257 -- Build the file menu.
1258 local
1259 new_project_cmd: EB_NEW_PROJECT_COMMAND
1260 open_project_cmd: EB_OPEN_PROJECT_COMMAND
1261 menu_item: EV_MENU_ITEM
1262 command_menu_item: EB_COMMAND_MENU_ITEM
1263 do
1264 create file_menu.make_with_text (Interface_names.m_file)
1265
1266 -- New
1267 command_menu_item := New_development_window_cmd.new_menu_item
1268 add_recyclable (command_menu_item)
1269 file_menu.extend (command_menu_item)
1270
1271 -- New editor
1272 command_menu_item := New_editor_cmd.new_menu_item
1273 add_recyclable (command_menu_item)
1274 file_menu.extend (command_menu_item)
1275
1276 -- New context tool
1277 command_menu_item := New_context_tool_cmd.new_menu_item
1278 add_recyclable (command_menu_item)
1279 file_menu.extend (command_menu_item)
1280
1281 -- Open
1282 command_menu_item := open_cmd.new_menu_item
1283 add_recyclable (command_menu_item)
1284 file_menu.extend (command_menu_item)
1285
1286 -- Close
1287 create menu_item.make_with_text (Interface_names.m_close)
1288 menu_item.select_actions.extend (agent destroy)
1289 file_menu.extend (menu_item)
1290
1291 -- Separator --------------------------------------
1292 file_menu.extend (create {EV_MENU_SEPARATOR})
1293
1294 -- Save
1295 command_menu_item := save_cmd.new_menu_item
1296 add_recyclable (command_menu_item)
1297 file_menu.extend (command_menu_item)
1298
1299 -- Save as
1300 command_menu_item := save_as_cmd.new_menu_item
1301 add_recyclable (command_menu_item)
1302 file_menu.extend (command_menu_item)
1303
1304 -- External editor
1305 command_menu_item := shell_cmd.new_menu_item
1306 add_recyclable (command_menu_item)
1307 file_menu.extend (command_menu_item)
1308
1309 -- Separator --------------------------------------
1310 file_menu.extend (create {EV_MENU_SEPARATOR})
1311 command_menu_item := print_cmd.new_menu_item
1312 add_recyclable (command_menu_item)
1313 file_menu.extend (command_menu_item)
1314
1315 -- Separator --------------------------------------
1316 file_menu.extend (create {EV_MENU_SEPARATOR})
1317
1318 -- New Project
1319 create new_project_cmd.make_with_parent (window)
1320 create menu_item.make_with_text (Interface_names.m_new_project)
1321 menu_item.select_actions.extend (agent new_project_cmd.execute)
1322 file_menu.extend (menu_item)
1323
1324 -- Open Project
1325 create open_project_cmd.make_with_parent (window)
1326 create menu_item.make_with_text (Interface_names.m_open_project)
1327 menu_item.select_actions.extend (agent open_project_cmd.execute)
1328 file_menu.extend (menu_item)
1329
1330 -- Recent Projects
1331 recent_projects_menu := recent_projects_manager.new_menu
1332 add_recyclable (recent_projects_menu)
1333 file_menu.extend (recent_projects_menu)
1334
1335 -- Separator --------------------------------------
1336 file_menu.extend (create {EV_MENU_SEPARATOR})
1337
1338 -- Exit
1339 command_menu_item := Exit_application_cmd.new_menu_item
1340 add_recyclable (Command_menu_item)
1341 file_menu.extend (command_menu_item)
1342 end
1343
1344 build_class_info_menu: EV_MENU is
1345 -- Build the class format sub-menu.
1346 local
1347 form: EB_CLASS_INFO_FORMATTER
1348 empty_menu: EV_MENU_ITEM
1349 i: INTEGER
1350 do
1351 create Result.make_with_text (Interface_names.m_class_info)
1352 i := 1
1353
1354 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1355 i := i + 1
1356 empty_menu.disable_sensitive
1357 Result.extend (empty_menu)
1358 from
1359 managed_class_formatters.start
1360 until
1361 managed_class_formatters.after
1362 loop
1363 form := managed_class_formatters.item
1364 if form /= Void then
1365 Result.extend (form.new_menu_item)
1366 else
1367 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1368 i := i + 1
1369 empty_menu.disable_sensitive
1370 Result.extend (empty_menu)
1371 end
1372 managed_class_formatters.forth
1373 end
1374 end
1375
1376 build_feature_info_menu: EV_MENU is
1377 -- Build the feature format sub-menu.
1378 local
1379 form: EB_FEATURE_INFO_FORMATTER
1380 do
1381 create Result.make_with_text (Interface_names.m_feature_info)
1382 from
1383 managed_feature_formatters.start
1384 until
1385 managed_feature_formatters.after
1386 loop
1387 form := managed_feature_formatters.item
1388 if form /= Void then
1389 Result.extend (form.new_menu_item)
1390 end
1391 managed_feature_formatters.forth
1392 end
1393 end
1394
1395 build_edit_menu is
1396 -- Create and build `edit_menu'
1397 local
1398 command_menu_item: EB_COMMAND_MENU_ITEM
1399 sub_menu: EV_MENU
1400 cmd: EB_EDITOR_COMMAND
1401 os_cmd: EB_ON_SELECTION_COMMAND
1402 editor: EB_SMART_EDITOR
1403 ln_cmd: EB_TOGGLE_LINE_NUMBERS_COMMAND
1404 do
1405 editor := editor_tool.text_area
1406 create command_controller.make
1407
1408 create edit_menu.make_with_text (Interface_names.m_edit)
1409
1410 -- Undo
1411 command_menu_item := undo_cmd.new_menu_item
1412 add_recyclable (command_menu_item)
1413 edit_menu.extend (command_menu_item)
1414
1415 -- Redo
1416 command_menu_item := redo_cmd.new_menu_item
1417 add_recyclable (command_menu_item)
1418 edit_menu.extend (command_menu_item)
1419
1420 -- Separator --------------------------------------
1421 edit_menu.extend (create {EV_MENU_SEPARATOR})
1422
1423 -- Cut
1424 create os_cmd.make (Current)
1425 os_cmd.set_menu_name (Interface_names.M_cut)
1426 os_cmd.set_pixmap (pixmaps.icon_pixmaps.general_cut_icon)
1427 os_cmd.set_name ("Editor_cut")
1428 os_cmd.set_tooltip (interface_names.f_cut)
1429 os_cmd.add_agent (agent cut_selection)
1430 os_cmd.set_tooltext (Interface_names.b_cut)
1431 toolbarable_commands.extend (os_cmd)
1432 os_cmd.set_needs_editable (True)
1433 command_controller.add_selection_command (os_cmd)
1434 command_menu_item := os_cmd.new_menu_item
1435 add_recyclable (command_menu_item)
1436 edit_menu.extend (command_menu_item)
1437
1438 -- Copy
1439 create os_cmd.make (Current)
1440 os_cmd.set_menu_name (Interface_names.M_copy)
1441 os_cmd.set_pixmap (pixmaps.icon_pixmaps.general_copy_icon)
1442 os_cmd.set_name ("Editor_copy")
1443 os_cmd.set_tooltip (interface_names.f_copy)
1444 os_cmd.set_tooltext (Interface_names.b_copy)
1445 os_cmd.add_agent (agent copy_selection)
1446 toolbarable_commands.extend (os_cmd)
1447 os_cmd.set_needs_editable (False)
1448 command_controller.add_selection_command (os_cmd)
1449 command_menu_item := os_cmd.new_menu_item
1450 add_recyclable (command_menu_item)
1451 edit_menu.extend (command_menu_item)
1452
1453 -- Paste
1454 command_menu_item := editor_paste_cmd.new_menu_item
1455 add_recyclable (command_menu_item)
1456 edit_menu.extend (command_menu_item)
1457
1458 -- Separator --------------------------------------
1459 edit_menu.extend (create {EV_MENU_SEPARATOR})
1460
1461 -- Select all
1462 create cmd.make
1463 cmd.set_menu_name (Interface_names.m_select_all)
1464 cmd.add_agent (agent select_all)
1465 command_menu_item := cmd.new_menu_item
1466 command_controller.add_edition_command (cmd)
1467 add_recyclable (command_menu_item)
1468 edit_menu.extend (command_menu_item)
1469
1470 -- Separator --------------------------------------
1471 edit_menu.extend (create {EV_MENU_SEPARATOR})
1472
1473 -- Line numbers
1474 create ln_cmd.make
1475 command_menu_item := ln_cmd.new_menu_item
1476 add_recyclable (command_menu_item)
1477 edit_menu.extend (command_menu_item)
1478 window.accelerators.extend (ln_cmd.accelerator)
1479
1480
1481 -- Separator --------------------------------------
1482 edit_menu.extend (create {EV_MENU_SEPARATOR})
1483
1484 -- Search
1485 create cmd.make
1486 cmd.set_menu_name (Interface_names.m_search + "%T" + preferences.editor_data.shortcuts.item ("show_search_panel").display_string)
1487 cmd.add_agent (agent search)
1488 command_menu_item := cmd.new_menu_item
1489 command_controller.add_edition_command (cmd)
1490 add_recyclable (command_menu_item)
1491 edit_menu.extend (command_menu_item)
1492
1493 -- Go to
1494 create cmd.make
1495 cmd.set_menu_name (Interface_names.m_go_to)
1496 cmd.add_agent (agent goto)
1497 cmd.set_needs_editable (True)
1498 command_menu_item := cmd.new_menu_item
1499 command_controller.add_edition_command (cmd)
1500 add_recyclable (command_menu_item)
1501 edit_menu.extend (command_menu_item)
1502
1503 -- Replace
1504 create cmd.make
1505 cmd.set_menu_name (Interface_names.m_replace + "%T" + preferences.editor_data.shortcuts.item ("show_search_and_replace_panel").display_string)
1506 cmd.add_agent (agent editor.replace)
1507 cmd.set_needs_editable (True)
1508 command_menu_item := cmd.new_menu_item
1509 command_controller.add_edition_command (cmd)
1510 add_recyclable (command_menu_item)
1511 edit_menu.extend (command_menu_item)
1512
1513 -- Find sub menu
1514
1515 create sub_menu.make_with_text (Interface_names.m_find)
1516
1517 -- Find next
1518 create cmd.make
1519 cmd.set_menu_name (Interface_names.m_find_next + "%T" + preferences.editor_data.shortcuts.item ("search_last").display_string)
1520 cmd.add_agent (agent find_next)
1521 command_menu_item := cmd.new_menu_item
1522 command_controller.add_edition_command (cmd)
1523 add_recyclable (command_menu_item)
1524 sub_menu.extend (command_menu_item)
1525
1526 -- Find previous
1527 create cmd.make
1528 cmd.set_menu_name (Interface_names.m_find_previous + "%T" + preferences.editor_data.shortcuts.item ("search_backward").display_string)
1529 cmd.add_agent (agent find_previous)
1530 command_menu_item := cmd.new_menu_item
1531 command_controller.add_edition_command (cmd)
1532 add_recyclable (command_menu_item)
1533 sub_menu.extend (command_menu_item)
1534
1535 -- Find selection
1536 create os_cmd.make (Current)
1537 os_cmd.set_menu_name (Interface_names.m_find_selection + "%T" + preferences.editor_data.shortcuts.item ("search_selection").display_string)
1538 os_cmd.add_agent (agent find_selection)
1539 command_menu_item := os_cmd.new_menu_item
1540 command_controller.add_selection_command (os_cmd)
1541 add_recyclable (command_menu_item)
1542 sub_menu.extend (command_menu_item)
1543
1544 edit_menu.extend (sub_menu)
1545
1546
1547 -- Separator --------------------------------------
1548 edit_menu.extend (create {EV_MENU_SEPARATOR})
1549
1550 create sub_menu.make_with_text (Interface_names.m_advanced)
1551
1552 create os_cmd.make (Current)
1553 os_cmd.set_needs_editable (True)
1554 command_controller.add_selection_command (os_cmd)
1555 os_cmd.set_menu_name (Interface_names.m_indent)
1556 os_cmd.add_agent (agent editor.indent_selection)
1557 command_menu_item := os_cmd.new_menu_item
1558 add_recyclable (command_menu_item)
1559 sub_menu.extend (command_menu_item)
1560
1561 create os_cmd.make (Current)
1562 os_cmd.set_needs_editable (True)
1563 command_controller.add_selection_command (os_cmd)
1564 os_cmd.set_menu_name (Interface_names.m_unindent)
1565 os_cmd.add_agent (agent editor.unindent_selection)
1566 command_menu_item := os_cmd.new_menu_item
1567 add_recyclable (command_menu_item)
1568 sub_menu.extend (command_menu_item)
1569
1570 create os_cmd.make (Current)
1571 os_cmd.set_needs_editable (True)
1572 command_controller.add_selection_command (os_cmd)
1573 os_cmd.set_menu_name (Interface_names.m_to_lower)
1574 os_cmd.add_agent (agent editor.set_selection_case (True))
1575 command_menu_item := os_cmd.new_menu_item
1576 add_recyclable (command_menu_item)
1577 sub_menu.extend (command_menu_item)
1578
1579 create os_cmd.make (Current)
1580 os_cmd.set_needs_editable (True)
1581 command_controller.add_selection_command (os_cmd)
1582 os_cmd.set_menu_name (Interface_names.m_to_upper)
1583 os_cmd.add_agent (agent editor.set_selection_case (False))
1584 command_menu_item := os_cmd.new_menu_item
1585 add_recyclable (command_menu_item)
1586 sub_menu.extend (command_menu_item)
1587
1588 create cmd.make
1589 cmd.set_needs_editable (True)
1590 cmd.set_menu_name (Interface_names.m_comment)
1591 cmd.add_agent (agent editor.comment_selection)
1592 command_menu_item := cmd.new_menu_item
1593 command_controller.add_edition_command (cmd)
1594 add_recyclable (command_menu_item)
1595 sub_menu.extend (command_menu_item)
1596
1597 create cmd.make
1598 cmd.set_needs_editable (True)
1599 cmd.set_menu_name (Interface_names.m_uncomment)
1600 cmd.add_agent (agent editor.uncomment_selection)
1601 command_menu_item := cmd.new_menu_item
1602 command_controller.add_edition_command (cmd)
1603 add_recyclable (command_menu_item)
1604 sub_menu.extend (command_menu_item)
1605
1606 -- Separator --------------------------------------
1607 sub_menu.extend (create {EV_MENU_SEPARATOR})
1608
1609 -- Insert if block
1610 create cmd.make
1611 cmd.set_needs_editable (True)
1612 cmd.set_menu_name (Interface_names.m_if_block)
1613 cmd.add_agent (agent editor.embed_in_block("if then", 3))
1614 command_menu_item := cmd.new_menu_item
1615 command_controller.add_edition_command (cmd)
1616 add_recyclable (command_menu_item)
1617 sub_menu.extend (command_menu_item)
1618
1619 -- Insert debug block
1620 create cmd.make
1621 cmd.set_needs_editable (True)
1622 cmd.set_menu_name (Interface_names.m_debug_block)
1623 cmd.add_agent (agent editor.embed_in_block("debug", 5))
1624 command_menu_item := cmd.new_menu_item
1625 command_controller.add_edition_command (cmd)
1626 add_recyclable (command_menu_item)
1627 sub_menu.extend (command_menu_item)
1628
1629
1630 -- Separator --------------------------------------
1631 sub_menu.extend (create {EV_MENU_SEPARATOR})
1632
1633 -- Complete word
1634 create cmd.make
1635 cmd.set_needs_editable (True)
1636 cmd.set_menu_name (Interface_names.m_complete_word + "%T" + preferences.editor_data.shortcuts.item ("autocomplete").display_string)
1637 command_menu_item := cmd.new_menu_item
1638 command_controller.add_edition_command (cmd)
1639 cmd.add_agent (agent editor.complete_feature_name)
1640
1641 add_recyclable (command_menu_item)
1642 sub_menu.extend (command_menu_item)
1643
1644 -- Complete class name
1645 create cmd.make
1646 cmd.set_needs_editable (True)
1647 cmd.set_menu_name (Interface_names.m_complete_class_name + "%T" + preferences.editor_data.shortcuts.item ("class_autocomplete").display_string)
1648 command_menu_item := cmd.new_menu_item
1649 command_controller.add_edition_command (cmd)
1650 cmd.add_agent (agent editor.complete_class_name)
1651
1652 add_recyclable (command_menu_item)
1653 sub_menu.extend (command_menu_item)
1654
1655 sub_menu.extend (create {EV_MENU_SEPARATOR})
1656
1657 -- show/hide formatting marks.
1658 create cmd.make
1659 if editor_tool.text_area.view_invisible_symbols then
1660 cmd.set_menu_name (Interface_names.m_hide_formatting_marks)
1661 else
1662 cmd.set_menu_name (Interface_names.m_show_formatting_marks)
1663 end
1664 formatting_marks_command_menu_item := cmd.new_menu_item
1665 command_controller.add_edition_command (cmd)
1666 cmd.add_agent (agent toggle_formatting_marks)
1667
1668 add_recyclable (formatting_marks_command_menu_item)
1669 sub_menu.extend (formatting_marks_command_menu_item)
1670
1671 edit_menu.extend (sub_menu)
1672 end
1673
1674 build_view_menu is
1675 -- Build the view menu.
1676 local
1677 form: EB_CLASS_INFO_FORMATTER
1678 new_menu_item: EB_COMMAND_MENU_ITEM
1679 new_basic_item: EV_MENU_ITEM
1680 do
1681 Precursor
1682
1683 new_menu_item := toggle_stone_cmd.new_menu_item
1684 view_menu.extend (new_menu_item)
1685 add_recyclable (new_menu_item)
1686
1687 new_menu_item := send_stone_to_context_cmd.new_menu_item
1688 view_menu.extend (new_menu_item)
1689 add_recyclable (new_menu_item)
1690 -- Go to menu
1691 new_basic_item := history_manager.new_menu
1692 view_menu.extend (new_basic_item)
1693
1694 -- Separator --------------------------------------
1695 view_menu.extend (create {EV_MENU_SEPARATOR})
1696 view_menu.extend (build_class_info_menu)
1697 view_menu.extend (build_feature_info_menu)
1698
1699 -- Separator --------------------------------------
1700 view_menu.extend (create {EV_MENU_SEPARATOR})
1701
1702 from
1703 managed_main_formatters.start
1704 until
1705 managed_main_formatters.after
1706 loop
1707 form := managed_main_formatters.item
1708 new_basic_item := form.new_menu_item
1709 new_basic_item.select_actions.put_front (agent form.invalidate)
1710 view_menu.extend (new_basic_item)
1711 --add_recyclable (new_basic_item)
1712 managed_main_formatters.forth
1713 end
1714 end
1715
1716 build_favorites_menu is
1717 -- Build the favorites menu
1718 do
1719 Precursor {EB_TOOL_MANAGER}
1720
1721 create show_favorites_menu_item
1722 update_show_favorites_menu_item
1723 show_favorites_menu_item.select_actions.extend (agent execute_show_favorites)
1724
1725 favorites_menu.start
1726 favorites_menu.put_right (show_favorites_menu_item)
1727 favorites_menu.select_actions.extend (agent update_show_favorites_menu_item)
1728 end
1729
1730 -- Jason Wei modified the following on Aug 31 2005
1731 build_project_menu is
1732 -- Build the project menu.
1733 local
1734 command_menu_item: EB_COMMAND_MENU_ITEM
1735 do
1736 create project_menu.make_with_text (Interface_names.m_project)
1737
1738 -- Melt
1739 command_menu_item := Melt_project_cmd.new_menu_item
1740 add_recyclable (command_menu_item)
1741 project_menu.extend (command_menu_item)
1742
1743 -- Quick melt
1744 command_menu_item := Quick_melt_project_cmd.new_menu_item
1745 add_recyclable (command_menu_item)
1746 project_menu.extend (command_menu_item)
1747
1748 -- Freeze
1749 command_menu_item := Freeze_project_cmd.new_menu_item
1750 add_recyclable (command_menu_item)
1751 project_menu.extend (command_menu_item)
1752
1753 -- Finalize
1754 command_menu_item := Finalize_project_cmd.new_menu_item
1755 add_recyclable (command_menu_item)
1756 project_menu.extend (command_menu_item)
1757
1758 -- Precompile
1759 command_menu_item := precompilation_cmd.new_menu_item
1760 add_recyclable (command_menu_item)
1761 project_menu.extend (command_menu_item)
1762
1763 -- Cancel
1764 command_menu_item := project_cancel_cmd.new_menu_item
1765 add_recyclable (command_menu_item)
1766 project_menu.extend (command_menu_item)
1767
1768 -- Separator -------------------------------------------------
1769 project_menu.extend (create {EV_MENU_SEPARATOR})
1770
1771 -- Compile Workbench C code
1772 command_menu_item := c_workbench_compilation_cmd.new_menu_item
1773 add_recyclable (command_menu_item)
1774 project_menu.extend (command_menu_item)
1775
1776 -- Compile Finalized C code
1777 command_menu_item := c_finalized_compilation_cmd.new_menu_item
1778 add_recyclable (command_menu_item)
1779 project_menu.extend (command_menu_item)
1780
1781 -- Jason Wei
1782 -- Terminate C compilation
1783 command_menu_item := Terminate_c_compilation_cmd.new_menu_item
1784 add_recyclable (command_menu_item)
1785 project_menu.extend (command_menu_item)
1786 -- Jason Wei
1787
1788 -- Execute Finalized code
1789 command_menu_item := run_finalized_cmd.new_menu_item
1790 add_recyclable (command_menu_item)
1791 project_menu.extend (command_menu_item)
1792
1793 -- Separator -------------------------------------------------
1794 project_menu.extend (create {EV_MENU_SEPARATOR})
1795
1796 -- System Tool window
1797 command_menu_item := system_cmd.new_menu_item
1798 add_recyclable (command_menu_item)
1799 project_menu.extend (command_menu_item)
1800
1801 -- System information
1802 command_menu_item := system_info_cmd.new_menu_item
1803 add_recyclable (command_menu_item)
1804 project_menu.extend (command_menu_item)
1805
1806 -- Error information
1807 command_menu_item := display_error_help_cmd.new_menu_item
1808 add_recyclable (command_menu_item)
1809 project_menu.extend (command_menu_item)
1810
1811 if has_documentation_generation or has_xmi_generation then
1812 -- Separator -------------------------------------------------
1813 project_menu.extend (create {EV_MENU_SEPARATOR})
1814 end
1815
1816 if has_documentation_generation then
1817 -- Generate Documentation
1818 command_menu_item := document_cmd.new_menu_item
1819 add_recyclable (command_menu_item)
1820 project_menu.extend (command_menu_item)
1821 end
1822
1823 if has_xmi_generation then
1824 -- Export XMI
1825 command_menu_item := export_cmd.new_menu_item
1826 add_recyclable (command_menu_item)
1827 project_menu.extend (command_menu_item)
1828 end
1829 end
1830
1831 ------- This is the original version
1832 -- build_project_menu is
1833 -- -- Build the project menu.
1834 -- local
1835 -- command_menu_item: EB_COMMAND_MENU_ITEM
1836 -- do
1837 -- create project_menu.make_with_text (Interface_names.m_project)
1838 --
1839 -- -- Melt
1840 -- command_menu_item := Melt_project_cmd.new_menu_item
1841 -- add_recyclable (command_menu_item)
1842 -- project_menu.extend (command_menu_item)
1843 --
1844 -- -- Quick melt
1845 -- command_menu_item := Quick_melt_project_cmd.new_menu_item
1846 -- add_recyclable (command_menu_item)
1847 -- project_menu.extend (command_menu_item)
1848 --
1849 -- -- Freeze
1850 -- command_menu_item := Freeze_project_cmd.new_menu_item
1851 -- add_recyclable (command_menu_item)
1852 -- project_menu.extend (command_menu_item)
1853 --
1854 -- -- Finalize
1855 -- command_menu_item := Finalize_project_cmd.new_menu_item
1856 -- add_recyclable (command_menu_item)
1857 -- project_menu.extend (command_menu_item)
1858 --
1859 -- -- Precompile
1860 -- command_menu_item := precompilation_cmd.new_menu_item
1861 -- add_recyclable (command_menu_item)
1862 -- project_menu.extend (command_menu_item)
1863 --
1864 -- -- Separator -------------------------------------------------
1865 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1866 --
1867 -- -- Compile Workbench C code
1868 -- command_menu_item := c_workbench_compilation_cmd.new_menu_item
1869 -- add_recyclable (command_menu_item)
1870 -- project_menu.extend (command_menu_item)
1871 --
1872 -- -- Compile Finalized C code
1873 -- command_menu_item := c_finalized_compilation_cmd.new_menu_item
1874 -- add_recyclable (command_menu_item)
1875 -- project_menu.extend (command_menu_item)
1876 --
1877 -- -- Execute Finalized code
1878 -- command_menu_item := run_finalized_cmd.new_menu_item
1879 -- add_recyclable (command_menu_item)
1880 -- project_menu.extend (command_menu_item)
1881 --
1882 -- -- Separator -------------------------------------------------
1883 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1884 --
1885 -- -- System Tool window
1886 -- command_menu_item := system_cmd.new_menu_item
1887 -- add_recyclable (command_menu_item)
1888 -- project_menu.extend (command_menu_item)
1889 --
1890 -- -- System information
1891 -- command_menu_item := system_info_cmd.new_menu_item
1892 -- add_recyclable (command_menu_item)
1893 -- project_menu.extend (command_menu_item)
1894 --
1895 -- -- Error information
1896 -- command_menu_item := display_error_help_cmd.new_menu_item
1897 -- add_recyclable (command_menu_item)
1898 -- project_menu.extend (command_menu_item)
1899 --
1900 -- if has_documentation_generation or has_xmi_generation then
1901 -- -- Separator -------------------------------------------------
1902 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1903 -- end
1904 --
1905 -- if has_documentation_generation then
1906 -- -- Generate Documentation
1907 -- command_menu_item := document_cmd.new_menu_item
1908 -- add_recyclable (command_menu_item)
1909 -- project_menu.extend (command_menu_item)
1910 -- end
1911 --
1912 -- if has_xmi_generation then
1913 -- -- Export XMI
1914 -- command_menu_item := export_cmd.new_menu_item
1915 -- add_recyclable (command_menu_item)
1916 -- project_menu.extend (command_menu_item)
1917 -- end
1918 -- end
1919 -- Jason Wei modified the above on Aug 31 2005
1920
1921 build_tools_menu is
1922 -- Create and build `tools_menu'
1923 local
1924 command_menu_item: EB_COMMAND_MENU_ITEM
1925 menu_item: EV_MENU_ITEM
1926 do
1927 create tools_menu.make_with_text (Interface_names.m_tools)
1928
1929 -- New Cluster command.
1930 command_menu_item := new_cluster_cmd.new_menu_item
1931 add_recyclable (command_menu_item)
1932 tools_menu.extend (command_menu_item)
1933
1934 -- New Library command.
1935 command_menu_item := new_library_cmd.new_menu_item
1936 add_recyclable (command_menu_item)
1937 tools_menu.extend (command_menu_item)
1938
1939 -- New Assembly command.
1940 command_menu_item := new_assembly_cmd.new_menu_item
1941 add_recyclable (command_menu_item)
1942 tools_menu.extend (command_menu_item)
1943
1944 -- New Class command.
1945 command_menu_item := new_class_cmd.new_menu_item
1946 add_recyclable (command_menu_item)
1947 tools_menu.extend (command_menu_item)
1948
1949 -- New Feature command.
1950 command_menu_item := new_feature_cmd.new_menu_item
1951 add_recyclable (command_menu_item)
1952 tools_menu.extend (command_menu_item)
1953
1954 -- Delete class/cluster command.
1955 command_menu_item := delete_class_cluster_cmd.new_menu_item
1956 add_recyclable (command_menu_item)
1957 tools_menu.extend (command_menu_item)
1958
1959 -- Separator --------------------------------------
1960 tools_menu.extend (create {EV_MENU_SEPARATOR})
1961
1962
1963 if has_metrics then
1964 -- Metric tool
1965 create metric_menu.make_with_text (interface_names.metric_metrics)
1966 create menu_item.make_with_text (interface_names.metric_calculate)
1967 metric_menu.extend (menu_item)
1968 create menu_item.make_with_text (interface_names.metric_add)
1969 metric_menu.extend (menu_item)
1970 create menu_item.make_with_text (interface_names.metric_delete)
1971 metric_menu.extend (menu_item)
1972 create menu_item.make_with_text (interface_names.metric_details)
1973 metric_menu.extend (menu_item)
1974 create menu_item.make_with_text (interface_names.metric_new_metrics)
1975 metric_menu.extend (menu_item)
1976 create menu_item.make_with_text (interface_names.metric_management)
1977 metric_menu.extend (menu_item)
1978 create menu_item.make_with_text (interface_names.metric_archive)
1979 metric_menu.extend (menu_item)
1980 metric_menu.disable_sensitive
1981 tools_menu.extend (metric_menu)
1982 end
1983
1984 if has_profiler then
1985 -- Profiler Window
1986 command_menu_item := show_profiler.new_menu_item
1987 add_recyclable (command_menu_item)
1988 tools_menu.extend (command_menu_item)
1989 end
1990
1991 -- Precompile Wizard
1992 command_menu_item := wizard_precompile_cmd.new_menu_item
1993 add_recyclable (command_menu_item)
1994 tools_menu.extend (command_menu_item)
1995
1996 if has_dll_generation then
1997 -- Dynamic Library Window
1998 command_menu_item := show_dynamic_lib_tool.new_menu_item
1999 add_recyclable (command_menu_item)
2000 tools_menu.extend (command_menu_item)
2001 end
2002
2003 -- Separator -------------------------------------------------
2004 tools_menu.extend (create {EV_MENU_SEPARATOR})
2005
2006 -- Preferences
2007 command_menu_item := Show_preferences_cmd.new_menu_item
2008 add_recyclable (command_menu_item)
2009 tools_menu.extend (command_menu_item)
2010
2011 -- External commands editor
2012 command_menu_item := Edit_external_commands_cmd.new_menu_item
2013 add_recyclable (command_menu_item)
2014 tools_menu.extend (command_menu_item)
2015
2016 rebuild_tools_menu
2017 end
2018
2019 feature -- Stone process
2020
2021 stone: STONE
2022 -- Current stone
2023
2024 toggle_unified_stone is
2025 -- Change the stone management mode.
2026 do
2027 unified_stone := not unified_stone
2028 if unified_stone then
2029 send_stone_to_context
2030 send_stone_to_context_cmd.disable_sensitive
2031 context_tool.link_to_development_window
2032 else
2033 if stone /= Void then
2034 send_stone_to_context_cmd.enable_sensitive
2035 end
2036 context_tool.cut_from_development_window
2037 end
2038 end
2039
2040 set_stone (a_stone: STONE) is
2041 -- Change the currently focused stone.
2042 local
2043 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
2044 cv_cst: CLASSI_STONE
2045 ef_stone: EXTERNAL_FILE_STONE
2046 l: LIST [EB_DEVELOPMENT_WINDOW]
2047 l_filename: STRING
2048 do
2049 cv_cst ?= a_stone
2050 if cv_cst /= Void then
2051 l_filename := cv_cst.class_i.name
2052 else
2053 ef_stone ?= a_stone
2054 if ef_stone /= Void then
2055 l_filename := ef_stone.file_name.string
2056 end
2057 end
2058
2059 if cv_cst /= Void or ef_stone /= Void then
2060 l := Window_manager.development_windows_with_class (l_filename)
2061 if l.is_empty or else l.has (Current) then
2062 -- We're not editing the class in another window.
2063 set_stone_after_first_check (a_stone)
2064 else
2065 create cd.make_initialized (2,
2066 preferences.dialog_data.already_editing_class_string,
2067 warning_messages.w_class_already_edited,
2068 Interface_names.l_do_not_show_again,
2069 preferences.preferences)
2070 cd.set_ok_action (agent set_stone_after_first_check (a_stone))
2071 cd.show_modal_to_window (window)
2072 end
2073 else
2074 set_stone_after_first_check (a_stone)
2075 end
2076 end
2077
2078 set_stone_after_first_check (a_stone: STONE) is
2079 -- Display text associated with `a_stone', if any and if possible
2080 local
2081 feature_stone: FEATURE_STONE
2082 old_class_stone: CLASSI_STONE
2083 test_stone: CLASSI_STONE
2084 same_class: BOOLEAN
2085 conv_ferrst: FEATURE_ERROR_STONE
2086 ef_stone: EXTERNAL_FILE_STONE
2087 cluster_st: CLUSTER_STONE
2088 new_class_stone: CLASSI_STONE
2089 conv_ace: ACE_SYNTAX_STONE
2090 conv_errst: ERROR_STONE
2091 conv_brkstone: BREAKABLE_STONE
2092 do
2093 old_class_stone ?= stone
2094 feature_stone ?= a_stone
2095 ef_stone ?= a_stone
2096 new_class_stone ?= a_stone
2097 cluster_st ?= a_stone
2098
2099 -- Update the history.
2100 conv_brkstone ?= a_stone
2101 conv_errst ?= a_stone
2102 conv_ace ?= a_stone
2103 if
2104 conv_brkstone = Void and
2105 conv_errst = Void and
2106 conv_ace = Void and
2107 ef_stone = Void
2108 then
2109 if
2110 new_class_stone /= Void
2111 then
2112 history_manager.extend (new_class_stone)
2113 elseif
2114 cluster_st /= Void
2115 then
2116 history_manager.extend (cluster_st)
2117 end
2118 end
2119
2120 if old_class_stone /= Void then
2121 create test_stone.make (old_class_stone.class_i)
2122 same_class := test_stone.same_as (a_stone)
2123 -- We need to compare classes. If `old_class_stone' is a FEATURE_STONE
2124 -- `same_as' will compare features. Therefore, we need `test_stone' to be sure
2125 -- we have a CLASSI_STONE.
2126 if same_class and then feature_stone /= Void then
2127 same_class := False
2128 -- if the stone corresponding to a feature of currently opened class is dropped
2129 -- we attempt to scroll to the feature without asking to save the file
2130 -- except if it is during a resynchronization, in which case we do not scroll at all.
2131 if editor_tool.text_area.text_is_fully_loaded then
2132 if not during_synchronization then
2133 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
2134 feature_stone_already_processed := True
2135 else
2136 feature_stone_already_processed := True
2137 end
2138 conv_ferrst ?= feature_stone
2139 if feature_stone_already_processed and conv_ferrst /= Void then
2140 -- Scroll to the line of the error.
2141 if not during_synchronization then
2142 editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
2143 end
2144 end
2145 end
2146 end
2147 elseif ef_stone /= Void then
2148 end
2149
2150 -- first, let's check if there is already something in this window
2151 -- if there's nothing, there's no need to save anything...
2152 if stone = Void or else not changed or else feature_stone_already_processed or else same_class then
2153 set_stone_after_check (a_stone)
2154 feature_stone_already_processed := False
2155 else
2156 -- there is something to be saved
2157 -- if user chooses to save, current file will be parsed
2158 -- if there is a syntax_error, new file is not loaded
2159 save_and (agent set_stone_after_check (a_stone))
2160 if text_saved and then not syntax_is_correct then
2161 text_saved := False
2162 during_synchronization := True
2163 set_stone_after_check (stone)
2164 during_synchronization := False
2165 address_manager.refresh
2166 end
2167 end
2168 if not editor_tool.text_area.has_focus then
2169 ev_application.idle_actions.extend_kamikaze (agent editor_tool.set_focus)
2170 end
2171 end
2172
2173 force_stone (s: STONE) is
2174 -- make `s' the new value of `stone', and
2175 -- change the display accordingly. Try to
2176 -- extract a class from `s' whenever possible.
2177 do
2178 if s.is_storable then
2179 set_stone (s)
2180 if not unified_stone then
2181 context_tool.advanced_set_stone (s)
2182 end
2183 end
2184 end
2185
2186 process_class (s: CLASSI_STONE) is
2187 -- Process class stone
2188 do
2189 set_stone (s)
2190 end
2191
2192 process_feature_error (s: FEATURE_ERROR_STONE) is
2193 -- Process feature error stone.
2194 local
2195 cl_stone: CLASSC_STONE
2196 e_class: CLASS_C
2197 do
2198 set_default_format
2199 e_class := s.e_feature.written_class
2200 create cl_stone.make (e_class)
2201 set_stone (cl_stone)
2202 editor_tool.text_area.deselect_all
2203 if s.line_number > 0 then
2204 editor_tool.text_area.highlight_selected (s.line_number, s.line_number)
2205 end
2206 end
2207
2208
2209 process_class_syntax (s: CL_SYNTAX_STONE) is
2210 -- Process class syntax.
2211 local
2212 cl_stone: CLASSC_STONE
2213 do
2214 -- call set_stone to ensure the proper class is displayed
2215 create cl_stone.make (s.e_class)
2216 set_stone (cl_stone)
2217 editor_tool.text_area.deselect_all
2218 editor_tool.text_area.highlight_when_ready (s.line, s.line)
2219 end
2220
2221 refresh is
2222 -- Synchronize clickable elements with text, if possible.
2223 do
2224 --| FIXME ARNAUD
2225 -- synchronise_stone
2226 --| END FIXME
2227 --| FIXME XR: Refresh current display in the editor.
2228 editor_tool.text_area.update_click_list (False)
2229 update_save_symbol
2230 address_manager.refresh
2231 -- The cluster manager should already be refreshed by the window manager.
2232 -- cluster_manager.refresh
2233 -- context_tool.refresh
2234 end
2235
2236 quick_refresh_editors is
2237 -- Redraw editors' drawing area.
2238 do
2239 editor_tool.text_area.refresh
2240 context_tool.quick_refresh_editors
2241 end
2242
2243 quick_refresh_margins is
2244 -- Redraw the main editor's drawing area.
2245 do
2246 editor_tool.text_area.margin.refresh
2247 context_tool.quick_refresh_margins
2248 end
2249
2250 set_default_format is
2251 -- Default format of windows.
2252 --| FIXME ARNAUD: To be implemented.
2253 -- local
2254 -- f: EB_FORMATTER
2255 do
2256 -- if stone /= Void then
2257 -- if stone.class_i.hide_implementation then
2258 -- f := format_list.precompiled_default_format
2259 -- else
2260 -- f := format_list.default_format
2261 -- end
2262 -- else
2263 -- f := format_list.default_format
2264 -- end
2265 -- set_last_format (f)
2266 --| END FIXME
2267 end
2268
2269 feature -- Position provider
2270
2271 position: like position_internal is
2272 -- Currently shown text position in the editor
2273 do
2274 Result := editor_tool.text_area.first_line_displayed
2275 end
2276
2277 pos_container: like pos_container_internal is
2278 -- Current selected formatter
2279 do
2280 Result := selected_formatter
2281 end
2282
2283 feature -- Resource Update
2284
2285 update is
2286 -- Update Current with the registered resources.
2287 do
2288 lock_update
2289 -- Show/hide general toolbar
2290 if development_window_data.show_general_toolbar then
2291 show_general_toolbar_command.enable_visible
2292 else
2293 show_general_toolbar_command.disable_visible
2294 end
2295
2296 -- Show/hide address toolbar
2297 if development_window_data.show_address_toolbar then
2298 show_address_toolbar_command.enable_visible
2299 else
2300 show_address_toolbar_command.disable_visible
2301 end
2302
2303 -- Show/hide project toolbar
2304 if development_window_data.show_project_toolbar then
2305 show_project_toolbar_command.enable_visible
2306 else
2307 show_project_toolbar_command.disable_visible
2308 end
2309
2310 -- Show/hide refactoring toolbar
2311 if development_window_data.show_refactoring_toolbar then
2312 show_refactoring_toolbar_command.enable_visible
2313 else
2314 show_refactoring_toolbar_command.disable_visible
2315 end
2316
2317 left_panel.load_from_resource (development_window_data.left_panel_layout)
2318 right_panel.load_from_resource (development_window_data.right_panel_layout)
2319 splitter_position := development_window_data.left_panel_width
2320 update_splitters
2321 unlock_update
2322 end
2323
2324 update_splitters is
2325 -- Refresh the position of the splitter on screen according to
2326 -- our internal values.
2327 do
2328 -- Set the interior layout
2329 if panel.full then
2330 panel.set_split_position (splitter_position.max (panel.minimum_split_position))
2331 end
2332 end
2333
2334 register is
2335 -- Register to preferences we want notification of.
2336 do
2337 end
2338
2339 unregister is
2340 -- unregister to preferences we want notification of.
2341 do
2342 end
2343
2344 reset is
2345 -- Reset the window contents
2346 do
2347 Precursor
2348 address_manager.reset
2349
2350 --| FIXME ARNAUD, multiformat not yet implemented.
2351 -- format_list.enable_imp_formats_sensitive
2352 --| END FIXME
2353 end
2354
2355 rebuild_tools_menu is
2356 -- Refresh the list of external commands.
2357 local
2358 ms: LIST [EB_COMMAND_MENU_ITEM]
2359 l_sep: EV_MENU_SEPARATOR
2360 do
2361 -- Remove all the external commands, which are at the end of the menu.
2362 from
2363 tools_menu.go_i_th (tools_menu.count + 1 - number_of_displayed_external_commands)
2364 until
2365 tools_menu.after
2366 loop
2367 tools_menu.remove
2368 end
2369 ms := Edit_external_commands_cmd.menus
2370 number_of_displayed_external_commands := ms.count
2371
2372 if not ms.is_empty and not tools_menu.is_empty then
2373 l_sep ?= tools_menu.last
2374 if l_sep = Void then
2375 create l_sep
2376 tools_menu.extend (l_sep)
2377 number_of_displayed_external_commands := number_of_displayed_external_commands + 1
2378 end
2379 end
2380
2381 from
2382 ms.start
2383 until
2384 ms.after
2385 loop
2386 tools_menu.extend (ms.item)
2387 add_recyclable (ms.item)
2388 ms.forth
2389 end
2390 end
2391
2392 syntax_is_correct: BOOLEAN is
2393 -- file was successfully parsed.
2394 do
2395 Result := editor_tool.text_area.syntax_is_correct
2396 end
2397
2398 on_project_created is
2399 -- Inform tools that the current project has been loaded or re-loaded.
2400 do
2401 build_menu_bar
2402 enable_commands_on_project_created
2403 context_tool.on_project_created
2404 address_manager.on_project_created
2405 if has_dll_generation then
2406 show_dynamic_lib_tool.enable_sensitive
2407 end
2408 if has_profiler then
2409 show_profiler.enable_sensitive
2410 end
2411 end
2412
2413 on_project_loaded is
2414 -- Inform tools that the current project has been loaded or re-loaded.
2415 do
2416 -- cluster_manager.on_project_loaded
2417 enable_commands_on_project_loaded
2418 cluster_tool.on_project_loaded
2419 context_tool.on_project_loaded
2420 breakpoints_tool.on_project_loaded
2421 end
2422
2423 on_project_unloaded is
2424 -- Inform tools that the current project will soon been unloaded.
2425 do
2426 -- cluster_manager.on_project_unloaded
2427 disable_commands_on_project_unloaded
2428 cluster_tool.on_project_unloaded
2429 context_tool.on_project_unloaded
2430 address_manager.on_project_unloaded
2431 build_menu_bar
2432 if has_dll_generation then
2433 show_dynamic_lib_tool.disable_sensitive
2434 end
2435 if has_profiler then
2436 show_profiler.disable_sensitive
2437 end
2438 end
2439
2440 on_c_compilation_starts is
2441 -- Enable commands when freezing or finalizing starts.
2442 do
2443 c_workbench_compilation_cmd.disable_sensitive
2444 c_finalized_compilation_cmd.disable_sensitive
2445 end
2446
2447 on_c_compilation_stops is
2448 -- Disable commands when freezing or finalizing stops.
2449 do
2450 c_workbench_compilation_cmd.enable_sensitive
2451 c_finalized_compilation_cmd.enable_sensitive
2452 end
2453
2454 save_before_compiling is
2455 -- save the text but do not update clickable positions
2456 do
2457 save_only := True
2458 save_text
2459 end
2460
2461 perform_check_before_save is
2462 -- Perform any pre-save operations/checks
2463 local
2464 dial: EV_CONFIRMATION_DIALOG
2465 do
2466 -- Remove trailing blanks.
2467 if preferences.editor_data.auto_remove_trailing_blank_when_saving then
2468 editor_tool.text_area.text_displayed.remove_trailing_blanks
2469 else
2470 editor_tool.text_area.text_displayed.remove_trailing_fake_blanks
2471 end
2472 editor_tool.text_area.refresh_now
2473
2474 if editor_tool.text_area.open_backup then
2475 create dial.make_with_text(Warning_messages.w_save_backup)
2476 dial.set_buttons_and_actions(<<"Continue", "Cancel">>, <<agent continue_save, agent cancel_save>>)
2477 dial.set_default_push_button(dial.button("Continue"))
2478 dial.set_default_cancel_button(dial.button("Cancel"))
2479 dial.set_title ("Save Backup")
2480 dial.show_modal_to_window (window)
2481 else
2482 check_passed := True
2483 end
2484 end
2485
2486 continue_save is
2487 -- continue saving
2488 do
2489 check_passed := True
2490 end
2491
2492 cancel_save is
2493 -- cancel saving
2494 do
2495 check_passed := False
2496 end
2497
2498 process is
2499 -- process the user entry in the address bar
2500 local
2501 l_class_stone: CLASSI_STONE
2502 l_multi_search_tool: EB_MULTI_SEARCH_TOOL
2503 do
2504 save_canceled := False
2505 l_class_stone ?= stone
2506 if l_class_stone /= Void then
2507 l_multi_search_tool ?= search_tool
2508 if l_multi_search_tool /= Void then
2509 l_multi_search_tool.class_changed (l_class_stone.class_i)
2510 end
2511 end
2512 end
2513
2514 on_text_saved is
2515 -- Notify the editor that the text has been saved
2516 local
2517 str: STRING
2518 do
2519 Precursor
2520 editor_tool.on_text_saved
2521 text_saved := True
2522 if not save_only then
2523 editor_tool.text_area.update_click_list (True)
2524 end
2525 save_only := False
2526 str := title.twin
2527 if str @ 1 = '*' then
2528 str.keep_tail (str.count - 2)
2529 set_title (str)
2530 end
2531 update_formatters
2532 lock_update
2533 features_tool.synchronize
2534 refresh_cursor_position
2535 refresh_context_info
2536 unlock_update
2537 if editor_tool.text_area.syntax_is_correct then
2538 status_bar.display_message ("")
2539 else
2540 status_bar.display_message (Interface_names.L_syntax_error)
2541 end
2542 text_edited := False
2543 end
2544
2545 on_focus is
2546 -- Focus gained
2547 local
2548 editor: TEXT_PANEL
2549 do
2550 editor ?= editor_tool.text_area
2551 if editor /= Void then
2552 editor.on_focus
2553 end
2554 end
2555
2556 save_and (an_action: PROCEDURE [ANY, TUPLE]) is
2557 local
2558 save_dialog: EB_CONFIRM_SAVE_DIALOG
2559 do
2560 save_canceled := True
2561 text_saved := False
2562 create save_dialog.make_and_launch (Current,Current)
2563 if not save_canceled and then syntax_is_correct then
2564 an_action.call(Void)
2565 end
2566 end
2567
2568 update_viewpoints is
2569 -- Update viewpoints
2570 local
2571 l_formatter: EB_FORMATTER
2572 l_end_loop: BOOLEAN
2573 l_index: INTEGER
2574 do
2575 view_points_combo.disable_sensitive
2576 if view_points_combo.has_renamed_view_point then
2577 l_index := managed_main_formatters.index
2578 from
2579 managed_main_formatters.start
2580 managed_main_formatters.forth
2581 until
2582 managed_main_formatters.after or l_end_loop
2583 loop
2584 l_formatter := managed_main_formatters.item
2585 if l_formatter.selected and l_formatter.button.is_sensitive then
2586 l_end_loop := True
2587 view_points_combo.enable_sensitive
2588 end
2589 managed_main_formatters.forth
2590 end
2591 managed_main_formatters.go_i_th (l_index)
2592 end
2593 end
2594
2595 feature -- Window management
2596
2597 show_window is
2598 -- Show the window
2599 do
2600 show
2601 end
2602
2603 raise_window is
2604 -- Show the window and set the focus to it.
2605 do
2606 show
2607 --| FIXME, set the focus.
2608 end
2609
2610 hide_window is
2611 -- Hide the window
2612 do
2613 hide
2614 end
2615
2616 destroy_window is
2617 -- Destroy the window.
2618 do
2619 destroy
2620 end
2621
2622 give_focus is
2623 -- Give the focus to the address manager.
2624 do
2625 address_manager.set_focus
2626 end
2627
2628 save_layout is
2629 -- Store layout of `current'.
2630 do
2631 save_layout_to_window_data (development_window_data)
2632 -- Commit saves
2633 preferences.preferences.save_preferences
2634 end
2635
2636 save_layout_to_session (a_session: ES_SESSION) is
2637 -- Save session data of `Current' to session object `a_session'.
2638 local
2639 a_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA
2640 a_class_i: CLASSI_STONE
2641 do
2642 create a_window_data.make_from_window_data (preferences.development_window_data)
2643
2644 a_class_i ?= stone
2645 if a_class_i /= Void then
2646 a_window_data.save_filename (a_class_i.file_name)
2647 a_window_data.save_editor_position (editor_tool.text_area.current_cursor_position)
2648 end
2649
2650 if context_tool /= Void then
2651 a_window_data.save_context_data (
2652 context_tool.address_manager.cluster_label_text,
2653 context_tool.address_manager.class_label_text,
2654 context_tool.address_manager.feature_label_text,
2655 context_tool.notebook.selected_item_index
2656 )
2657 end
2658
2659 save_layout_to_window_data (a_window_data)
2660
2661 -- Add the session data of `Current' to the session object.
2662 a_session.window_session_data.extend (a_window_data)
2663 end
2664
2665 save_layout_to_window_data (a_window_data: EB_DEVELOPMENT_WINDOW_DATA) is
2666 -- Store window data of `Current' in `a_window_data'.
2667 require
2668 a_window_data_not_void: a_window_data /= Void
2669 do
2670 -- Now save the windows's layout, but only if the
2671 -- debugger is not displayed in `Current'. By saving the layout,
2672 -- we ensure that future windows may use exactly the same layout.
2673 -- If the debugger is displayed, the previous layout is already saved,
2674 -- and this is the one that must be used, as only one debugger is ever displayed.
2675 if
2676 (Eb_debugger_manager.application_is_executing and Eb_debugger_manager.debugging_window /= Current)
2677 or not Eb_debugger_manager.application_is_executing
2678 then
2679 a_window_data.save_left_panel_layout (left_panel.save_to_resource)
2680 a_window_data.save_right_panel_layout (right_panel.save_to_resource)
2681 a_window_data.save_left_panel_width (panel.split_position)
2682 -- Save width & height.
2683 a_window_data.save_size (window.width, window.height)
2684 a_window_data.save_window_state (window.is_minimized, window.is_maximized)
2685 a_window_data.save_position (window.x_position, window.y_position)
2686 end
2687 end
2688
2689
2690 feature -- Tools & Controls
2691
2692 editor_tool: EB_EDITOR_TOOL
2693
2694 favorites_tool: EB_FAVORITES_TOOL
2695
2696 properties_tool: EB_PROPERTIES_TOOL
2697
2698 cluster_tool: EB_CLUSTER_TOOL
2699
2700 search_tool: EB_MULTI_SEARCH_TOOL
2701
2702 features_tool: EB_FEATURES_TOOL
2703
2704 breakpoints_tool: ES_BREAKPOINTS_TOOL
2705
2706 windows_tool: EB_WINDOWS_TOOL
2707
2708 context_tool: EB_CONTEXT_TOOL
2709 -- Context explorer for current class and system.
2710
2711 address_manager: EB_ADDRESS_MANAGER
2712 -- Text field in the toolbar
2713 -- Allow user to enter the name
2714 -- of the class he wants to edit.
2715
2716 project_manager: EB_PROJECT_MANAGER is
2717 -- Project manager associated to the project the user is working on.
2718 do
2719 Result := Eiffel_project.manager
2720 end
2721
2722 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2723 -- All formatters that operate on a class.
2724
2725 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2726 -- All formatters that operate on a class.
2727
2728 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2729 -- All formatters that can be displayed in the main editor frame.
2730
2731 view_points_combo: EB_VIEWPOINT_COMBO_BOX
2732 -- Combo box used to a select viewpoints
2733
2734 view_points_widget: EV_HORIZONTAL_BOX
2735 -- Widget to contain viewpoints box
2736
2737 unified_stone: BOOLEAN
2738 -- Is the stone common with the context tool or not?
2739
2740 arguments_dialog: EB_ARGUMENT_DIALOG
2741 -- The arguments dialog for current, if any
2742
2743 goto_dialog: EB_GOTO_DIALOG
2744 -- The goto dialog for line number access
2745
2746 feature -- Multiple editor management
2747
2748 add_editor_to_list (an_editor: EB_EDITOR) is
2749 -- adds `an_editor' to `editors'
2750 do
2751 editors.extend (an_editor)
2752 end
2753
2754 current_editor: EB_EDITOR is
2755 -- current editor, if none, main editor
2756 do
2757 if current_editor_index /= 0 then
2758 Result := editors @ current_editor_index
2759 else
2760 Result := editors.first
2761 end
2762 end
2763
2764 set_current_editor (an_editor: EB_EDITOR) is
2765 -- set `an_editor' as main editor
2766 local
2767 old_index: INTEGER
2768 new_index: INTEGER
2769 do
2770 old_index := current_editor_index
2771 new_index := editors.index_of (an_editor, 1)
2772 if
2773 editors.valid_index (new_index) and
2774 old_index /= new_index
2775 then
2776 current_editor_index := new_index
2777 update_paste_cmd
2778 -- Last thing, update the menu entry for the formatting marks.
2779 if current_editor.view_invisible_symbols then
2780 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
2781 else
2782 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
2783 end
2784 command_controller.set_current_editor (an_editor)
2785 end
2786 end
2787
2788 update_paste_cmd is
2789 -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2790 do
2791 if
2792 not current_editor.is_empty and then
2793 current_editor.is_editable and then
2794 current_editor.clipboard.has_text
2795 then
2796 editor_paste_cmd.enable_sensitive
2797 else
2798 editor_paste_cmd.disable_sensitive
2799 end
2800 end
2801
2802 feature {NONE} -- Multiple editor management
2803
2804 editors: ARRAYED_LIST [EB_EDITOR]
2805 -- editor contained in `Current'
2806
2807 current_editor_index: INTEGER
2808 -- Index in `editors' of the editor that has the focus.
2809
2810 feature {EB_FEATURES_TOOL, EB_FEATURES_TREE, DOTNET_CLASS_AS} -- Feature Clauses
2811
2812 set_feature_clauses (a_features: ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]]; a_type: STRING) is
2813 -- Set 'features' to 'a_features' and store in hash table with key 'a_type' denoting name of consumed
2814 -- type pertinent to 'a_features'.
2815 require
2816 a_features_not_void: a_features /= Void
2817 do
2818 if feature_clauses = Void then
2819 create feature_clauses.make (5)
2820 end
2821 feature_clauses.put (a_features, a_type)
2822 end
2823
2824 set_feature_locating (a_locating: BOOLEAN) is
2825 -- Set `feature_locating' with `a_locating'.
2826 do
2827 feature_locating := a_locating
2828 end
2829
2830 get_feature_clauses (a_type: STRING): ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]] is
2831 -- Get list of feature clauses relevant to .NET type with name 'a_type'.
2832 require
2833 a_type_not_void: a_type /= Void
2834 has_type_clauses: feature_clauses.has (a_type)
2835 do
2836 Result := feature_clauses.item (a_type)
2837 ensure
2838 result_not_void: Result /= Void
2839 end
2840
2841 feature_clauses: HASH_TABLE [ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]], STRING]
2842 -- List of features clauses for Current window hashed by the .NET name of the consumed_type.
2843
2844 feature_positions: HASH_TABLE [INTEGER, E_FEATURE]
2845 -- Features indexed by line position in class text (for .NET features).
2846
2847 feature_locating: BOOLEAN
2848 -- Is feature tool locating a feature?
2849
2850 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2851
2852 destroy_imp is
2853 -- Destroy window.
2854 do
2855 -- To avoid reentrance
2856 if not is_destroying then
2857 is_destroying := True
2858 -- If a launched application is still running, kill it.
2859 if
2860 Eb_debugger_manager.application_is_executing
2861 and then Eb_debugger_manager.debugging_window = Current
2862 then
2863 Eb_debugger_manager.Application.kill
2864 else
2865 development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2866 development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2867 end
2868 development_window_data.save_left_panel_width (panel.split_position)
2869 -- Save width & height.
2870 development_window_data.save_size (window.width, window.height)
2871 development_window_data.save_window_state (window.is_minimized, window.is_maximized)
2872 development_window_data.save_position (window.x_position, window.y_position)
2873 hide
2874
2875 -- Commit saves
2876 preferences.preferences.save_preferences
2877
2878 estudio_debug_cmd.unattach_window (window)
2879 toolbars_area.wipe_out
2880 address_manager.recycle
2881 project_customizable_toolbar.recycle
2882 refactoring_customizable_toolbar.recycle
2883 Precursor {EB_TOOL_MANAGER}
2884 left_panel.recycle
2885 right_panel.recycle
2886 managed_class_formatters.wipe_out
2887 managed_feature_formatters.wipe_out
2888 managed_main_formatters.wipe_out
2889 toolbarable_commands.wipe_out
2890 editors.wipe_out
2891 editors := Void
2892 stone := Void
2893 end
2894 end
2895
2896 feature -- C output pixmap management
2897
2898 start_c_output_pixmap_timer is
2899 -- Start timer to draw c output pixmap.
2900 do
2901 if context_tool /= Void then
2902 context_tool.start_c_output_pixmap_timer
2903 end
2904 end
2905
2906 stop_c_output_pixmap_timer is
2907 -- Stop timer to draw c output pixmap.
2908 do
2909 if context_tool /= Void then
2910 context_tool.stop_c_output_pixmap_timer
2911 end
2912 end
2913
2914 feature {NONE} -- Implementation
2915
2916 set_stone_after_check (a_stone: STONE) is
2917 local
2918 old_stone: STONE
2919 new_class_stone: CLASSI_STONE
2920 old_class_stone: CLASSI_STONE
2921 conv_classc: CLASSC_STONE
2922 conv_brkstone: BREAKABLE_STONE
2923 cluster_st: CLUSTER_STONE
2924 old_cluster_st: CLUSTER_STONE
2925 feature_stone: FEATURE_STONE
2926 conv_ferrst: FEATURE_ERROR_STONE
2927
2928 ef_stone: EXTERNAL_FILE_STONE
2929 f: FILE
2930
2931 conv_errst: ERROR_STONE
2932 cl_syntax_stone: CL_SYNTAX_STONE
2933 error_line: INTEGER
2934 class_file: RAW_FILE
2935 class_text_exists: BOOLEAN
2936 same_class: BOOLEAN
2937 test_stone: CLASSI_STONE
2938 conv_ace: ACE_SYNTAX_STONE
2939 externali: EXTERNAL_CLASS_I
2940 external_cons: CONSUMED_TYPE
2941 str: STRING
2942 dotnet_class: BOOLEAN
2943 l_short_formatter: EB_SHORT_FORMATTER
2944 l_flat_formatter: EB_FLAT_SHORT_FORMATTER
2945 l_main_formatter: EB_CLASS_TEXT_FORMATTER
2946 app_exec: APPLICATION_EXECUTION
2947 do
2948 -- the text does not change if the text was saved with syntax errors
2949 cur_wid := window
2950 if cur_wid = Void then
2951 --| Do nothing.
2952 else
2953 if old_cur = Void then
2954 old_cur := cur_wid.pointer_style
2955 end
2956 -- cur_wid.enable_capture
2957 cur_wid.set_pointer_style (Wait_cursor)
2958 end
2959
2960 conv_brkstone ?= a_stone
2961 conv_errst ?= a_stone
2962 conv_ace ?= a_stone
2963 ef_stone ?= a_stone
2964 if conv_brkstone /= Void then
2965 app_exec := Debugger_manager.application
2966 if app_exec.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2967 app_exec.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2968 else
2969 app_exec.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2970 end
2971 Debugger_manager.notify_breakpoints_changes
2972 elseif conv_errst /= Void then
2973 display_error_help_cmd.execute_with_stone (conv_errst)
2974 elseif conv_ace /= Void then
2975 --| FIXME XR: What should we do?!
2976 elseif ef_stone /= Void then
2977 f := ef_stone.file
2978 f.make_open_read (f.name)
2979 f.read_stream (f.count)
2980 f.close
2981 editor_tool.text_area.set_stone (a_stone)
2982 editor_tool.text_area.load_text (f.last_string)
2983 else
2984 -- Remember previous stone.
2985 old_stone := stone
2986 old_class_stone ?= stone
2987 old_cluster_st ?= stone
2988
2989 -- New stone properties
2990 new_class_stone ?= a_stone
2991
2992 -- Set the stone.
2993 old_set_stone (a_stone)
2994 cluster_st ?= a_stone
2995
2996 new_feature_cmd.disable_sensitive
2997 toggle_feature_alias_cmd.disable_sensitive
2998 toggle_feature_signature_cmd.disable_sensitive
2999 toggle_feature_assigner_cmd.disable_sensitive
3000
3001 -- We update the state of the `Add to Favorites' command.
3002 if new_class_stone /= Void then
3003 favorites_menu.first.enable_sensitive
3004 else
3005 favorites_menu.first.disable_sensitive
3006 end
3007
3008 -- Update the address manager if needed.
3009 address_manager.refresh
3010 if new_class_stone /= Void then
3011 if not during_synchronization then
3012 view_points_combo.set_conf_class (new_class_stone.class_i.config_class)
3013 end
3014 -- Text is now editable.
3015 editor_tool.text_area.set_read_only (False)
3016
3017 -- class stone was dropped
3018 create class_file.make (new_class_stone.class_i.file_name)
3019 class_text_exists := class_file.exists
3020 feature_stone ?= a_stone
3021 --| We have to create a classi_stone to check whether the stones are really similar.
3022 --| Otherwise a redefinition of same_as may be called.
3023 create test_stone.make (new_class_stone.class_i)
3024 if test_stone.same_as (old_class_stone) then
3025 same_class := True
3026 end
3027 if not feature_stone_already_processed then
3028 if same_class and then text_saved then
3029 -- nothing changed in the editor
3030 -- we only have to update click_list
3031 if editor_tool.text_area.is_editable then
3032 editor_tool.text_area.update_click_list (False)
3033 end
3034 else
3035 if changed then
3036 -- user has already chosen not to save the file
3037 -- do not ask again
3038 Feature_positions.wipe_out
3039 editor_tool.text_area.no_save_before_next_load
3040 end
3041 end
3042 end
3043
3044 conv_classc ?= new_class_stone
3045
3046 -- First choose possible formatter
3047 l_main_formatter ?= new_class_stone.pos_container
3048 if l_main_formatter /= Void and not during_synchronization then
3049 if
3050 not (conv_classc /= Void and class_text_exists and (not changed or not same_class))
3051 then
3052 l_main_formatter.enable_select
3053 elseif feature_stone = Void then
3054 if l_main_formatter /= pos_container then
3055 l_main_formatter.enable_select
3056 end
3057 if new_class_stone.position > 0 then
3058 editor_tool.text_area.display_line_at_top_when_ready (new_class_stone.position)
3059 end
3060 end
3061 end
3062
3063 if conv_classc = Void or else
3064 conv_classc.e_class.is_external or else
3065 feature_stone /= Void and not
3066 feature_stone_already_processed and not
3067 (same_class and context_tool.sending_stone) then
3068 -- If a classi_stone or a feature_stone or a external call
3069 -- has been dropped, check to see if a .NET class.
3070 if class_text_exists then
3071 if new_class_stone.class_i.is_external_class then
3072 externali ?= new_class_stone.class_i
3073 check
3074 externali_not_void: externali /= Void
3075 end
3076 external_cons := externali.external_consumed_type
3077 if external_cons /= Void then
3078 -- A .NET class.
3079 dotnet_class := True
3080 l_short_formatter ?= managed_main_formatters.i_th (4)
3081 l_flat_formatter ?= managed_main_formatters.i_th (5)
3082 if l_short_formatter /= Void then
3083 l_short_formatter.set_dotnet_mode (True)
3084 end
3085 if l_flat_formatter /= Void then
3086 l_flat_formatter.set_dotnet_mode (True)
3087 end
3088 end
3089 elseif feature_stone /= Void then
3090 from
3091 managed_main_formatters.start
3092 until
3093 managed_main_formatters.after
3094 loop
3095 managed_main_formatters.item.set_stone (new_class_stone)
3096 managed_main_formatters.forth
3097 end
3098 else
3099 managed_main_formatters.first.set_stone (new_class_stone)
3100 managed_main_formatters.first.execute
3101 end
3102 else
3103 editor_tool.text_area.clear_window
3104 editor_tool.text_area.display_message (
3105 Warning_messages.w_file_not_exist (
3106 new_class_stone.class_i.file_name))
3107 end
3108 end
3109 if conv_classc = Void then
3110 --| The dropped class is not compiled.
3111 --| Display only the textual formatter.
3112 if dotnet_class then
3113 managed_main_formatters.i_th (4).set_stone (new_class_stone)
3114 managed_main_formatters.i_th (5).set_stone (new_class_stone)
3115 managed_main_formatters.i_th (4).execute
3116 end
3117 address_manager.disable_formatters
3118 else
3119 --| We have a compiled class.
3120 if
3121 class_text_exists and then
3122 Eiffel_project.Workbench.last_reached_degree <= 2
3123 then
3124 new_feature_cmd.enable_sensitive
3125 toggle_feature_alias_cmd.enable_sensitive
3126 toggle_feature_signature_cmd.enable_sensitive
3127 toggle_feature_assigner_cmd.enable_sensitive
3128 end
3129
3130 --address_manager.enable_formatters
3131 update_formatters
3132 if not class_text_exists then
3133 --| Disable the textual formatter.
3134 managed_main_formatters.first.disable_sensitive
3135 from
3136 managed_main_formatters.start
3137 until
3138 managed_main_formatters.after
3139 loop
3140 managed_main_formatters.item.set_stone (new_class_stone)
3141 managed_main_formatters.forth
3142 end
3143 if not is_stone_external then
3144 managed_main_formatters.i_th (2).execute
3145 end
3146 else
3147 if not changed or not same_class then
3148 --| Enable all formatters.
3149 if
3150 (not feature_stone_already_processed or
3151 not managed_main_formatters.first.selected) and
3152 feature_stone = Void
3153 then
3154 from
3155 managed_main_formatters.start
3156 until
3157 managed_main_formatters.after
3158 loop
3159 managed_main_formatters.item.set_stone (new_class_stone)
3160 managed_main_formatters.forth
3161 end
3162 end
3163 else
3164 if not feature_stone_already_processed then
3165 address_manager.disable_formatters
3166 from
3167 managed_main_formatters.start
3168 until
3169 managed_main_formatters.after
3170 loop
3171 managed_main_formatters.item.set_stone (new_class_stone)
3172 managed_main_formatters.forth
3173 end
3174 end
3175 end
3176 end
3177 end
3178 if not managed_main_formatters.first.selected then
3179 editor_tool.text_area.set_read_only (true)
3180 elseif new_class_stone /= Void and then new_class_stone.class_i.is_read_only then
3181 editor_tool.text_area.set_read_only (true)
3182 end
3183 else
3184 -- not a class text : cannot be edited
3185 editor_tool.text_area.set_read_only (True)
3186 address_manager.disable_formatters
3187
3188 --| Disable all formatters.
3189 from
3190 managed_main_formatters.start
3191 until
3192 managed_main_formatters.after
3193 loop
3194 managed_main_formatters.item.set_stone (Void)
3195 managed_main_formatters.forth
3196 end
3197 if cluster_st /= Void then
3198 properties_tool.add_stone (cluster_st)
3199 if cluster_st.is_cluster then
3200 --| FIXME XR: Really manage cluster display in the main editor
3201 if not during_synchronization then
3202 view_points_combo.set_conf_group (cluster_st.group)
3203 end
3204 formatted_context_for_cluster (cluster_st.cluster_i, cluster_st.path)
3205 if cluster_st.position > 0 then
3206 editor_tool.text_area.display_line_at_top_when_ready (cluster_st.position)
3207 end
3208 --| END FIXME
3209 end
3210 end
3211 end
3212 if class_text_exists then
3213 if feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
3214 conv_ferrst ?= feature_stone
3215 if conv_ferrst /= Void then
3216 error_line := conv_ferrst.line_number
3217 else
3218 -- if a feature_stone has been dropped
3219 -- scroll to the corresponding feature in the basic text format
3220 if not during_synchronization then
3221 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
3222 end
3223 end
3224 else
3225 cl_syntax_stone ?= a_stone
3226 if cl_syntax_stone /= Void then
3227 error_line := cl_syntax_stone.line
3228 end
3229 end
3230 if error_line > 0 then
3231 -- Scroll to the line of the error.
3232 if not during_synchronization then
3233 if not managed_main_formatters.first.selected then
3234 managed_main_formatters.first.execute
3235 check
3236 new_class_stone_not_void: new_class_stone /= Void
3237 end
3238 if new_class_stone.class_i.is_read_only then
3239 editor_tool.text_area.set_read_only (true)
3240 end
3241 end
3242 editor_tool.text_area.display_line_when_ready (error_line, True)
3243 end
3244 end
3245 end
3246 -- Update the title of the window
3247 if a_stone /= Void then
3248 if changed then
3249 str := a_stone.header.twin
3250 str.prepend ("* ")
3251 set_title (str)
3252 else
3253 set_title (a_stone.header)
3254 end
3255 else
3256 set_title (Interface_names.t_empty_development_window)
3257 end
3258
3259 -- Refresh the tools.
3260 features_tool.set_stone (a_stone)
3261 cluster_tool.set_stone (a_stone)
3262 -- Update the context tool.
3263 if unified_stone then
3264 context_tool.set_stone (a_stone)
3265 end
3266
3267 end
3268 if
3269 stone /= Void and then
3270 not unified_stone
3271 then
3272 send_stone_to_context_cmd.enable_sensitive
3273 else
3274 send_stone_to_context_cmd.disable_sensitive
3275 end
3276 if cur_wid = Void then
3277 --| Do nothing.
3278 else
3279 cur_wid.set_pointer_style (old_cur)
3280 old_cur := Void
3281 -- cur_wid.disable_capture
3282 cur_wid := Void
3283 end
3284 update_viewpoints
3285 end
3286
3287 formatted_context_for_cluster (a_cluster: CLUSTER_I; a_path: STRING) is
3288 -- Formatted context representing the list of classes inside `a_cluster'.
3289 require
3290 a_cluster_not_void: a_cluster /= Void
3291 a_path_not_void: a_path /= Void
3292 local
3293 l_assembly: ASSEMBLY_I
3294 l_sorted_cluster: EB_SORTED_CLUSTER
3295 l_classes: DS_ARRAYED_LIST [CLASS_I]
3296 l_in_classes: DS_ARRAYED_LIST [CLASS_I]
3297 l_out_classes: DS_ARRAYED_LIST [CLASS_I]
3298 l_over_classes: DS_ARRAYED_LIST [CLASS_I]
3299 l_subclu: DS_LIST [EB_SORTED_CLUSTER]
3300 l_cl_i, l_overridden_class: CLASS_I
3301 l_cluster: CLUSTER_I
3302 l_assert_level: ASSERTION_I
3303 l_format_context: TEXT_FORMATTER_DECORATOR
3304 l_description: STRING
3305 do
3306 create l_format_context.make_for_case (editor_tool.text_area.text_displayed)
3307 editor_tool.text_area.handle_before_processing (False)
3308 l_format_context.process_keyword_text (ti_indexing_keyword, Void)
3309 l_format_context.put_new_line
3310 l_format_context.indent
3311 if a_cluster.is_assembly then
3312 l_assembly ?= a_cluster
3313 check l_assembly /= Void end
3314 l_format_context.process_indexing_tag_text ("assembly_name")
3315 l_format_context.set_without_tabs
3316 l_format_context.process_symbol_text (ti_colon)
3317 l_format_context.put_space
3318 l_format_context.put_quoted_string_item (l_assembly.assembly_name)
3319 l_format_context.put_new_line
3320 l_format_context.process_indexing_tag_text ("assembly_path")
3321 l_format_context.set_without_tabs
3322 l_format_context.process_symbol_text (ti_colon)
3323 l_format_context.put_space
3324 l_format_context.put_quoted_string_item (l_assembly.location.evaluated_path)
3325 l_format_context.put_new_line
3326
3327 end
3328 l_format_context.process_indexing_tag_text ("cluster")
3329 l_format_context.set_without_tabs
3330 l_format_context.process_symbol_text (ti_colon)
3331 l_format_context.put_space
3332 l_format_context.add_group (a_cluster, a_cluster.cluster_name)
3333
3334 l_format_context.put_new_line
3335 l_format_context.process_indexing_tag_text ("cluster_path")
3336 l_format_context.set_without_tabs
3337 l_format_context.process_symbol_text (ti_colon)
3338 l_format_context.put_space
3339 l_format_context.put_quoted_string_item (a_cluster.path)
3340
3341 if a_path /= Void and then not a_path.is_empty then
3342 l_format_context.put_space
3343 l_format_context.set_without_tabs
3344 l_format_context.process_symbol_text (ti_l_parenthesis)
3345 l_format_context.put_quoted_string_item (a_path)
3346 l_format_context.set_without_tabs
3347 l_format_context.process_symbol_text (ti_r_parenthesis)
3348 end
3349 l_format_context.put_new_line
3350
3351 -- Now try to get the description of the cluster, and if not
3352 -- we take the one from its target.
3353 if a_cluster.description /= Void then
3354 l_description := a_cluster.description
3355 elseif a_cluster.target.description /= Void then
3356 l_description := a_cluster.target.description
3357 end
3358 if l_description /= Void then
3359 l_format_context.process_indexing_tag_text ("description")
3360 l_format_context.set_without_tabs
3361 l_format_context.process_symbol_text (ti_colon)
3362 l_format_context.put_space
3363 l_format_context.set_in_indexing_clause (True)
3364 l_format_context.process_symbol_text (ti_double_quote)
3365 l_format_context.process_symbol_text (ti_l_bracket)
3366 l_format_context.put_new_line
3367 if l_description.has ('%N') then
3368 -- Indenting looks strange below because
3369 -- `add_multiline_string' does not take into accounts
3370 -- how many indents already exists.
3371 l_format_context.exdent
3372 l_format_context.add_multiline_string (l_description, 3)
3373 l_format_context.indent
3374 else
3375 l_format_context.indent
3376 l_format_context.indent
3377 l_format_context.add_string (l_description)
3378 l_format_context.exdent
3379 l_format_context.exdent
3380 end
3381 l_format_context.put_new_line
3382 l_format_context.indent
3383 l_format_context.process_symbol_text (ti_r_bracket)
3384 l_format_context.process_symbol_text (ti_double_quote)
3385 l_format_context.exdent
3386 l_format_context.put_new_line
3387 end
3388
3389 if a_cluster.parent_cluster /= Void then
3390 l_format_context.process_indexing_tag_text ("parent cluster")
3391 l_format_context.set_without_tabs
3392 l_format_context.process_symbol_text (ti_colon)
3393 l_format_context.put_new_line
3394 l_format_context.indent
3395 l_format_context.put_manifest_string (" - ")
3396
3397 l_format_context.add_group (a_cluster.parent_cluster, a_cluster.parent_cluster.cluster_name)
3398 l_format_context.put_new_line
3399 l_format_context.exdent
3400 end
3401
3402 create l_sorted_cluster.make (a_cluster)
3403 l_sorted_cluster.initialize
3404
3405 if not l_sorted_cluster.clusters.is_empty then
3406 l_format_context.process_indexing_tag_text ("sub cluster(s)")
3407 l_format_context.set_without_tabs
3408 l_format_context.process_symbol_text (ti_colon)
3409 l_format_context.put_new_line
3410 l_format_context.indent
3411 from
3412 l_subclu := l_sorted_cluster.clusters
3413 l_subclu.start
3414 until
3415 l_subclu.after
3416 loop
3417 l_cluster := l_subclu.item_for_iteration.actual_cluster
3418 l_format_context.put_manifest_string (" - ")
3419 l_format_context.add_group (l_cluster, l_cluster.cluster_name)
3420 l_format_context.put_space
3421 l_format_context.set_without_tabs
3422 l_format_context.process_symbol_text (ti_L_parenthesis)
3423 l_format_context.process_comment_text (l_cluster.classes.count.out, Void)
3424 l_format_context.set_without_tabs
3425 l_format_context.process_symbol_text (ti_R_parenthesis)
3426 l_format_context.put_new_line
3427 l_subclu.forth
3428 end
3429 l_format_context.exdent
3430 end
3431
3432 if not l_sorted_cluster.classes.is_empty then
3433 l_classes := l_sorted_cluster.classes
3434 from
3435 l_classes.start
3436 create l_in_classes.make (l_classes.count)
3437 create l_out_classes.make (l_classes.count)
3438 create l_over_classes.make (l_classes.count)
3439 until
3440 l_classes.after
3441 loop
3442 l_cl_i := l_classes.item_for_iteration
3443 if
3444 a_path.is_empty
3445 or else is_string_started_by (l_cl_i.path, a_path)
3446 then
3447 if l_cl_i.compiled then
3448 l_in_classes.put_last (l_cl_i)
3449 if l_cl_i.config_class.is_overriden then
3450 l_over_classes.put_last (l_cl_i)
3451 end
3452 else
3453 l_out_classes.put_last (l_cl_i)
3454 end
3455 end
3456 l_classes.forth
3457 end
3458 l_classes := Void
3459
3460 if l_in_classes.count > 0 then
3461 l_format_context.put_new_line
3462 l_format_context.process_indexing_tag_text (l_in_classes.count.out + " compiled class(es)")
3463 l_format_context.set_without_tabs
3464 l_format_context.process_symbol_text (ti_colon)
3465 l_format_context.put_new_line
3466 l_format_context.indent
3467
3468 from
3469 l_in_classes.start
3470 until
3471 l_in_classes.after
3472 loop
3473 l_cl_i := l_in_classes.item_for_iteration
3474 check compiled: l_cl_i.compiled end
3475
3476 l_assert_level := l_cl_i.assertion_level
3477 l_format_context.put_manifest_string (" - ")
3478 l_format_context.put_classi (l_cl_i)
3479 l_format_context.set_without_tabs
3480 l_format_context.process_symbol_text (ti_colon)
3481 if l_assert_level.check_all then
3482 l_format_context.put_space
3483 l_format_context.set_without_tabs
3484 l_format_context.process_keyword_text (ti_All_keyword, Void)
3485 elseif l_assert_level.level = 0 then
3486 l_format_context.put_space
3487 l_format_context.process_comment_text (once "None", Void)
3488 else
3489 if l_assert_level.check_precond then
3490 l_format_context.put_space
3491 l_format_context.set_without_tabs
3492 l_format_context.process_keyword_text (ti_Require_keyword, Void)
3493 end
3494 if l_assert_level.check_postcond then
3495 l_format_context.put_space
3496 l_format_context.set_without_tabs
3497 l_format_context.process_keyword_text (ti_Ensure_keyword, Void)
3498 end
3499 if l_assert_level.check_check then
3500 l_format_context.put_space
3501 l_format_context.set_without_tabs
3502 l_format_context.process_keyword_text (ti_Check_keyword, Void)
3503 end
3504 if l_assert_level.check_loop then
3505 l_format_context.put_space
3506 l_format_context.set_without_tabs
3507 l_format_context.process_keyword_text (ti_Loop_keyword, Void)
3508 end
3509 if l_assert_level.check_invariant then
3510 l_format_context.put_space
3511 l_format_context.set_without_tabs
3512 l_format_context.process_keyword_text (ti_Invariant_keyword, Void)
3513 end
3514 end
3515 l_format_context.put_new_line
3516 l_in_classes.forth
3517 end
3518 l_format_context.exdent
3519 end
3520 l_in_classes := Void
3521
3522 if l_out_classes.count > 0 then
3523 l_format_context.put_new_line
3524 l_format_context.process_indexing_tag_text (l_out_classes.count.out + " class(es) not in system")
3525 l_format_context.set_without_tabs
3526 l_format_context.process_symbol_text (ti_colon)
3527 l_format_context.put_new_line
3528 l_format_context.indent
3529 from
3530 l_out_classes.start
3531 until
3532 l_out_classes.after
3533 loop
3534 l_cl_i := l_out_classes.item_for_iteration
3535 check not_in_system: not l_cl_i.compiled end
3536 l_format_context.put_manifest_string (" - ")
3537 l_format_context.put_classi (l_cl_i)
3538 l_format_context.put_new_line
3539 l_out_classes.forth
3540 end
3541 l_format_context.exdent
3542 end
3543 l_out_classes := Void
3544
3545 if
3546 l_over_classes.count > 0 and then
3547 a_cluster.overriders /= Void and then not a_cluster.overriders.is_empty
3548 then
3549 l_format_context.put_new_line
3550 l_format_context.process_indexing_tag_text ("Overriden")
3551 l_format_context.set_without_tabs
3552 l_format_context.process_symbol_text (ti_colon)
3553 l_format_context.put_new_line
3554 l_format_context.indent
3555 from
3556 l_over_classes.start
3557 until
3558 l_over_classes.after
3559 loop
3560 l_cl_i := l_over_classes.item_for_iteration
3561 check is_overriden_class: l_cl_i.config_class.is_overriden end
3562
3563 l_format_context.put_manifest_string (" - ")
3564 l_format_context.put_classi (l_cl_i)
3565 l_format_context.process_comment_text (" overriden by", Void)
3566 l_format_context.process_symbol_text (ti_colon)
3567 l_format_context.put_space
3568
3569 l_overridden_class ?= l_cl_i.config_class.overriden_by
3570 if l_overridden_class /= Void then
3571 l_format_context.put_classi (l_overridden_class)
3572 l_format_context.put_manifest_string (" in ")
3573 l_format_context.add_group (l_cl_i.config_class.overriden_by.group, l_cl_i.config_class.overriden_by.group.name)
3574 l_format_context.put_new_line
3575 end
3576 l_over_classes.forth
3577 end
3578 l_format_context.exdent
3579 l_format_context.put_new_line
3580 end
3581 l_over_classes := Void
3582 end
3583
3584 l_format_context.exdent
3585 l_format_context.put_new_line
3586 editor_tool.text_area.handle_after_processing
3587 end
3588
3589 scroll_to_feature (feat_as: E_FEATURE; displayed_class: CLASS_I) is
3590 -- highlight the feature correspnding to `feat_as' in the class represented by `displayed_class'
3591 require
3592 class_is_not_void: displayed_class /= Void
3593 feat_as_is_not_void: feat_as /= Void
3594 local
3595 begin_index, offset: INTEGER
3596 tmp_text: STRING
3597 do
3598 if not feat_as.is_il_external then
3599 if not managed_main_formatters.first.selected then
3600 if feat_as.ast /= Void then
3601 editor_tool.text_area.find_feature_named (feat_as.name)
3602 end
3603 else
3604 if feat_as.ast /= Void then
3605 begin_index := feat_as.ast.start_position
3606 tmp_text := displayed_class.text.substring (1, begin_index)
3607 offset := tmp_text.occurrences('%R')
3608 editor_tool.text_area.scroll_to_when_ready (begin_index.item - offset)
3609 end
3610 end
3611 else
3612 if not managed_main_formatters.first.selected then
3613 managed_main_formatters.first.execute
3614 end
3615 -- FIXME NC: Doesn't work properly for .NET features
3616 -- .NET formatted feature.
3617 begin_index := feature_positions.item (feat_as)
3618 if platform_constants.is_windows then
3619 tmp_text := displayed_class.text.substring (1, begin_index)
3620 offset := tmp_text.occurrences('%N')
3621 end
3622 editor_tool.text_area.scroll_to_when_ready (begin_index // 2) -- - offset)
3623 end
3624 end
3625
3626 check_passed: BOOLEAN
3627
3628 save_canceled: BOOLEAN
3629 -- did user cancel save ?
3630
3631 save_only: BOOLEAN
3632 -- skip parse and update after save ?
3633
3634 text_saved: BOOLEAN
3635 -- has the user chosen to save the file
3636
3637 is_destroying: BOOLEAN
3638 -- Is `current' being currently destroyed?
3639
3640 feature_stone_already_processed: BOOLEAN
3641 -- Is the processed stone a feature stone and has it
3642 -- been already processed by the editor ?
3643
3644 feature {NONE} -- Implementation
3645
3646 update_save_symbol is
3647 do
3648 Precursor {EB_FILEABLE}
3649 if changed then
3650 save_cmd.enable_sensitive
3651 address_manager.disable_formatters
3652 else
3653 save_cmd.disable_sensitive
3654 update_formatters
3655 end
3656 if is_empty then
3657 print_cmd.disable_sensitive
3658 save_as_cmd.disable_sensitive
3659 else
3660 print_cmd.enable_sensitive
3661 save_as_cmd.enable_sensitive
3662 end
3663 end
3664
3665 is_stone_external: BOOLEAN
3666 -- Does 'stone' contain a .NET consumed type?
3667
3668 update_formatters is
3669 -- Give a correct sensitivity to formatters.
3670 local
3671 cist: CLASSI_STONE
3672 cst: CLASSC_STONE
3673 type_changed: BOOLEAN
3674 do
3675 cst ?= stone
3676 cist ?= stone
3677 -- Check to if formatting context has changed.
3678 if cst /= Void then
3679 type_changed := (cst.e_class.is_true_external and not is_stone_external) or
3680 (not cst.e_class.is_true_external and is_stone_external)
3681 elseif cist /= Void then
3682 type_changed := (cist.class_i.is_external_class and not is_stone_external) or
3683 (not cist.class_i.is_external_class and is_stone_external)
3684 end
3685
3686 if type_changed then
3687 -- Toggle stone flag.
3688 is_stone_external := not is_stone_external
3689 end
3690
3691 if cst /= Void then
3692 address_manager.enable_formatters
3693 if is_stone_external then
3694 -- Change formatters to .NET sensitivity (from normal).
3695 enable_dotnet_formatters
3696 if type_changed then
3697 managed_main_formatters.i_th (4).enable_select
3698 end
3699 else
3700 if changed then
3701 address_manager.disable_formatters
3702 else
3703 --managed_main_formatters.first.disable_sensitive
3704 end
3705 end
3706 elseif cist /= Void and is_stone_external then
3707 -- Change formatters to .NET sensitivity (from normal).
3708 enable_dotnet_formatters
3709 if type_changed then
3710 managed_main_formatters.i_th (4).enable_select
3711 end
3712 else
3713 address_manager.disable_formatters
3714 if cist /= stone then
3715 managed_main_formatters.first.execute
3716 end
3717 end
3718 end
3719
3720 enable_dotnet_formatters is
3721 -- Enable only the .NET class text formatters.
3722 local
3723 l_formatters: like managed_main_formatters
3724 do
3725 l_formatters := managed_main_formatters.twin
3726 from
3727 l_formatters.start
3728 until
3729 l_formatters.after
3730 loop
3731 if l_formatters.item.is_dotnet_formatter then
3732 l_formatters.item.enable_sensitive
3733 else
3734 l_formatters.item.disable_sensitive
3735 end
3736 l_formatters.forth
3737 end
3738 end
3739
3740 on_text_reset is
3741 -- The main editor has just been wiped out
3742 -- before loading a new file.
3743 local
3744 str: STRING
3745 do
3746 str := title.twin
3747 if str @ 1 = '*' then
3748 str.keep_tail (str.count - 2)
3749 set_title (str)
3750 end
3751 address_manager.disable_formatters
3752 status_bar.reset
3753 status_bar.remove_cursor_position
3754 text_edited := False
3755 end
3756
3757 on_cursor_moved is
3758 -- The cursor has moved, reflect the change in the status bar.
3759 -- And reflect location editing in the text in features tool and address bar.
3760 do
3761 refresh_cursor_position
3762 if context_refreshing_timer = Void then
3763 create context_refreshing_timer.make_with_interval (100)
3764 context_refreshing_timer.actions.extend (agent refresh_context_info)
3765 end
3766 if feature_locating then
3767 context_refreshing_timer.set_interval (0)
3768 else
3769 context_refreshing_timer.set_interval (100)
3770 end
3771
3772 end
3773
3774 on_text_fully_loaded is
3775 -- The main editor has just been reloaded.
3776 do
3777 update_paste_cmd
3778 update_formatters
3779 if editor_tool.text_area.syntax_is_correct then
3780 status_bar.reset
3781 else
3782 status_bar.display_message (Interface_names.L_syntax_error)
3783 end
3784 refresh_cursor_position
3785 text_edited := False
3786 end
3787
3788 on_text_back_to_its_last_saved_state is
3789 local
3790 str: STRING
3791 do
3792 str := title.twin
3793 if str @ 1 = '*' then
3794 str.keep_tail (str.count - 2)
3795 set_title (str)
3796 end
3797 update_formatters
3798 text_edited := False
3799 end
3800
3801 text_edited: BOOLEAN
3802 -- Do we know that the text was edited?
3803 -- If so, no need to update the display each time it is edited.
3804
3805 on_text_edited (unused: BOOLEAN) is
3806 -- The text in the editor is modified, add the '*' in the title.
3807 -- Gray out the formatters.
3808 local
3809 str: STRING
3810 cst: CLASSI_STONE
3811 do
3812 if not text_edited then
3813 str := title.twin
3814 if str @ 1 /= '*' then
3815 str.prepend ("* ")
3816 set_title (str)
3817 end
3818 address_manager.disable_formatters
3819 cst ?= stone
3820 if cst /= Void then
3821 Eiffel_project.Manager.class_is_edited (cst.class_i)
3822 end
3823 text_edited := True
3824 end
3825 if not status_bar.message.is_equal (interface_names.e_c_compilation_running) then
3826 -- We don't want the "Background C compilation in progress" message flash every time
3827 -- user presses a key.
3828 status_bar.display_message ("")
3829 end
3830 end
3831
3832 on_back is
3833 -- User pressed Alt+left.
3834 -- Go back in the history (or the context history).
3835 do
3836 if context_tool_has_focus then
3837 if context_tool.history_manager.is_back_possible then
3838 context_tool.history_manager.back_command.execute
3839 end
3840 elseif history_manager.is_back_possible then
3841 history_manager.back_command.execute
3842 end
3843 end
3844
3845 on_forth is
3846 -- User pressed Alt+right.
3847 -- Go forth in the history (or the context history).
3848 do
3849 if context_tool_has_focus then
3850 if context_tool.history_manager.is_forth_possible then
3851 context_tool.history_manager.forth_command.execute
3852 end
3853 elseif history_manager.is_forth_possible then
3854 history_manager.forth_command.execute
3855 end
3856 end
3857
3858 context_tool_has_focus: BOOLEAN is
3859 -- Does the context tool or one of its children has the focus?
3860 local
3861 fw: EV_WIDGET
3862 cont: EV_CONTAINER
3863 wid: EV_WIDGET
3864 do
3865 fw := (create {EV_ENVIRONMENT}).application.focused_widget
3866 wid := context_tool.explorer_bar_item.widget
3867 if wid = fw then
3868 Result := True
3869 elseif fw = Void then
3870 Result := False
3871 else
3872 from
3873 cont := fw.parent
3874 until
3875 cont = wid or cont = Void
3876 loop
3877 cont := cont.parent
3878 end
3879 if cont = wid then
3880 Result := True
3881 end
3882 end
3883 end
3884
3885 saved_cursor: CURSOR
3886 -- Saved cursor position for displaying the stack.
3887
3888 can_drop (st: ANY): BOOLEAN is
3889 -- Can the user drop the stone `st'?
3890 local
3891 conv_ace: ACE_SYNTAX_STONE
3892 do
3893 conv_ace ?= st
3894 Result := conv_ace = Void
3895 end
3896
3897 send_stone_to_context is
3898 -- Send current stone to the context tool.
3899 -- Used by `send_stone_to_context_cmd'.
3900 do
3901 if stone /= Void then
3902 context_tool.set_stone (stone)
3903 end
3904 end
3905
3906 destroy is
3907 -- check if current text has been saved and destroy
3908 local
3909 dialog_w: EV_WARNING_DIALOG
3910 do
3911 if Window_manager.development_windows_count > 1 and then process_manager.is_external_command_running and then Current = external_output_manager.target_development_window then
3912 process_manager.confirm_external_command_termination (agent terminate_external_command_and_destroy, agent do_nothing, window)
3913 else
3914 if editor_tool /= Void and then editor_tool.text_area /= Void and then changed and then not confirmed then
3915 if Window_manager.development_windows_count > 1 then
3916 create dialog_w.make_with_text (Warning_messages.w_save_before_closing)
3917 dialog_w.set_buttons_and_actions (<<"Yes", "No", "Cancel">>, <<agent save_and_destroy, agent force_destroy, agent do_nothing>>)
3918 dialog_w.set_default_push_button (dialog_w.button("Yes"))
3919 dialog_w.set_default_cancel_button (dialog_w.button("Cancel"))
3920 dialog_w.show_modal_to_window (window)
3921 else
3922 -- We let the window manager handle the saving, along with other windows
3923 -- (not development windows)
3924 force_destroy
3925 end
3926 else
3927 Precursor {EB_TOOL_MANAGER}
3928 if context_refreshing_timer /= Void then
3929 context_refreshing_timer.destroy
3930 context_refreshing_timer := Void
3931 end
3932 end
3933 end
3934 end
3935
3936 terminate_external_command_and_destroy is
3937 -- Terminate running external command and destroy.
3938 do
3939 process_manager.terminate_external_command
3940 destroy
3941 ensure
3942 external_command_not_running: not process_manager.is_external_command_running
3943 end
3944
3945 save_and_destroy is
3946 do
3947 save_text
3948 destroy
3949 end
3950
3951 force_destroy is
3952 -- Destroy without asking.
3953 do
3954 confirmed := True
3955 destroy
3956 confirmed := False
3957 end
3958
3959 confirmed: BOOLEAN
3960 -- Did the user say he wanted to exit?
3961
3962 show_dynamic_library_dialog is
3963 -- Create a new dynamic library window and display it.
3964 do
3965 Window_manager.create_dynamic_lib_window
3966 end
3967
3968 context_refreshing_timer: EV_TIMEOUT
3969 -- Timer to refresh feature tree address bar.
3970
3971 on_viewpoint_changed is
3972 -- Switch viewpoint.
3973 local
3974 l_formatter: EB_CLASS_TEXT_FORMATTER
3975 l_line: INTEGER
3976 do
3977 l_formatter := selected_formatter
3978 if l_formatter.button.is_sensitive and then l_formatter /= managed_main_formatters.first then
3979 l_line := editor_tool.text_area.first_line_displayed
3980 l_formatter.execute
3981 editor_tool.text_area.display_line_at_top_when_ready (l_line)
3982 end
3983 end
3984
3985 selected_formatter: EB_CLASS_TEXT_FORMATTER is
3986 -- Current selected formatter
3987 local
3988 l_end : BOOLEAN
3989 l_index: INTEGER
3990 l_formatter: like managed_main_formatters
3991 do
3992 l_formatter := managed_main_formatters
3993 l_index := l_formatter.index
3994 from
3995 l_formatter.start
3996 until
3997 l_formatter.after or l_end
3998 loop
3999 if l_formatter.item.selected then
4000 l_end := true
4001 Result := l_formatter.item
4002 end
4003 l_formatter.forth
4004 end
4005 l_formatter.go_i_th (l_index)
4006 end
4007
4008 feature -- Recycle
4009
4010 recycle is
4011 -- Call the precursors.
4012 do
4013 recycle_command
4014 recycle_formatters
4015 recycle_menu
4016 Precursor {EB_TOOL_MANAGER}
4017 save_as_cmd.recycle
4018 open_cmd.recycle
4019 save_cmd.recycle
4020 save_as_cmd := Void
4021 open_cmd := Void
4022 save_cmd := Void
4023 command_controller.recycle
4024 if refactoring_manager /= Void then
4025 refactoring_manager.destroy
4026 end
4027 editor_tool := Void
4028 favorites_tool := Void
4029 properties_tool := Void
4030 history_manager := Void
4031 features_tool := Void
4032 breakpoints_tool := Void
4033 favorites_manager := Void
4034 cluster_manager := Void
4035 search_tool := Void
4036 editors.wipe_out
4037 end
4038
4039 recycle_command is
4040 -- Recycle command
4041 local
4042 os_cmd: EB_ON_SELECTION_COMMAND
4043 do
4044 c_finalized_compilation_cmd.recycle
4045 c_workbench_compilation_cmd.recycle
4046 editor_paste_cmd.recycle
4047 new_class_cmd.recycle
4048 new_cluster_cmd.recycle
4049 new_library_cmd.recycle
4050 new_assembly_cmd.recycle
4051 new_feature_cmd.recycle
4052 shell_cmd.recycle
4053 toggle_feature_alias_cmd.recycle
4054 toggle_feature_assigner_cmd.recycle
4055 toggle_feature_signature_cmd.recycle
4056 undo_cmd.recycle
4057 redo_cmd.recycle
4058 toggle_stone_cmd.recycle
4059 delete_class_cluster_cmd.recycle
4060 print_cmd.recycle
4061 from
4062 show_tool_commands.start
4063 until
4064 show_tool_commands.after
4065 loop
4066 show_tool_commands.item.recycle
4067 show_tool_commands.forth
4068 end
4069 show_tool_commands.wipe_out
4070 show_tool_commands := Void
4071
4072 from
4073 toolbarable_commands.start
4074 until
4075 toolbarable_commands.after
4076 loop
4077 os_cmd ?= toolbarable_commands.item
4078 if os_cmd /= Void then
4079 os_cmd.recycle
4080 end
4081 toolbarable_commands.forth
4082 end
4083
4084 c_finalized_compilation_cmd := Void
4085 c_finalized_compilation_cmd := Void
4086 new_class_cmd := Void
4087 new_cluster_cmd := Void
4088 new_feature_cmd := Void
4089 shell_cmd := Void
4090 toggle_feature_alias_cmd := Void
4091 toggle_feature_assigner_cmd := Void
4092 toggle_feature_signature_cmd := Void
4093 undo_cmd := Void
4094 redo_cmd := Void
4095 toggle_stone_cmd := Void
4096 delete_class_cluster_cmd := Void
4097 print_cmd := Void
4098 end
4099
4100 recycle_formatters is
4101 -- Recycle formatters
4102 do
4103 from
4104 managed_class_formatters.start
4105 until
4106 managed_class_formatters.after
4107 loop
4108 if managed_class_formatters.item /= Void then
4109 managed_class_formatters.item.recycle
4110 end
4111 managed_class_formatters.forth
4112 end
4113
4114 from
4115 managed_feature_formatters.start
4116 until
4117 managed_feature_formatters.after
4118 loop
4119 if managed_feature_formatters.item /= Void then
4120 managed_feature_formatters.item.recycle
4121 end
4122 managed_feature_formatters.forth
4123 end
4124
4125 from
4126 managed_main_formatters.start
4127 until
4128 managed_main_formatters.after
4129 loop
4130 if managed_main_formatters.item /= Void then
4131 managed_main_formatters.item.recycle
4132 end
4133 managed_main_formatters.forth
4134 end
4135 end
4136
4137 recycle_menu is
4138 --
4139 do
4140 tools_menu.destroy
4141 window_menu.destroy
4142 metric_menu.destroy
4143 -- compile_menu.destroy
4144 debug_menu.destroy
4145 debugging_tools_menu.destroy
4146 favorites_menu.destroy
4147 view_menu.destroy
4148
4149 tools_menu := Void
4150 window_menu := Void
4151 metric_menu := Void
4152 format_menu := Void
4153 compile_menu := Void
4154 debug_menu := Void
4155 debugging_tools_menu := Void
4156 favorites_menu := Void
4157 view_menu := Void
4158 end
4159
4160
4161 feature {NONE} -- Implementation: Editor commands
4162
4163 refresh_cursor_position is
4164 -- Display the current cursor position in the status bar.
4165 require
4166 text_loaded: not is_empty
4167 local
4168 l, c, v: INTEGER
4169 do
4170 l := editor_tool.text_area.cursor_y_position
4171 c := editor_tool.text_area.cursor_x_position
4172 v := editor_tool.text_area.cursor_visible_x_position
4173 status_bar.set_cursor_position (l, c, v)
4174 end
4175
4176 refresh_context_info is
4177 -- Refresh address bar and features tool to relect
4178 -- where in the code the cursor is located.
4179 local
4180 l_feature: FEATURE_AS
4181 l_classc_stone: CLASSC_STONE
4182 do
4183 context_refreshing_timer.set_interval (0)
4184 l_classc_stone ?= stone
4185 if l_classc_stone /= Void then
4186 l_feature := editor_tool.text_area.text_displayed.current_feature_containing
4187 if l_feature /= Void then
4188 set_editing_location_by_feature (l_feature)
4189 else
4190 set_editing_location_by_feature (Void)
4191 end
4192 end
4193 end
4194
4195 set_editing_location_by_feature (a_feature: FEATURE_AS) is
4196 -- Set editing location, feature tool and combo box changes according to `a_feature'.
4197 local
4198 l_efeature: E_FEATURE
4199 l_class_i: CLASS_I
4200 l_classc: CLASS_C
4201 do
4202 if a_feature /= Void then
4203 address_manager.set_feature_text_simply (a_feature.feature_names.first.internal_name)
4204 l_class_i := eiffel_universe.safe_class_named (class_name, group)
4205 if l_class_i /= Void and then l_class_i.is_compiled then
4206 l_classc := l_class_i.compiled_class
4207 if l_classc.has_feature_table then
4208 l_efeature := l_classc.feature_with_name (a_feature.feature_names.first.internal_name)
4209 if l_efeature /= Void and then l_efeature.written_in /= l_classc.class_id then
4210 l_efeature := Void
4211 end
4212 end
4213 end
4214 if l_efeature /= Void then
4215 seek_item_in_feature_tool (l_efeature)
4216 else
4217 features_tool.seek_ast_item_in_feature_tool (a_feature.feature_names.first.internal_name)
4218 end
4219 else
4220 address_manager.set_feature_text_simply (once "")
4221 seek_item_in_feature_tool (Void)
4222 end
4223 end
4224
4225 seek_item_in_feature_tool (a_feature: E_FEATURE) is
4226 -- Seek and select item contains data of `a_feature' in features tool.
4227 -- If `a_feature' is void, deselect item in features tool.
4228 do
4229 features_tool.seek_item_in_feature_tool (a_feature)
4230 end
4231
4232 select_all is
4233 -- Select the whole text in the focused editor.
4234 do
4235 current_editor.select_all
4236 end
4237
4238 search is
4239 -- Search some text in the focused editor.
4240 local
4241 cv_ced: EB_CLICKABLE_EDITOR
4242 do
4243 cv_ced ?= current_editor
4244 if cv_ced /= Void then
4245 cv_ced.search
4246 end
4247 end
4248
4249 goto is
4250 -- Display a dialog to select a line to go to in the editor.
4251 local
4252 ed: EB_EDITOR
4253 do
4254 ed ?= current_editor
4255 if ed /= Void then
4256 create goto_dialog.make (ed)
4257 goto_dialog.show_modal_to_window (Current.window)
4258 end
4259 end
4260
4261 toggle_line_number_display is
4262 -- Toggle line number display on/off in editor
4263 do
4264 preferences.editor_data.show_line_numbers_preference.set_value (not preferences.editor_data.show_line_numbers)
4265 end
4266
4267 find_next is
4268 -- Find the next occurrence of the search text.
4269 local
4270 cv_ced: EB_CLICKABLE_EDITOR
4271 do
4272 if search_tool.currently_searched /= Void then
4273 cv_ced ?= current_editor
4274 if cv_ced /= Void then
4275 cv_ced.find_next
4276 end
4277 else
4278 search_tool.show_and_set_focus
4279 end
4280 end
4281
4282 find_previous is
4283 -- Find the previous occurrence of the search text.
4284 local
4285 cv_ced: EB_CLICKABLE_EDITOR
4286 do
4287 if search_tool.currently_searched /= Void then
4288 cv_ced ?= current_editor
4289 if cv_ced /= Void then
4290 cv_ced.find_previous
4291 end
4292 else
4293 search_tool.show_and_set_focus
4294 end
4295 end
4296
4297 find_selection is
4298 -- Find the next occurrence of the selection.
4299 local
4300 cv_ced: EB_CLICKABLE_EDITOR
4301 do
4302 cv_ced ?= current_editor
4303 if cv_ced /= Void then
4304 cv_ced.find_selection
4305 end
4306 end
4307
4308 cut_selection is
4309 -- Cut the selection in the current editor.
4310 do
4311 current_editor.cut_selection
4312 end
4313
4314 copy_selection is
4315 -- Cut the selection in the current editor.
4316 do
4317 current_editor.copy_selection
4318 end
4319
4320 toggle_formatting_marks is
4321 -- Show/Hide formatting marks in the editor and update related menu item.
4322 do
4323 current_editor.toggle_view_invisible_symbols
4324 if current_editor.view_invisible_symbols then
4325 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
4326 else
4327 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
4328 end
4329 end
4330
4331 feature {NONE} -- Implementation / Menus
4332
4333 number_of_displayed_external_commands: INTEGER
4334 -- Number of external commands in the tools menu.
4335
4336 old_cur: EV_POINTER_STYLE
4337 -- Cursor saved while displaying the hourglass cursor.
4338
4339 cur_wid: EV_WIDGET
4340 -- Widget on which the hourglass cursor was set.
4341
4342 project_menu: EV_MENU
4343 -- Menu for entries relative to the Project.
4344
4345 recent_projects_menu: EB_RECENT_PROJECTS_MANAGER_MENU
4346 -- SubMenu for recent projects.
4347
4348 during_synchronization: BOOLEAN
4349 -- Are we during a resynchronization?
4350
4351 formatting_marks_command_menu_item: EB_COMMAND_MENU_ITEM
4352 -- Menu item used to shw/hide formatting marks.
4353
4354 undo_accelerator: EV_ACCELERATOR
4355 -- Accelerator for Ctrl+Z
4356
4357 redo_accelerator: EV_ACCELERATOR
4358 -- Accelerator for Ctrl+Y
4359
4360 feature {EB_TOOL} -- Implementation / Commands
4361
4362 shell_cmd: EB_OPEN_SHELL_COMMAND
4363 -- Command to use an external editor.
4364
4365 undo_cmd: EB_UNDO_COMMAND
4366 -- Command to undo in the editor.
4367
4368 redo_cmd: EB_REDO_COMMAND
4369 -- Command to redo in the editor.
4370
4371 editor_paste_cmd: EB_EDITOR_PASTE_COMMAND
4372 -- Command to paste text in the editor.
4373
4374 melt_cmd: EB_MELT_PROJECT_COMMAND
4375 -- Command to start compilation.
4376
4377 feature{EB_TOOL, EB_C_COMPILER_LAUNCHER}
4378
4379 c_workbench_compilation_cmd: EB_C_COMPILATION_COMMAND
4380 -- Command to compile the workbench C code.
4381
4382 c_finalized_compilation_cmd: EB_C_COMPILATION_COMMAND
4383 -- Command to compile the finalized C code.
4384
4385 feature{EB_TOOL}
4386
4387 new_cluster_cmd: EB_NEW_CLUSTER_COMMAND
4388 -- Command to create a new cluster.
4389
4390 new_library_cmd: EB_NEW_LIBRARY_COMMAND
4391 -- Command to create a new library.
4392
4393 new_assembly_cmd: EB_NEW_ASSEMBLY_COMMAND
4394 -- Command to create a new assembly.
4395
4396 new_class_cmd: EB_NEW_CLASS_COMMAND
4397 -- Command to create a new class.
4398
4399 new_feature_cmd: EB_NEW_FEATURE_COMMAND
4400 -- Command to execute the feature wizard.
4401
4402 toggle_feature_alias_cmd: EB_TOGGLE_FEATURE_ALIAS_COMMAND
4403 -- Show/Hide alias name of feature node in eb_feature_tool
4404
4405 toggle_feature_signature_cmd: EB_TOGGLE_FEATURE_SIGNATURE_COMMAND
4406 -- Show/Hide signature of feature node in eb_feature_tool
4407
4408 toggle_feature_assigner_cmd: EB_TOGGLE_FEATURE_ASSIGNER_COMMAND
4409 -- Show/Hide assigner name of feature node in eb_feature_tool
4410
4411 toggle_stone_cmd: EB_UNIFY_STONE_CMD
4412 -- Command to toggle between the stone management modes.
4413
4414 delete_class_cluster_cmd: EB_DELETE_CLASS_CLUSTER_COMMAND
4415 -- Command to remove a class or a cluster from the system
4416 -- (permanent deletion).
4417
4418 show_profiler: EB_SHOW_PROFILE_TOOL
4419 -- What allows us to display the profiler window.
4420
4421 toolbarable_commands: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
4422 -- All commands that can be put in a toolbar.
4423
4424 command_controller: EB_EDITOR_COMMAND_CONTROLLER
4425 -- Object that takes care of updating the sensitivity of all editor commands.
4426
4427 save_as_cmd: EB_SAVE_FILE_AS_COMMAND
4428 -- Command to save a class with a different file name.
4429
4430 feature{EB_TOOL, EB_EXTERNAL_OUTPUT_TOOL}
4431
4432 Edit_external_commands_cmd: EB_EXTERNAL_COMMANDS_EDITOR is
4433 -- Command that lets the user add new external commands to the tools menu.
4434 once
4435 create Result.make
4436 Result.enable_sensitive
4437 end
4438
4439 feature{EB_TOOL}
4440
4441 system_info_cmd: EB_STANDARD_CMD is
4442 -- Command to display information about the system (root class,...)
4443 do
4444 Result := Eb_debugger_manager.system_info_cmd
4445 end
4446
4447 display_error_help_cmd: EB_ERROR_INFORMATION_CMD is
4448 -- Command to pop up a dialog giving help on compilation errors.
4449 do
4450 Result := Eb_debugger_manager.display_error_help_cmd
4451 end
4452
4453 send_stone_to_context_cmd: EB_STANDARD_CMD
4454 -- Command to send the current stone to the context tool.
4455
4456 print_cmd: EB_PRINT_COMMAND
4457 -- Command to print the content of editor with focus
4458
4459 eac_browser_cmd: EB_OPEN_EAC_BROWSER_CMD is
4460 -- Command to display the eac browser
4461 do
4462 Result := Eb_debugger_manager.eac_browser_cmd
4463 end
4464
4465 show_favorites_menu_item: EV_MENU_ITEM
4466 -- Show/Hide favorites menu item.
4467
4468 update_show_favorites_menu_item is
4469 -- Update `show_favorites_menu_item' menu label.
4470 do
4471 if favorites_tool.shown then
4472 show_favorites_menu_item.set_text (Interface_names.m_hide_favorites)
4473 else
4474 show_favorites_menu_item.set_text (Interface_names.m_show_favorites)
4475 end
4476 end
4477
4478 execute_show_favorites is
4479 -- Show `favorites_tool' if it is closed, close
4480 -- it in the opposite case.
4481 do
4482 update_show_favorites_menu_item
4483 if favorites_tool.shown then
4484 favorites_tool.close
4485 else
4486 favorites_tool.show
4487 end
4488 end
4489
4490 feature {EB_TOOL_WINDOW, EB_EXPLORER_BAR, EB_DEBUGGER_MANAGER} -- Floating tool handling
4491
4492 all_tool_windows: ARRAYED_LIST [EB_TOOL_WINDOW]
4493 -- All tool windows under the control of `Current'.
4494
4495 add_tool_window (a_tool_window: EB_TOOL_WINDOW) is
4496 -- Add `a_tool_window' to `all_tool_windows', ensuring it is
4497 -- then under the control of `Current'.
4498 require
4499 a_tool_window_not_void: a_tool_window /= Void
4500 do
4501 if all_tool_windows = Void then
4502 create all_tool_windows.make (2)
4503 end
4504 all_tool_windows.extend (a_tool_window)
4505 ensure
4506 extended: all_tool_windows.has (a_tool_window)
4507 end
4508
4509 remove_tool_window (a_widget: EV_WIDGET) is
4510 -- Remove tool window associate with `a_widget'.
4511 require
4512 a_widget_not_void: a_widget /= Void
4513 do
4514 if all_tool_windows /= Void then
4515 from
4516 all_tool_windows.start
4517 until
4518 all_tool_windows.off
4519 loop
4520 if all_tool_windows.item.tool = a_widget then
4521 all_tool_windows.remove
4522 all_tool_windows.finish
4523 end
4524 all_tool_windows.forth
4525 end
4526 end
4527 end
4528
4529 remove_all_tool_windows is
4530 -- Ensure `all_tool_windows' is empty if non Void.
4531 do
4532 if all_tool_windows /= Void then
4533 all_tool_windows.wipe_out
4534 end
4535 ensure
4536 tool_windows_empty: all_tool_windows /= Void implies all_tool_windows.is_empty
4537 end
4538
4539 window_moved (x_pos, y_pos: INTEGER) is
4540 -- `Current' has been moved, so move all associated tool windows within `all_tool_windows'.
4541 local
4542 tool_window: EB_TOOL_WINDOW
4543 do
4544 if all_tool_windows /= Void then
4545 from
4546 all_tool_windows.start
4547 until
4548 all_tool_windows.off
4549 loop
4550 tool_window := all_tool_windows.item
4551 check
4552 not_destroyed: not tool_window.window.is_destroyed
4553 end
4554 if preferences.development_window_data.dock_tracking then
4555 tool_window.window.move_actions.block
4556 tool_window.window.set_x_position (x_pos + tool_window.x_position)
4557 tool_window.window.set_y_position (y_pos + tool_window.y_position)
4558 tool_window.window.move_actions.resume
4559 else
4560 -- If we are not performing dock tracking, we must update the relative position
4561 -- of the tool window, so that if dock tracking is enabled, the relative
4562 -- positions are correct.
4563 tool_window.set_x_position ( tool_window.window.screen_x - x_pos)
4564 tool_window.set_y_position ( tool_window.window.screen_y - y_pos)
4565 end
4566 all_tool_windows.forth
4567 end
4568 end
4569 end
4570
4571 feature {NONE} -- Execution
4572
4573 toolbar_right_click_action (a_x, a_y, a_button: INTEGER; a_x_tilt, a_y_tilt, a_pressure: DOUBLE; a_screen_x, a_screen_y: INTEGER) is
4574 -- Action called when the user right-click in the toolbar.
4575 -- Display a popup menu to show/hide toolbars and customize the general toolbar.
4576 local
4577 popup_menu: EV_MENU
4578 do
4579 if a_button = 3 then
4580 popup_menu := build_toolbar_menu
4581 popup_menu.show
4582 end
4583 end
4584
4585 enable_commands_on_project_created is
4586 -- Enable commands when a new project has been created (not yet compiled)
4587 do
4588 system_info_cmd.enable_sensitive
4589 if
4590 stone /= Void and then
4591 not unified_stone
4592 then
4593 send_stone_to_context_cmd.enable_sensitive
4594 end
4595 end
4596
4597 enable_commands_on_project_loaded is
4598 -- Enable commands when a new project has been created and compiled
4599 do
4600 if has_profiler then
4601 show_profiler.enable_sensitive
4602 end
4603 if has_dll_generation then
4604 show_dynamic_lib_tool.enable_sensitive
4605 end
4606 open_cmd.enable_sensitive
4607 new_class_cmd.enable_sensitive
4608 new_cluster_cmd.enable_sensitive
4609 new_library_cmd.enable_sensitive
4610 new_assembly_cmd.enable_sensitive
4611 system_info_cmd.enable_sensitive
4612 if unified_stone then
4613 send_stone_to_context_cmd.disable_sensitive
4614 elseif stone /= Void then
4615 send_stone_to_context_cmd.enable_sensitive
4616 end
4617 new_class_cmd.enable_sensitive
4618 new_cluster_cmd.enable_sensitive
4619 delete_class_cluster_cmd.enable_sensitive
4620 c_workbench_compilation_cmd.enable_sensitive
4621 c_finalized_compilation_cmd.enable_sensitive
4622 refactoring_manager.enable_sensitive
4623 end
4624
4625 disable_commands_on_project_unloaded is
4626 -- Enable commands when a project has been closed.
4627 do
4628 if has_dll_generation then
4629 show_dynamic_lib_tool.disable_sensitive
4630 end
4631 if has_profiler then
4632 show_profiler.disable_sensitive
4633 end
4634 open_cmd.disable_sensitive
4635 new_class_cmd.disable_sensitive
4636 new_cluster_cmd.disable_sensitive
4637 new_library_cmd.disable_sensitive
4638 new_assembly_cmd.disable_sensitive
4639 if not project_manager.is_created then
4640 system_info_cmd.disable_sensitive
4641 send_stone_to_context_cmd.disable_sensitive
4642 end
4643 delete_class_cluster_cmd.disable_sensitive
4644 c_workbench_compilation_cmd.disable_sensitive
4645 c_finalized_compilation_cmd.disable_sensitive
4646 refactoring_manager.disable_sensitive
4647 refactoring_manager.forget_undo_redo
4648 end
4649
4650 feature {NONE} -- Access
4651
4652 development_window_data: EB_DEVELOPMENT_WINDOW_DATA is
4653 -- Meta data describing `Current'.
4654 do
4655 if internal_development_window_data /= Void then
4656 Result := internal_development_window_data
4657 else
4658 Result := preferences.development_window_data
4659 end
4660 end
4661
4662 internal_development_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA;
4663 -- Internal custom meta data for `Current'.
4664
4665 feature {NONE} -- Implementation
4666
4667 is_string_started_by (s1, s2: STRING_GENERAL): BOOLEAN is
4668 -- Is `s1' starting by `s2' characters
4669 require
4670 s2_not_void: s2 /= Void
4671 local
4672 i: INTEGER
4673 do
4674 if s1 /= Void and then s1.count >= s2.count then
4675 from
4676 i := 1
4677 Result := True
4678 until
4679 i > s2.count or not Result
4680 loop
4681 Result := s1.code (i) = s2.code (i)
4682 i := i + 1
4683 end
4684 end
4685 end
4686
4687 indexing
4688 copyright: "Copyright (c) 1984-2006, Eiffel Software"
4689 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
4690 licensing_options: "http://www.eiffel.com/licensing"
4691 copying: "[
4692 This file is part of Eiffel Software's Eiffel Development Environment.
4693
4694 Eiffel Software's Eiffel Development Environment is free
4695 software; you can redistribute it and/or modify it under
4696 the terms of the GNU General Public License as published
4697 by the Free Software Foundation, version 2 of the License
4698 (available at the URL listed under "license" above).
4699
4700 Eiffel Software's Eiffel Development Environment is
4701 distributed in the hope that it will be useful, but
4702 WITHOUT ANY WARRANTY; without even the implied warranty
4703 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4704 See the GNU General Public License for more details.
4705
4706 You should have received a copy of the GNU General Public
4707 License along with Eiffel Software's Eiffel Development
4708 Environment; if not, write to the Free Software Foundation,
4709 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
4710 ]"
4711 source: "[
4712 Eiffel Software
4713 356 Storke Road, Goleta, CA 93117 USA
4714 Telephone 805-685-1006, Fax 805-685-6869
4715 Website http://www.eiffel.com
4716 Customer support http://support.eiffel.com
4717 ]"
4718
4719 end -- class EB_DEVELOPMENT_WINDOW

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23