/[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 61334 - (show annotations)
Fri Jul 14 05:09:22 2006 UTC (13 years, 7 months ago) by manus
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 140571 byte(s)
Implemented suggestion of bug#10601.

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