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