/[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 61404 - (show annotations)
Tue Jul 18 15:41:02 2006 UTC (13 years, 7 months ago) by patrickr
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 140410 byte(s)
Clear description box of property grid if item is deselected, fixes bug#10672
removed quick melt command and changed melt command to use quick melt
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 -- Freeze
1744 command_menu_item := Freeze_project_cmd.new_menu_item
1745 add_recyclable (command_menu_item)
1746 project_menu.extend (command_menu_item)
1747
1748 -- Finalize
1749 command_menu_item := Finalize_project_cmd.new_menu_item
1750 add_recyclable (command_menu_item)
1751 project_menu.extend (command_menu_item)
1752
1753 -- Precompile
1754 command_menu_item := precompilation_cmd.new_menu_item
1755 add_recyclable (command_menu_item)
1756 project_menu.extend (command_menu_item)
1757
1758 -- Cancel
1759 command_menu_item := project_cancel_cmd.new_menu_item
1760 add_recyclable (command_menu_item)
1761 project_menu.extend (command_menu_item)
1762
1763 -- Separator -------------------------------------------------
1764 project_menu.extend (create {EV_MENU_SEPARATOR})
1765
1766 -- Compile Workbench C code
1767 command_menu_item := c_workbench_compilation_cmd.new_menu_item
1768 add_recyclable (command_menu_item)
1769 project_menu.extend (command_menu_item)
1770
1771 -- Compile Finalized C code
1772 command_menu_item := c_finalized_compilation_cmd.new_menu_item
1773 add_recyclable (command_menu_item)
1774 project_menu.extend (command_menu_item)
1775
1776 -- Jason Wei
1777 -- Terminate C compilation
1778 command_menu_item := Terminate_c_compilation_cmd.new_menu_item
1779 add_recyclable (command_menu_item)
1780 project_menu.extend (command_menu_item)
1781 -- Jason Wei
1782
1783 -- Execute Finalized code
1784 command_menu_item := run_finalized_cmd.new_menu_item
1785 add_recyclable (command_menu_item)
1786 project_menu.extend (command_menu_item)
1787
1788 -- Separator -------------------------------------------------
1789 project_menu.extend (create {EV_MENU_SEPARATOR})
1790
1791 -- System Tool window
1792 command_menu_item := system_cmd.new_menu_item
1793 add_recyclable (command_menu_item)
1794 project_menu.extend (command_menu_item)
1795
1796 -- System information
1797 command_menu_item := system_info_cmd.new_menu_item
1798 add_recyclable (command_menu_item)
1799 project_menu.extend (command_menu_item)
1800
1801 -- Error information
1802 command_menu_item := display_error_help_cmd.new_menu_item
1803 add_recyclable (command_menu_item)
1804 project_menu.extend (command_menu_item)
1805
1806 if has_documentation_generation or has_xmi_generation then
1807 -- Separator -------------------------------------------------
1808 project_menu.extend (create {EV_MENU_SEPARATOR})
1809 end
1810
1811 if has_documentation_generation then
1812 -- Generate Documentation
1813 command_menu_item := document_cmd.new_menu_item
1814 add_recyclable (command_menu_item)
1815 project_menu.extend (command_menu_item)
1816 end
1817
1818 if has_xmi_generation then
1819 -- Export XMI
1820 command_menu_item := export_cmd.new_menu_item
1821 add_recyclable (command_menu_item)
1822 project_menu.extend (command_menu_item)
1823 end
1824 end
1825
1826 ------- This is the original version
1827 -- build_project_menu is
1828 -- -- Build the project menu.
1829 -- local
1830 -- command_menu_item: EB_COMMAND_MENU_ITEM
1831 -- do
1832 -- create project_menu.make_with_text (Interface_names.m_project)
1833 --
1834 -- -- Melt
1835 -- command_menu_item := Melt_project_cmd.new_menu_item
1836 -- add_recyclable (command_menu_item)
1837 -- project_menu.extend (command_menu_item)
1838 --
1839 -- -- Quick melt
1840 -- command_menu_item := Quick_melt_project_cmd.new_menu_item
1841 -- add_recyclable (command_menu_item)
1842 -- project_menu.extend (command_menu_item)
1843 --
1844 -- -- Freeze
1845 -- command_menu_item := Freeze_project_cmd.new_menu_item
1846 -- add_recyclable (command_menu_item)
1847 -- project_menu.extend (command_menu_item)
1848 --
1849 -- -- Finalize
1850 -- command_menu_item := Finalize_project_cmd.new_menu_item
1851 -- add_recyclable (command_menu_item)
1852 -- project_menu.extend (command_menu_item)
1853 --
1854 -- -- Precompile
1855 -- command_menu_item := precompilation_cmd.new_menu_item
1856 -- add_recyclable (command_menu_item)
1857 -- project_menu.extend (command_menu_item)
1858 --
1859 -- -- Separator -------------------------------------------------
1860 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1861 --
1862 -- -- Compile Workbench C code
1863 -- command_menu_item := c_workbench_compilation_cmd.new_menu_item
1864 -- add_recyclable (command_menu_item)
1865 -- project_menu.extend (command_menu_item)
1866 --
1867 -- -- Compile Finalized C code
1868 -- command_menu_item := c_finalized_compilation_cmd.new_menu_item
1869 -- add_recyclable (command_menu_item)
1870 -- project_menu.extend (command_menu_item)
1871 --
1872 -- -- Execute Finalized code
1873 -- command_menu_item := run_finalized_cmd.new_menu_item
1874 -- add_recyclable (command_menu_item)
1875 -- project_menu.extend (command_menu_item)
1876 --
1877 -- -- Separator -------------------------------------------------
1878 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1879 --
1880 -- -- System Tool window
1881 -- command_menu_item := system_cmd.new_menu_item
1882 -- add_recyclable (command_menu_item)
1883 -- project_menu.extend (command_menu_item)
1884 --
1885 -- -- System information
1886 -- command_menu_item := system_info_cmd.new_menu_item
1887 -- add_recyclable (command_menu_item)
1888 -- project_menu.extend (command_menu_item)
1889 --
1890 -- -- Error information
1891 -- command_menu_item := display_error_help_cmd.new_menu_item
1892 -- add_recyclable (command_menu_item)
1893 -- project_menu.extend (command_menu_item)
1894 --
1895 -- if has_documentation_generation or has_xmi_generation then
1896 -- -- Separator -------------------------------------------------
1897 -- project_menu.extend (create {EV_MENU_SEPARATOR})
1898 -- end
1899 --
1900 -- if has_documentation_generation then
1901 -- -- Generate Documentation
1902 -- command_menu_item := document_cmd.new_menu_item
1903 -- add_recyclable (command_menu_item)
1904 -- project_menu.extend (command_menu_item)
1905 -- end
1906 --
1907 -- if has_xmi_generation then
1908 -- -- Export XMI
1909 -- command_menu_item := export_cmd.new_menu_item
1910 -- add_recyclable (command_menu_item)
1911 -- project_menu.extend (command_menu_item)
1912 -- end
1913 -- end
1914 -- Jason Wei modified the above on Aug 31 2005
1915
1916 build_tools_menu is
1917 -- Create and build `tools_menu'
1918 local
1919 command_menu_item: EB_COMMAND_MENU_ITEM
1920 menu_item: EV_MENU_ITEM
1921 do
1922 create tools_menu.make_with_text (Interface_names.m_tools)
1923
1924 -- New Cluster command.
1925 command_menu_item := new_cluster_cmd.new_menu_item
1926 add_recyclable (command_menu_item)
1927 tools_menu.extend (command_menu_item)
1928
1929 -- New Library command.
1930 command_menu_item := new_library_cmd.new_menu_item
1931 add_recyclable (command_menu_item)
1932 tools_menu.extend (command_menu_item)
1933
1934 -- New Assembly command.
1935 command_menu_item := new_assembly_cmd.new_menu_item
1936 add_recyclable (command_menu_item)
1937 tools_menu.extend (command_menu_item)
1938
1939 -- New Class command.
1940 command_menu_item := new_class_cmd.new_menu_item
1941 add_recyclable (command_menu_item)
1942 tools_menu.extend (command_menu_item)
1943
1944 -- New Feature command.
1945 command_menu_item := new_feature_cmd.new_menu_item
1946 add_recyclable (command_menu_item)
1947 tools_menu.extend (command_menu_item)
1948
1949 -- Delete class/cluster command.
1950 command_menu_item := delete_class_cluster_cmd.new_menu_item
1951 add_recyclable (command_menu_item)
1952 tools_menu.extend (command_menu_item)
1953
1954 -- Separator --------------------------------------
1955 tools_menu.extend (create {EV_MENU_SEPARATOR})
1956
1957
1958 if has_metrics then
1959 -- Metric tool
1960 create metric_menu.make_with_text (interface_names.metric_metrics)
1961 create menu_item.make_with_text (interface_names.metric_calculate)
1962 metric_menu.extend (menu_item)
1963 create menu_item.make_with_text (interface_names.metric_add)
1964 metric_menu.extend (menu_item)
1965 create menu_item.make_with_text (interface_names.metric_delete)
1966 metric_menu.extend (menu_item)
1967 create menu_item.make_with_text (interface_names.metric_details)
1968 metric_menu.extend (menu_item)
1969 create menu_item.make_with_text (interface_names.metric_new_metrics)
1970 metric_menu.extend (menu_item)
1971 create menu_item.make_with_text (interface_names.metric_management)
1972 metric_menu.extend (menu_item)
1973 create menu_item.make_with_text (interface_names.metric_archive)
1974 metric_menu.extend (menu_item)
1975 metric_menu.disable_sensitive
1976 tools_menu.extend (metric_menu)
1977 end
1978
1979 if has_profiler then
1980 -- Profiler Window
1981 command_menu_item := show_profiler.new_menu_item
1982 add_recyclable (command_menu_item)
1983 tools_menu.extend (command_menu_item)
1984 end
1985
1986 -- Precompile Wizard
1987 command_menu_item := wizard_precompile_cmd.new_menu_item
1988 add_recyclable (command_menu_item)
1989 tools_menu.extend (command_menu_item)
1990
1991 if has_dll_generation then
1992 -- Dynamic Library Window
1993 command_menu_item := show_dynamic_lib_tool.new_menu_item
1994 add_recyclable (command_menu_item)
1995 tools_menu.extend (command_menu_item)
1996 end
1997
1998 -- Separator -------------------------------------------------
1999 tools_menu.extend (create {EV_MENU_SEPARATOR})
2000
2001 -- Preferences
2002 command_menu_item := Show_preferences_cmd.new_menu_item
2003 add_recyclable (command_menu_item)
2004 tools_menu.extend (command_menu_item)
2005
2006 -- External commands editor
2007 command_menu_item := Edit_external_commands_cmd.new_menu_item
2008 add_recyclable (command_menu_item)
2009 tools_menu.extend (command_menu_item)
2010
2011 rebuild_tools_menu
2012 end
2013
2014 feature -- Stone process
2015
2016 stone: STONE
2017 -- Current stone
2018
2019 toggle_unified_stone is
2020 -- Change the stone management mode.
2021 do
2022 unified_stone := not unified_stone
2023 if unified_stone then
2024 send_stone_to_context
2025 send_stone_to_context_cmd.disable_sensitive
2026 context_tool.link_to_development_window
2027 else
2028 if stone /= Void then
2029 send_stone_to_context_cmd.enable_sensitive
2030 end
2031 context_tool.cut_from_development_window
2032 end
2033 end
2034
2035 set_stone (a_stone: STONE) is
2036 -- Change the currently focused stone.
2037 local
2038 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
2039 cv_cst: CLASSI_STONE
2040 ef_stone: EXTERNAL_FILE_STONE
2041 l: LIST [EB_DEVELOPMENT_WINDOW]
2042 l_filename: STRING
2043 do
2044 cv_cst ?= a_stone
2045 if cv_cst /= Void then
2046 l_filename := cv_cst.class_i.name
2047 else
2048 ef_stone ?= a_stone
2049 if ef_stone /= Void then
2050 l_filename := ef_stone.file_name.string
2051 end
2052 end
2053
2054 if cv_cst /= Void or ef_stone /= Void then
2055 l := Window_manager.development_windows_with_class (l_filename)
2056 if l.is_empty or else l.has (Current) then
2057 -- We're not editing the class in another window.
2058 set_stone_after_first_check (a_stone)
2059 else
2060 create cd.make_initialized (2,
2061 preferences.dialog_data.already_editing_class_string,
2062 warning_messages.w_class_already_edited,
2063 Interface_names.l_do_not_show_again,
2064 preferences.preferences)
2065 cd.set_ok_action (agent set_stone_after_first_check (a_stone))
2066 cd.show_modal_to_window (window)
2067 end
2068 else
2069 set_stone_after_first_check (a_stone)
2070 end
2071 end
2072
2073 set_stone_after_first_check (a_stone: STONE) is
2074 -- Display text associated with `a_stone', if any and if possible
2075 local
2076 feature_stone: FEATURE_STONE
2077 old_class_stone: CLASSI_STONE
2078 test_stone: CLASSI_STONE
2079 same_class: BOOLEAN
2080 conv_ferrst: FEATURE_ERROR_STONE
2081 ef_stone: EXTERNAL_FILE_STONE
2082 cluster_st: CLUSTER_STONE
2083 new_class_stone: CLASSI_STONE
2084 conv_errst: ERROR_STONE
2085 conv_brkstone: BREAKABLE_STONE
2086 do
2087 old_class_stone ?= stone
2088 feature_stone ?= a_stone
2089 ef_stone ?= a_stone
2090 new_class_stone ?= a_stone
2091 cluster_st ?= a_stone
2092
2093 -- Update the history.
2094 conv_brkstone ?= a_stone
2095 conv_errst ?= a_stone
2096 if
2097 conv_brkstone = Void and
2098 conv_errst = Void and
2099 ef_stone = Void
2100 then
2101 if
2102 new_class_stone /= Void
2103 then
2104 history_manager.extend (new_class_stone)
2105 elseif
2106 cluster_st /= Void
2107 then
2108 history_manager.extend (cluster_st)
2109 end
2110 end
2111
2112 if old_class_stone /= Void then
2113 create test_stone.make (old_class_stone.class_i)
2114 same_class := test_stone.same_as (a_stone)
2115 -- We need to compare classes. If `old_class_stone' is a FEATURE_STONE
2116 -- `same_as' will compare features. Therefore, we need `test_stone' to be sure
2117 -- we have a CLASSI_STONE.
2118 if same_class and then feature_stone /= Void then
2119 same_class := False
2120 -- if the stone corresponding to a feature of currently opened class is dropped
2121 -- we attempt to scroll to the feature without asking to save the file
2122 -- except if it is during a resynchronization, in which case we do not scroll at all.
2123 if editor_tool.text_area.text_is_fully_loaded then
2124 if not during_synchronization then
2125 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
2126 feature_stone_already_processed := True
2127 else
2128 feature_stone_already_processed := True
2129 end
2130 conv_ferrst ?= feature_stone
2131 if feature_stone_already_processed and conv_ferrst /= Void then
2132 -- Scroll to the line of the error.
2133 if not during_synchronization then
2134 editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
2135 end
2136 end
2137 end
2138 end
2139 elseif ef_stone /= Void then
2140 end
2141
2142 -- first, let's check if there is already something in this window
2143 -- if there's nothing, there's no need to save anything...
2144 if stone = Void or else not changed or else feature_stone_already_processed or else same_class then
2145 set_stone_after_check (a_stone)
2146 feature_stone_already_processed := False
2147 else
2148 -- there is something to be saved
2149 -- if user chooses to save, current file will be parsed
2150 -- if there is a syntax_error, new file is not loaded
2151 save_and (agent set_stone_after_check (a_stone))
2152 if text_saved and then not syntax_is_correct then
2153 text_saved := False
2154 during_synchronization := True
2155 set_stone_after_check (stone)
2156 during_synchronization := False
2157 address_manager.refresh
2158 end
2159 end
2160 if not editor_tool.text_area.has_focus then
2161 ev_application.idle_actions.extend_kamikaze (agent editor_tool.set_focus)
2162 end
2163 end
2164
2165 force_stone (s: STONE) is
2166 -- make `s' the new value of `stone', and
2167 -- change the display accordingly. Try to
2168 -- extract a class from `s' whenever possible.
2169 do
2170 if s.is_storable then
2171 set_stone (s)
2172 if not unified_stone then
2173 context_tool.advanced_set_stone (s)
2174 end
2175 end
2176 end
2177
2178 process_class (s: CLASSI_STONE) is
2179 -- Process class stone
2180 do
2181 set_stone (s)
2182 end
2183
2184 process_feature_error (s: FEATURE_ERROR_STONE) is
2185 -- Process feature error stone.
2186 local
2187 cl_stone: CLASSC_STONE
2188 e_class: CLASS_C
2189 do
2190 set_default_format
2191 e_class := s.e_feature.written_class
2192 create cl_stone.make (e_class)
2193 set_stone (cl_stone)
2194 editor_tool.text_area.deselect_all
2195 if s.line_number > 0 then
2196 editor_tool.text_area.highlight_selected (s.line_number, s.line_number)
2197 end
2198 end
2199
2200
2201 process_class_syntax (s: CL_SYNTAX_STONE) is
2202 -- Process class syntax.
2203 local
2204 cl_stone: CLASSC_STONE
2205 do
2206 -- call set_stone to ensure the proper class is displayed
2207 create cl_stone.make (s.e_class)
2208 set_stone (cl_stone)
2209 editor_tool.text_area.deselect_all
2210 editor_tool.text_area.highlight_when_ready (s.line, s.line)
2211 end
2212
2213 refresh is
2214 -- Synchronize clickable elements with text, if possible.
2215 do
2216 --| FIXME ARNAUD
2217 -- synchronise_stone
2218 --| END FIXME
2219 --| FIXME XR: Refresh current display in the editor.
2220 editor_tool.text_area.update_click_list (False)
2221 update_save_symbol
2222 address_manager.refresh
2223 -- The cluster manager should already be refreshed by the window manager.
2224 -- cluster_manager.refresh
2225 -- context_tool.refresh
2226 end
2227
2228 quick_refresh_editors is
2229 -- Redraw editors' drawing area.
2230 do
2231 editor_tool.text_area.refresh
2232 context_tool.quick_refresh_editors
2233 end
2234
2235 quick_refresh_margins is
2236 -- Redraw the main editor's drawing area.
2237 do
2238 editor_tool.text_area.margin.refresh
2239 context_tool.quick_refresh_margins
2240 end
2241
2242 set_default_format is
2243 -- Default format of windows.
2244 --| FIXME ARNAUD: To be implemented.
2245 -- local
2246 -- f: EB_FORMATTER
2247 do
2248 -- if stone /= Void then
2249 -- if stone.class_i.hide_implementation then
2250 -- f := format_list.precompiled_default_format
2251 -- else
2252 -- f := format_list.default_format
2253 -- end
2254 -- else
2255 -- f := format_list.default_format
2256 -- end
2257 -- set_last_format (f)
2258 --| END FIXME
2259 end
2260
2261 feature -- Position provider
2262
2263 position: like position_internal is
2264 -- Currently shown text position in the editor
2265 do
2266 Result := editor_tool.text_area.first_line_displayed
2267 end
2268
2269 pos_container: like pos_container_internal is
2270 -- Current selected formatter
2271 do
2272 Result := selected_formatter
2273 end
2274
2275 feature -- Resource Update
2276
2277 update is
2278 -- Update Current with the registered resources.
2279 do
2280 lock_update
2281 -- Show/hide general toolbar
2282 if development_window_data.show_general_toolbar then
2283 show_general_toolbar_command.enable_visible
2284 else
2285 show_general_toolbar_command.disable_visible
2286 end
2287
2288 -- Show/hide address toolbar
2289 if development_window_data.show_address_toolbar then
2290 show_address_toolbar_command.enable_visible
2291 else
2292 show_address_toolbar_command.disable_visible
2293 end
2294
2295 -- Show/hide project toolbar
2296 if development_window_data.show_project_toolbar then
2297 show_project_toolbar_command.enable_visible
2298 else
2299 show_project_toolbar_command.disable_visible
2300 end
2301
2302 -- Show/hide refactoring toolbar
2303 if development_window_data.show_refactoring_toolbar then
2304 show_refactoring_toolbar_command.enable_visible
2305 else
2306 show_refactoring_toolbar_command.disable_visible
2307 end
2308
2309 left_panel.load_from_resource (development_window_data.left_panel_layout)
2310 right_panel.load_from_resource (development_window_data.right_panel_layout)
2311 splitter_position := development_window_data.left_panel_width
2312 update_splitters
2313 unlock_update
2314 end
2315
2316 update_splitters is
2317 -- Refresh the position of the splitter on screen according to
2318 -- our internal values.
2319 do
2320 -- Set the interior layout
2321 if panel.full then
2322 panel.set_split_position (splitter_position.max (panel.minimum_split_position))
2323 end
2324 end
2325
2326 register is
2327 -- Register to preferences we want notification of.
2328 do
2329 end
2330
2331 unregister is
2332 -- unregister to preferences we want notification of.
2333 do
2334 end
2335
2336 reset is
2337 -- Reset the window contents
2338 do
2339 Precursor
2340 address_manager.reset
2341
2342 --| FIXME ARNAUD, multiformat not yet implemented.
2343 -- format_list.enable_imp_formats_sensitive
2344 --| END FIXME
2345 end
2346
2347 rebuild_tools_menu is
2348 -- Refresh the list of external commands.
2349 local
2350 ms: LIST [EB_COMMAND_MENU_ITEM]
2351 l_sep: EV_MENU_SEPARATOR
2352 do
2353 -- Remove all the external commands, which are at the end of the menu.
2354 from
2355 tools_menu.go_i_th (tools_menu.count + 1 - number_of_displayed_external_commands)
2356 until
2357 tools_menu.after
2358 loop
2359 tools_menu.remove
2360 end
2361 ms := Edit_external_commands_cmd.menus
2362 number_of_displayed_external_commands := ms.count
2363
2364 if not ms.is_empty and not tools_menu.is_empty then
2365 l_sep ?= tools_menu.last
2366 if l_sep = Void then
2367 create l_sep
2368 tools_menu.extend (l_sep)
2369 number_of_displayed_external_commands := number_of_displayed_external_commands + 1
2370 end
2371 end
2372
2373 from
2374 ms.start
2375 until
2376 ms.after
2377 loop
2378 tools_menu.extend (ms.item)
2379 add_recyclable (ms.item)
2380 ms.forth
2381 end
2382 end
2383
2384 syntax_is_correct: BOOLEAN is
2385 -- file was successfully parsed.
2386 do
2387 Result := editor_tool.text_area.syntax_is_correct
2388 end
2389
2390 on_project_created is
2391 -- Inform tools that the current project has been loaded or re-loaded.
2392 do
2393 build_menu_bar
2394 enable_commands_on_project_created
2395 context_tool.on_project_created
2396 address_manager.on_project_created
2397 if has_dll_generation then
2398 show_dynamic_lib_tool.enable_sensitive
2399 end
2400 if has_profiler then
2401 show_profiler.enable_sensitive
2402 end
2403 end
2404
2405 on_project_loaded is
2406 -- Inform tools that the current project has been loaded or re-loaded.
2407 do
2408 -- cluster_manager.on_project_loaded
2409 enable_commands_on_project_loaded
2410 cluster_tool.on_project_loaded
2411 context_tool.on_project_loaded
2412 breakpoints_tool.on_project_loaded
2413 end
2414
2415 on_project_unloaded is
2416 -- Inform tools that the current project will soon been unloaded.
2417 do
2418 -- cluster_manager.on_project_unloaded
2419 disable_commands_on_project_unloaded
2420 cluster_tool.on_project_unloaded
2421 context_tool.on_project_unloaded
2422 address_manager.on_project_unloaded
2423 build_menu_bar
2424 if has_dll_generation then
2425 show_dynamic_lib_tool.disable_sensitive
2426 end
2427 if has_profiler then
2428 show_profiler.disable_sensitive
2429 end
2430 end
2431
2432 on_c_compilation_starts is
2433 -- Enable commands when freezing or finalizing starts.
2434 do
2435 c_workbench_compilation_cmd.disable_sensitive
2436 c_finalized_compilation_cmd.disable_sensitive
2437 end
2438
2439 on_c_compilation_stops is
2440 -- Disable commands when freezing or finalizing stops.
2441 do
2442 c_workbench_compilation_cmd.enable_sensitive
2443 c_finalized_compilation_cmd.enable_sensitive
2444 end
2445
2446 save_before_compiling is
2447 -- save the text but do not update clickable positions
2448 do
2449 save_only := True
2450 save_text
2451 end
2452
2453 perform_check_before_save is
2454 -- Perform any pre-save operations/checks
2455 local
2456 dial: EV_CONFIRMATION_DIALOG
2457 do
2458 -- Remove trailing blanks.
2459 if preferences.editor_data.auto_remove_trailing_blank_when_saving then
2460 editor_tool.text_area.text_displayed.remove_trailing_blanks
2461 else
2462 editor_tool.text_area.text_displayed.remove_trailing_fake_blanks
2463 end
2464 editor_tool.text_area.refresh_now
2465
2466 if editor_tool.text_area.open_backup then
2467 create dial.make_with_text(Warning_messages.w_save_backup)
2468 dial.set_buttons_and_actions(<<"Continue", "Cancel">>, <<agent continue_save, agent cancel_save>>)
2469 dial.set_default_push_button(dial.button("Continue"))
2470 dial.set_default_cancel_button(dial.button("Cancel"))
2471 dial.set_title ("Save Backup")
2472 dial.show_modal_to_window (window)
2473 else
2474 check_passed := True
2475 end
2476 end
2477
2478 continue_save is
2479 -- continue saving
2480 do
2481 check_passed := True
2482 end
2483
2484 cancel_save is
2485 -- cancel saving
2486 do
2487 check_passed := False
2488 end
2489
2490 process is
2491 -- process the user entry in the address bar
2492 local
2493 l_class_stone: CLASSI_STONE
2494 l_multi_search_tool: EB_MULTI_SEARCH_TOOL
2495 do
2496 save_canceled := False
2497 l_class_stone ?= stone
2498 if l_class_stone /= Void then
2499 l_multi_search_tool ?= search_tool
2500 if l_multi_search_tool /= Void then
2501 l_multi_search_tool.class_changed (l_class_stone.class_i)
2502 end
2503 end
2504 end
2505
2506 on_text_saved is
2507 -- Notify the editor that the text has been saved
2508 local
2509 str: STRING
2510 do
2511 Precursor
2512 editor_tool.on_text_saved
2513 text_saved := True
2514 if not save_only then
2515 editor_tool.text_area.update_click_list (True)
2516 end
2517 save_only := False
2518 str := title.twin
2519 if str @ 1 = '*' then
2520 str.keep_tail (str.count - 2)
2521 set_title (str)
2522 end
2523 update_formatters
2524 lock_update
2525 features_tool.synchronize
2526 refresh_cursor_position
2527 refresh_context_info
2528 unlock_update
2529 if editor_tool.text_area.syntax_is_correct then
2530 status_bar.display_message ("")
2531 else
2532 status_bar.display_message (Interface_names.L_syntax_error)
2533 end
2534 text_edited := False
2535 end
2536
2537 on_focus is
2538 -- Focus gained
2539 local
2540 editor: TEXT_PANEL
2541 do
2542 editor ?= editor_tool.text_area
2543 if editor /= Void then
2544 editor.on_focus
2545 end
2546 end
2547
2548 save_and (an_action: PROCEDURE [ANY, TUPLE]) is
2549 local
2550 save_dialog: EB_CONFIRM_SAVE_DIALOG
2551 do
2552 save_canceled := True
2553 text_saved := False
2554 create save_dialog.make_and_launch (Current,Current)
2555 if not save_canceled and then syntax_is_correct then
2556 an_action.call(Void)
2557 end
2558 end
2559
2560 update_viewpoints is
2561 -- Update viewpoints
2562 local
2563 l_formatter: EB_FORMATTER
2564 l_end_loop: BOOLEAN
2565 l_index: INTEGER
2566 do
2567 view_points_combo.disable_sensitive
2568 if view_points_combo.has_renamed_view_point then
2569 l_index := managed_main_formatters.index
2570 from
2571 managed_main_formatters.start
2572 managed_main_formatters.forth
2573 until
2574 managed_main_formatters.after or l_end_loop
2575 loop
2576 l_formatter := managed_main_formatters.item
2577 if l_formatter.selected and l_formatter.button.is_sensitive then
2578 l_end_loop := True
2579 view_points_combo.enable_sensitive
2580 end
2581 managed_main_formatters.forth
2582 end
2583 managed_main_formatters.go_i_th (l_index)
2584 end
2585 end
2586
2587 feature -- Window management
2588
2589 show_window is
2590 -- Show the window
2591 do
2592 show
2593 end
2594
2595 raise_window is
2596 -- Show the window and set the focus to it.
2597 do
2598 show
2599 --| FIXME, set the focus.
2600 end
2601
2602 hide_window is
2603 -- Hide the window
2604 do
2605 hide
2606 end
2607
2608 destroy_window is
2609 -- Destroy the window.
2610 do
2611 destroy
2612 end
2613
2614 give_focus is
2615 -- Give the focus to the address manager.
2616 do
2617 address_manager.set_focus
2618 end
2619
2620 save_layout is
2621 -- Store layout of `current'.
2622 do
2623 save_layout_to_window_data (development_window_data)
2624 -- Commit saves
2625 preferences.preferences.save_preferences
2626 end
2627
2628 save_layout_to_session (a_session: ES_SESSION) is
2629 -- Save session data of `Current' to session object `a_session'.
2630 local
2631 a_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA
2632 a_class_i: CLASSI_STONE
2633 do
2634 create a_window_data.make_from_window_data (preferences.development_window_data)
2635
2636 a_class_i ?= stone
2637 if a_class_i /= Void then
2638 a_window_data.save_filename (a_class_i.file_name)
2639 a_window_data.save_editor_position (editor_tool.text_area.current_cursor_position)
2640 end
2641
2642 if context_tool /= Void then
2643 a_window_data.save_context_data (
2644 context_tool.address_manager.cluster_label_text,
2645 context_tool.address_manager.class_label_text,
2646 context_tool.address_manager.feature_label_text,
2647 context_tool.notebook.selected_item_index
2648 )
2649 end
2650
2651 save_layout_to_window_data (a_window_data)
2652
2653 -- Add the session data of `Current' to the session object.
2654 a_session.window_session_data.extend (a_window_data)
2655 end
2656
2657 save_layout_to_window_data (a_window_data: EB_DEVELOPMENT_WINDOW_DATA) is
2658 -- Store window data of `Current' in `a_window_data'.
2659 require
2660 a_window_data_not_void: a_window_data /= Void
2661 do
2662 -- Now save the windows's layout, but only if the
2663 -- debugger is not displayed in `Current'. By saving the layout,
2664 -- we ensure that future windows may use exactly the same layout.
2665 -- If the debugger is displayed, the previous layout is already saved,
2666 -- and this is the one that must be used, as only one debugger is ever displayed.
2667 if
2668 (Eb_debugger_manager.application_is_executing and Eb_debugger_manager.debugging_window /= Current)
2669 or not Eb_debugger_manager.application_is_executing
2670 then
2671 a_window_data.save_left_panel_layout (left_panel.save_to_resource)
2672 a_window_data.save_right_panel_layout (right_panel.save_to_resource)
2673 a_window_data.save_left_panel_width (panel.split_position)
2674 -- Save width & height.
2675 a_window_data.save_size (window.width, window.height)
2676 a_window_data.save_window_state (window.is_minimized, window.is_maximized)
2677 a_window_data.save_position (window.x_position, window.y_position)
2678 end
2679 end
2680
2681
2682 feature -- Tools & Controls
2683
2684 editor_tool: EB_EDITOR_TOOL
2685
2686 favorites_tool: EB_FAVORITES_TOOL
2687
2688 properties_tool: EB_PROPERTIES_TOOL
2689
2690 cluster_tool: EB_CLUSTER_TOOL
2691
2692 search_tool: EB_MULTI_SEARCH_TOOL
2693
2694 features_tool: EB_FEATURES_TOOL
2695
2696 breakpoints_tool: ES_BREAKPOINTS_TOOL
2697
2698 windows_tool: EB_WINDOWS_TOOL
2699
2700 context_tool: EB_CONTEXT_TOOL
2701 -- Context explorer for current class and system.
2702
2703 address_manager: EB_ADDRESS_MANAGER
2704 -- Text field in the toolbar
2705 -- Allow user to enter the name
2706 -- of the class he wants to edit.
2707
2708 project_manager: EB_PROJECT_MANAGER is
2709 -- Project manager associated to the project the user is working on.
2710 do
2711 Result := Eiffel_project.manager
2712 end
2713
2714 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2715 -- All formatters that operate on a class.
2716
2717 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2718 -- All formatters that operate on a class.
2719
2720 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2721 -- All formatters that can be displayed in the main editor frame.
2722
2723 view_points_combo: EB_VIEWPOINT_COMBO_BOX
2724 -- Combo box used to a select viewpoints
2725
2726 view_points_widget: EV_HORIZONTAL_BOX
2727 -- Widget to contain viewpoints box
2728
2729 unified_stone: BOOLEAN
2730 -- Is the stone common with the context tool or not?
2731
2732 arguments_dialog: EB_ARGUMENT_DIALOG
2733 -- The arguments dialog for current, if any
2734
2735 goto_dialog: EB_GOTO_DIALOG
2736 -- The goto dialog for line number access
2737
2738 feature -- Multiple editor management
2739
2740 add_editor_to_list (an_editor: EB_EDITOR) is
2741 -- adds `an_editor' to `editors'
2742 do
2743 editors.extend (an_editor)
2744 end
2745
2746 current_editor: EB_EDITOR is
2747 -- current editor, if none, main editor
2748 do
2749 if current_editor_index /= 0 then
2750 Result := editors @ current_editor_index
2751 else
2752 Result := editors.first
2753 end
2754 end
2755
2756 set_current_editor (an_editor: EB_EDITOR) is
2757 -- set `an_editor' as main editor
2758 local
2759 old_index: INTEGER
2760 new_index: INTEGER
2761 do
2762 old_index := current_editor_index
2763 new_index := editors.index_of (an_editor, 1)
2764 if
2765 editors.valid_index (new_index) and
2766 old_index /= new_index
2767 then
2768 current_editor_index := new_index
2769 update_paste_cmd
2770 -- Last thing, update the menu entry for the formatting marks.
2771 if current_editor.view_invisible_symbols then
2772 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
2773 else
2774 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
2775 end
2776 command_controller.set_current_editor (an_editor)
2777 end
2778 end
2779
2780 update_paste_cmd is
2781 -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2782 do
2783 if
2784 not current_editor.is_empty and then
2785 current_editor.is_editable and then
2786 current_editor.clipboard.has_text
2787 then
2788 editor_paste_cmd.enable_sensitive
2789 else
2790 editor_paste_cmd.disable_sensitive
2791 end
2792 end
2793
2794 feature {NONE} -- Multiple editor management
2795
2796 editors: ARRAYED_LIST [EB_EDITOR]
2797 -- editor contained in `Current'
2798
2799 current_editor_index: INTEGER
2800 -- Index in `editors' of the editor that has the focus.
2801
2802 feature {EB_FEATURES_TOOL, EB_FEATURES_TREE, DOTNET_CLASS_AS} -- Feature Clauses
2803
2804 set_feature_clauses (a_features: ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]]; a_type: STRING) is
2805 -- Set 'features' to 'a_features' and store in hash table with key 'a_type' denoting name of consumed
2806 -- type pertinent to 'a_features'.
2807 require
2808 a_features_not_void: a_features /= Void
2809 do
2810 if feature_clauses = Void then
2811 create feature_clauses.make (5)
2812 end
2813 feature_clauses.put (a_features, a_type)
2814 end
2815
2816 set_feature_locating (a_locating: BOOLEAN) is
2817 -- Set `feature_locating' with `a_locating'.
2818 do
2819 feature_locating := a_locating
2820 end
2821
2822 get_feature_clauses (a_type: STRING): ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]] is
2823 -- Get list of feature clauses relevant to .NET type with name 'a_type'.
2824 require
2825 a_type_not_void: a_type /= Void
2826 has_type_clauses: feature_clauses.has (a_type)
2827 do
2828 Result := feature_clauses.item (a_type)
2829 ensure
2830 result_not_void: Result /= Void
2831 end
2832
2833 feature_clauses: HASH_TABLE [ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]], STRING]
2834 -- List of features clauses for Current window hashed by the .NET name of the consumed_type.
2835
2836 feature_locating: BOOLEAN
2837 -- Is feature tool locating a feature?
2838
2839 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2840
2841 destroy_imp is
2842 -- Destroy window.
2843 do
2844 -- To avoid reentrance
2845 if not is_destroying then
2846 is_destroying := True
2847 -- If a launched application is still running, kill it.
2848 if
2849 Eb_debugger_manager.application_is_executing
2850 and then Eb_debugger_manager.debugging_window = Current
2851 then
2852 Eb_debugger_manager.Application.kill
2853 else
2854 development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2855 development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2856 end
2857 development_window_data.save_left_panel_width (panel.split_position)
2858 -- Save width & height.
2859 development_window_data.save_size (window.width, window.height)
2860 development_window_data.save_window_state (window.is_minimized, window.is_maximized)
2861 development_window_data.save_position (window.x_position, window.y_position)
2862 hide
2863
2864 -- Commit saves
2865 preferences.preferences.save_preferences
2866
2867 estudio_debug_cmd.unattach_window (window)
2868 toolbars_area.wipe_out
2869 address_manager.recycle
2870 project_customizable_toolbar.recycle
2871 refactoring_customizable_toolbar.recycle
2872 Precursor {EB_TOOL_MANAGER}
2873 left_panel.recycle
2874 right_panel.recycle
2875 managed_class_formatters.wipe_out
2876 managed_feature_formatters.wipe_out
2877 managed_main_formatters.wipe_out
2878 toolbarable_commands.wipe_out
2879 editors.wipe_out
2880 editors := Void
2881 stone := Void
2882 end
2883 end
2884
2885 feature -- C output pixmap management
2886
2887 start_c_output_pixmap_timer is
2888 -- Start timer to draw c output pixmap.
2889 do
2890 if context_tool /= Void then
2891 context_tool.start_c_output_pixmap_timer
2892 end
2893 end
2894
2895 stop_c_output_pixmap_timer is
2896 -- Stop timer to draw c output pixmap.
2897 do
2898 if context_tool /= Void then
2899 context_tool.stop_c_output_pixmap_timer
2900 end
2901 end
2902
2903 feature {NONE} -- Implementation
2904
2905 set_stone_after_check (a_stone: STONE) is
2906 local
2907 old_stone: STONE
2908 new_class_stone: CLASSI_STONE
2909 old_class_stone: CLASSI_STONE
2910 conv_classc: CLASSC_STONE
2911 conv_brkstone: BREAKABLE_STONE
2912 cluster_st: CLUSTER_STONE
2913 old_cluster_st: CLUSTER_STONE
2914 feature_stone: FEATURE_STONE
2915 conv_ferrst: FEATURE_ERROR_STONE
2916 target_stone: TARGET_STONE
2917
2918 ef_stone: EXTERNAL_FILE_STONE
2919 f: FILE
2920
2921 conv_errst: ERROR_STONE
2922 cl_syntax_stone: CL_SYNTAX_STONE
2923 error_line: INTEGER
2924 class_file: RAW_FILE
2925 class_text_exists: BOOLEAN
2926 same_class: BOOLEAN
2927 test_stone: CLASSI_STONE
2928 externali: EXTERNAL_CLASS_I
2929 external_cons: CONSUMED_TYPE
2930 str: STRING
2931 dotnet_class: BOOLEAN
2932 l_short_formatter: EB_SHORT_FORMATTER
2933 l_flat_formatter: EB_FLAT_SHORT_FORMATTER
2934 l_main_formatter: EB_CLASS_TEXT_FORMATTER
2935 app_exec: APPLICATION_EXECUTION
2936 do
2937 -- the text does not change if the text was saved with syntax errors
2938 cur_wid := window
2939 if cur_wid = Void then
2940 --| Do nothing.
2941 else
2942 if old_cur = Void then
2943 old_cur := cur_wid.pointer_style
2944 end
2945 -- cur_wid.enable_capture
2946 cur_wid.set_pointer_style (Wait_cursor)
2947 end
2948
2949 conv_brkstone ?= a_stone
2950 conv_errst ?= a_stone
2951 ef_stone ?= a_stone
2952 target_stone ?= a_stone
2953 if conv_brkstone /= Void then
2954 app_exec := Debugger_manager.application
2955 if app_exec.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2956 app_exec.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2957 else
2958 app_exec.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2959 end
2960 Debugger_manager.notify_breakpoints_changes
2961 elseif conv_errst /= Void then
2962 display_error_help_cmd.execute_with_stone (conv_errst)
2963 elseif ef_stone /= Void then
2964 f := ef_stone.file
2965 f.make_open_read (f.name)
2966 f.read_stream (f.count)
2967 f.close
2968 editor_tool.text_area.set_stone (a_stone)
2969 editor_tool.text_area.load_text (f.last_string)
2970 elseif target_stone /= Void then
2971 properties_tool.add_stone (target_stone)
2972 else
2973 -- Remember previous stone.
2974 old_stone := stone
2975 old_class_stone ?= stone
2976 old_cluster_st ?= stone
2977
2978 -- New stone properties
2979 new_class_stone ?= a_stone
2980
2981 -- Set the stone.
2982 old_set_stone (a_stone)
2983 cluster_st ?= a_stone
2984
2985 new_feature_cmd.disable_sensitive
2986 toggle_feature_alias_cmd.disable_sensitive
2987 toggle_feature_signature_cmd.disable_sensitive
2988 toggle_feature_assigner_cmd.disable_sensitive
2989
2990 -- We update the state of the `Add to Favorites' command.
2991 if new_class_stone /= Void then
2992 favorites_menu.first.enable_sensitive
2993 else
2994 favorites_menu.first.disable_sensitive
2995 end
2996
2997 -- Update the address manager if needed.
2998 address_manager.refresh
2999 if new_class_stone /= Void then
3000 if not during_synchronization then
3001 view_points_combo.set_conf_class (new_class_stone.class_i.config_class)
3002 end
3003 -- Text is now editable.
3004 editor_tool.text_area.set_read_only (False)
3005
3006 properties_tool.add_stone (new_class_stone)
3007
3008 -- class stone was dropped
3009 create class_file.make (new_class_stone.class_i.file_name)
3010 class_text_exists := class_file.exists
3011 feature_stone ?= a_stone
3012 --| We have to create a classi_stone to check whether the stones are really similar.
3013 --| Otherwise a redefinition of same_as may be called.
3014 create test_stone.make (new_class_stone.class_i)
3015 if test_stone.same_as (old_class_stone) then
3016 same_class := True
3017 end
3018 if not feature_stone_already_processed then
3019 if same_class and then text_saved then
3020 -- nothing changed in the editor
3021 -- we only have to update click_list
3022 if editor_tool.text_area.is_editable then
3023 editor_tool.text_area.update_click_list (False)
3024 end
3025 else
3026 if changed then
3027 -- user has already chosen not to save the file
3028 -- do not ask again
3029 editor_tool.text_area.no_save_before_next_load
3030 end
3031 end
3032 end
3033
3034 conv_classc ?= new_class_stone
3035
3036 -- First choose possible formatter
3037 l_main_formatter ?= new_class_stone.pos_container
3038 if l_main_formatter /= Void and not during_synchronization then
3039 if
3040 not (conv_classc /= Void and class_text_exists and (not changed or not same_class))
3041 then
3042 l_main_formatter.enable_select
3043 elseif feature_stone = Void then
3044 if l_main_formatter /= pos_container then
3045 l_main_formatter.enable_select
3046 end
3047 if new_class_stone.position > 0 then
3048 editor_tool.text_area.display_line_at_top_when_ready (new_class_stone.position)
3049 end
3050 end
3051 end
3052
3053 if conv_classc = Void or else
3054 conv_classc.e_class.is_external or else
3055 feature_stone /= Void and not
3056 feature_stone_already_processed and not
3057 (same_class and context_tool.sending_stone) then
3058 -- If a classi_stone or a feature_stone or a external call
3059 -- has been dropped, check to see if a .NET class.
3060 if class_text_exists then
3061 if new_class_stone.class_i.is_external_class then
3062 externali ?= new_class_stone.class_i
3063 check
3064 externali_not_void: externali /= Void
3065 end
3066 external_cons := externali.external_consumed_type
3067 if external_cons /= Void then
3068 -- A .NET class.
3069 dotnet_class := True
3070 l_short_formatter ?= managed_main_formatters.i_th (4)
3071 l_flat_formatter ?= managed_main_formatters.i_th (5)
3072 if l_short_formatter /= Void then
3073 l_short_formatter.set_dotnet_mode (True)
3074 end
3075 if l_flat_formatter /= Void then
3076 l_flat_formatter.set_dotnet_mode (True)
3077 end
3078 end
3079 elseif feature_stone /= Void then
3080 from
3081 managed_main_formatters.start
3082 until
3083 managed_main_formatters.after
3084 loop
3085 managed_main_formatters.item.set_stone (new_class_stone)
3086 managed_main_formatters.forth
3087 end
3088 else
3089 managed_main_formatters.first.set_stone (new_class_stone)
3090 managed_main_formatters.first.execute
3091 end
3092 else
3093 editor_tool.text_area.clear_window
3094 editor_tool.text_area.display_message (
3095 Warning_messages.w_file_not_exist (
3096 new_class_stone.class_i.file_name))
3097 end
3098 end
3099 if conv_classc = Void then
3100 --| The dropped class is not compiled.
3101 --| Display only the textual formatter.
3102 if dotnet_class then
3103 managed_main_formatters.i_th (4).set_stone (new_class_stone)
3104 managed_main_formatters.i_th (5).set_stone (new_class_stone)
3105 managed_main_formatters.i_th (4).execute
3106 end
3107 address_manager.disable_formatters
3108 else
3109 --| We have a compiled class.
3110 if
3111 class_text_exists and then
3112 Eiffel_project.Workbench.last_reached_degree <= 2
3113 then
3114 new_feature_cmd.enable_sensitive
3115 toggle_feature_alias_cmd.enable_sensitive
3116 toggle_feature_signature_cmd.enable_sensitive
3117 toggle_feature_assigner_cmd.enable_sensitive
3118 end
3119
3120 --address_manager.enable_formatters
3121 update_formatters
3122 if not class_text_exists then
3123 --| Disable the textual formatter.
3124 managed_main_formatters.first.disable_sensitive
3125 from
3126 managed_main_formatters.start
3127 until
3128 managed_main_formatters.after
3129 loop
3130 managed_main_formatters.item.set_stone (new_class_stone)
3131 managed_main_formatters.forth
3132 end
3133 if not is_stone_external then
3134 managed_main_formatters.i_th (2).execute
3135 end
3136 else
3137 if not changed or not same_class then
3138 --| Enable all formatters.
3139 if
3140 (not feature_stone_already_processed or
3141 not managed_main_formatters.first.selected) and
3142 feature_stone = Void
3143 then
3144 from
3145 managed_main_formatters.start
3146 until
3147 managed_main_formatters.after
3148 loop
3149 managed_main_formatters.item.set_stone (new_class_stone)
3150 managed_main_formatters.forth
3151 end
3152 end
3153 else
3154 if not feature_stone_already_processed then
3155 address_manager.disable_formatters
3156 from
3157 managed_main_formatters.start
3158 until
3159 managed_main_formatters.after
3160 loop
3161 managed_main_formatters.item.set_stone (new_class_stone)
3162 managed_main_formatters.forth
3163 end
3164 end
3165 end
3166 end
3167 end
3168 if not managed_main_formatters.first.selected then
3169 editor_tool.text_area.set_read_only (true)
3170 elseif new_class_stone /= Void and then new_class_stone.class_i.is_read_only then
3171 editor_tool.text_area.set_read_only (true)
3172 end
3173 else
3174 -- not a class text : cannot be edited
3175 editor_tool.text_area.set_read_only (True)
3176 address_manager.disable_formatters
3177
3178 --| Disable all formatters.
3179 from
3180 managed_main_formatters.start
3181 until
3182 managed_main_formatters.after
3183 loop
3184 managed_main_formatters.item.set_stone (Void)
3185 managed_main_formatters.forth
3186 end
3187 if cluster_st /= Void then
3188 properties_tool.add_stone (cluster_st)
3189 if cluster_st.is_cluster then
3190 --| FIXME XR: Really manage cluster display in the main editor
3191 if not during_synchronization then
3192 view_points_combo.set_conf_group (cluster_st.group)
3193 end
3194 formatted_context_for_cluster (cluster_st.cluster_i, cluster_st.path)
3195 if cluster_st.position > 0 then
3196 editor_tool.text_area.display_line_at_top_when_ready (cluster_st.position)
3197 end
3198 --| END FIXME
3199 end
3200 end
3201 end
3202 if class_text_exists then
3203 if feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
3204 conv_ferrst ?= feature_stone
3205 if conv_ferrst /= Void then
3206 error_line := conv_ferrst.line_number
3207 else
3208 -- if a feature_stone has been dropped
3209 -- scroll to the corresponding feature in the basic text format
3210 if not during_synchronization then
3211 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
3212 end
3213 end
3214 else
3215 cl_syntax_stone ?= a_stone
3216 if cl_syntax_stone /= Void then
3217 error_line := cl_syntax_stone.line
3218 end
3219 end
3220 if error_line > 0 then
3221 -- Scroll to the line of the error.
3222 if not during_synchronization then
3223 if not managed_main_formatters.first.selected then
3224 managed_main_formatters.first.execute
3225 check
3226 new_class_stone_not_void: new_class_stone /= Void
3227 end
3228 if new_class_stone.class_i.is_read_only then
3229 editor_tool.text_area.set_read_only (true)
3230 end
3231 end
3232 editor_tool.text_area.display_line_when_ready (error_line, True)
3233 end
3234 end
3235 end
3236 -- Update the title of the window
3237 if a_stone /= Void then
3238 if changed then
3239 str := a_stone.header.twin
3240 str.prepend ("* ")
3241 set_title (str)
3242 else
3243 set_title (a_stone.header)
3244 end
3245 else
3246 set_title (Interface_names.t_empty_development_window)
3247 end
3248
3249 -- Refresh the tools.
3250 features_tool.set_stone (a_stone)
3251 cluster_tool.set_stone (a_stone)
3252 -- Update the context tool.
3253 if unified_stone then
3254 context_tool.set_stone (a_stone)
3255 end
3256
3257 end
3258 if
3259 stone /= Void and then
3260 not unified_stone
3261 then
3262 send_stone_to_context_cmd.enable_sensitive
3263 else
3264 send_stone_to_context_cmd.disable_sensitive
3265 end
3266 if cur_wid = Void then
3267 --| Do nothing.
3268 else
3269 cur_wid.set_pointer_style (old_cur)
3270 old_cur := Void
3271 -- cur_wid.disable_capture
3272 cur_wid := Void
3273 end
3274 update_viewpoints
3275 end
3276
3277 formatted_context_for_cluster (a_cluster: CLUSTER_I; a_path: STRING) is
3278 -- Formatted context representing the list of classes inside `a_cluster'.
3279 require
3280 a_cluster_not_void: a_cluster /= Void
3281 a_path_not_void: a_path /= Void
3282 local
3283 l_assembly: ASSEMBLY_I
3284 l_sorted_cluster: EB_SORTED_CLUSTER
3285 l_classes: DS_ARRAYED_LIST [CLASS_I]
3286 l_in_classes: DS_ARRAYED_LIST [CLASS_I]
3287 l_out_classes: DS_ARRAYED_LIST [CLASS_I]
3288 l_over_classes: DS_ARRAYED_LIST [CLASS_I]
3289 l_subclu: DS_LIST [EB_SORTED_CLUSTER]
3290 l_cl_i, l_overridden_class: CLASS_I
3291 l_cluster: CLUSTER_I
3292 l_assert_level: ASSERTION_I
3293 l_format_context: TEXT_FORMATTER_DECORATOR
3294 l_description: STRING
3295 do
3296 create l_format_context.make_for_case (editor_tool.text_area.text_displayed)
3297 editor_tool.text_area.handle_before_processing (False)
3298 l_format_context.process_keyword_text (ti_indexing_keyword, Void)
3299 l_format_context.put_new_line
3300 l_format_context.indent
3301 if a_cluster.is_assembly then
3302 l_assembly ?= a_cluster
3303 check l_assembly /= Void end
3304 l_format_context.process_indexing_tag_text ("assembly_name")
3305 l_format_context.set_without_tabs
3306 l_format_context.process_symbol_text (ti_colon)
3307 l_format_context.put_space
3308 l_format_context.put_quoted_string_item (l_assembly.assembly_name)
3309 l_format_context.put_new_line
3310 l_format_context.process_indexing_tag_text ("assembly_path")
3311 l_format_context.set_without_tabs
3312 l_format_context.process_symbol_text (ti_colon)
3313 l_format_context.put_space
3314 l_format_context.put_quoted_string_item (l_assembly.location.evaluated_path)
3315 l_format_context.put_new_line
3316
3317 end
3318 l_format_context.process_indexing_tag_text ("cluster")
3319 l_format_context.set_without_tabs
3320 l_format_context.process_symbol_text (ti_colon)
3321 l_format_context.put_space
3322 l_format_context.add_group (a_cluster, a_cluster.cluster_name)
3323
3324 l_format_context.put_new_line
3325 l_format_context.process_indexing_tag_text ("cluster_path")
3326 l_format_context.set_without_tabs
3327 l_format_context.process_symbol_text (ti_colon)
3328 l_format_context.put_space
3329 l_format_context.put_quoted_string_item (a_cluster.path)
3330
3331 if a_path /= Void and then not a_path.is_empty then
3332 l_format_context.put_space
3333 l_format_context.set_without_tabs
3334 l_format_context.process_symbol_text (ti_l_parenthesis)
3335 l_format_context.put_quoted_string_item (a_path)
3336 l_format_context.set_without_tabs
3337 l_format_context.process_symbol_text (ti_r_parenthesis)
3338 end
3339 l_format_context.put_new_line
3340
3341 -- Now try to get the description of the cluster, and if not
3342 -- we take the one from its target.
3343 if a_cluster.description /= Void then
3344 l_description := a_cluster.description
3345 elseif a_cluster.target.description /= Void then
3346 l_description := a_cluster.target.description
3347 end
3348 if l_description /= Void then
3349 l_format_context.process_indexing_tag_text ("description")
3350 l_format_context.set_without_tabs
3351 l_format_context.process_symbol_text (ti_colon)
3352 l_format_context.put_space
3353 l_format_context.set_in_indexing_clause (True)
3354 l_format_context.process_symbol_text (ti_double_quote)
3355 l_format_context.process_symbol_text (ti_l_bracket)
3356 l_format_context.put_new_line
3357 if l_description.has ('%N') then
3358 -- Indenting looks strange below because
3359 -- `add_multiline_string' does not take into accounts
3360 -- how many indents already exists.
3361 l_format_context.exdent
3362 l_format_context.add_multiline_string (l_description, 3)
3363 l_format_context.indent
3364 else
3365 l_format_context.indent
3366 l_format_context.indent
3367 l_format_context.add_string (l_description)
3368 l_format_context.exdent
3369 l_format_context.exdent
3370 end
3371 l_format_context.put_new_line
3372 l_format_context.indent
3373 l_format_context.process_symbol_text (ti_r_bracket)
3374 l_format_context.process_symbol_text (ti_double_quote)
3375 l_format_context.exdent
3376 l_format_context.put_new_line
3377 end
3378
3379 if a_cluster.parent_cluster /= Void then
3380 l_format_context.process_indexing_tag_text ("parent cluster")
3381 l_format_context.set_without_tabs
3382 l_format_context.process_symbol_text (ti_colon)
3383 l_format_context.put_new_line
3384 l_format_context.indent
3385 l_format_context.put_manifest_string (" - ")
3386
3387 l_format_context.add_group (a_cluster.parent_cluster, a_cluster.parent_cluster.cluster_name)
3388 l_format_context.put_new_line
3389 l_format_context.exdent
3390 end
3391
3392 create l_sorted_cluster.make (a_cluster)
3393 l_sorted_cluster.initialize
3394
3395 if not l_sorted_cluster.clusters.is_empty then
3396 l_format_context.process_indexing_tag_text ("sub cluster(s)")
3397 l_format_context.set_without_tabs
3398 l_format_context.process_symbol_text (ti_colon)
3399 l_format_context.put_new_line
3400 l_format_context.indent
3401 from
3402 l_subclu := l_sorted_cluster.clusters
3403 l_subclu.start
3404 until
3405 l_subclu.after
3406 loop
3407 l_cluster := l_subclu.item_for_iteration.actual_cluster
3408 l_format_context.put_manifest_string (" - ")
3409 l_format_context.add_group (l_cluster, l_cluster.cluster_name)
3410 l_format_context.put_space
3411 l_format_context.set_without_tabs
3412 l_format_context.process_symbol_text (ti_L_parenthesis)
3413 l_format_context.process_comment_text (l_cluster.classes.count.out, Void)
3414 l_format_context.set_without_tabs
3415 l_format_context.process_symbol_text (ti_R_parenthesis)
3416 l_format_context.put_new_line
3417 l_subclu.forth
3418 end
3419 l_format_context.exdent
3420 end
3421
3422 if not l_sorted_cluster.classes.is_empty then
3423 l_classes := l_sorted_cluster.classes
3424 from
3425 l_classes.start
3426 create l_in_classes.make (l_classes.count)
3427 create l_out_classes.make (l_classes.count)
3428 create l_over_classes.make (l_classes.count)
3429 until
3430 l_classes.after
3431 loop
3432 l_cl_i := l_classes.item_for_iteration
3433 if
3434 a_path.is_empty
3435 or else is_string_started_by (l_cl_i.path, a_path)
3436 then
3437 if l_cl_i.compiled then
3438 l_in_classes.put_last (l_cl_i)
3439 if l_cl_i.config_class.is_overriden then
3440 l_over_classes.put_last (l_cl_i)
3441 end
3442 else
3443 l_out_classes.put_last (l_cl_i)
3444 end
3445 end
3446 l_classes.forth
3447 end
3448 l_classes := Void
3449
3450 if l_in_classes.count > 0 then
3451 l_format_context.put_new_line
3452 if l_in_classes.count = 1 then
3453 l_format_context.process_indexing_tag_text ("1 compiled class")
3454 else
3455 l_format_context.process_indexing_tag_text (
3456 l_in_classes.count.out + " compiled classes")
3457 end
3458 l_format_context.set_without_tabs
3459 l_format_context.process_symbol_text (ti_colon)
3460 l_format_context.put_new_line
3461 l_format_context.indent
3462
3463 from
3464 l_in_classes.start
3465 until
3466 l_in_classes.after
3467 loop
3468 l_cl_i := l_in_classes.item_for_iteration
3469 check compiled: l_cl_i.compiled end
3470
3471 l_assert_level := l_cl_i.assertion_level
3472 l_format_context.put_manifest_string (" - ")
3473 l_format_context.put_classi (l_cl_i)
3474 l_format_context.set_without_tabs
3475 l_format_context.process_symbol_text (ti_colon)
3476 if l_assert_level.check_all then
3477 l_format_context.put_space
3478 l_format_context.set_without_tabs
3479 l_format_context.process_keyword_text (ti_All_keyword, Void)
3480 elseif l_assert_level.level = 0 then
3481 l_format_context.put_space
3482 l_format_context.process_comment_text (once "None", Void)
3483 else
3484 if l_assert_level.check_precond then
3485 l_format_context.put_space
3486 l_format_context.set_without_tabs
3487 l_format_context.process_keyword_text (ti_Require_keyword, Void)
3488 end
3489 if l_assert_level.check_postcond then
3490 l_format_context.put_space
3491 l_format_context.set_without_tabs
3492 l_format_context.process_keyword_text (ti_Ensure_keyword, Void)
3493 end
3494 if l_assert_level.check_check then
3495 l_format_context.put_space
3496 l_format_context.set_without_tabs
3497 l_format_context.process_keyword_text (ti_Check_keyword, Void)
3498 end
3499 if l_assert_level.check_loop then
3500 l_format_context.put_space
3501 l_format_context.set_without_tabs
3502 l_format_context.process_keyword_text (ti_Loop_keyword, Void)
3503 end
3504 if l_assert_level.check_invariant then
3505 l_format_context.put_space
3506 l_format_context.set_without_tabs
3507 l_format_context.process_keyword_text (ti_Invariant_keyword, Void)
3508 end
3509 end
3510 l_format_context.put_new_line
3511 l_in_classes.forth
3512 end
3513 l_format_context.exdent
3514 end
3515 l_in_classes := Void
3516
3517 if l_out_classes.count > 0 then
3518 l_format_context.put_new_line
3519 if l_out_classes.count = 1 then
3520 l_format_context.process_indexing_tag_text ("1 class not in system")
3521 else
3522 l_format_context.process_indexing_tag_text (
3523 l_out_classes.count.out + " classes not in system")
3524 end
3525 l_format_context.set_without_tabs
3526 l_format_context.process_symbol_text (ti_colon)
3527 l_format_context.put_new_line
3528 l_format_context.indent
3529 from
3530 l_out_classes.start
3531 until
3532 l_out_classes.after
3533 loop
3534 l_cl_i := l_out_classes.item_for_iteration
3535 check not_in_system: not l_cl_i.compiled end
3536 l_format_context.put_manifest_string (" - ")
3537 l_format_context.put_classi (l_cl_i)
3538 l_format_context.put_new_line
3539 l_out_classes.forth
3540 end
3541 l_format_context.exdent
3542 end
3543 l_out_classes := Void
3544
3545 if
3546 l_over_classes.count > 0 and then
3547 a_cluster.overriders /= Void and then not a_cluster.overriders.is_empty
3548 then
3549 l_format_context.put_new_line
3550 l_format_context.process_indexing_tag_text ("Overriden")
3551 l_format_context.set_without_tabs
3552 l_format_context.process_symbol_text (ti_colon)
3553 l_format_context.put_new_line
3554 l_format_context.indent
3555 from
3556 l_over_classes.start
3557 until
3558 l_over_classes.after
3559 loop
3560 l_cl_i := l_over_classes.item_for_iteration
3561 check is_overriden_class: l_cl_i.config_class.is_overriden end
3562
3563 l_format_context.put_manifest_string (" - ")
3564 l_format_context.put_classi (l_cl_i)
3565 l_format_context.process_comment_text (" overriden by", Void)
3566 l_format_context.process_symbol_text (ti_colon)
3567 l_format_context.put_space
3568
3569 l_overridden_class ?= l_cl_i.config_class.overriden_by
3570 if l_overridden_class /= Void then
3571 l_format_context.put_classi (l_overridden_class)
3572 l_format_context.put_manifest_string (" in ")
3573 l_format_context.add_group (l_cl_i.config_class.overriden_by.group, l_cl_i.config_class.overriden_by.group.name)
3574 l_format_context.put_new_line
3575 end
3576 l_over_classes.forth
3577 end
3578 l_format_context.exdent
3579 l_format_context.put_new_line
3580 end
3581 l_over_classes := Void
3582 end
3583
3584 l_format_context.exdent
3585 l_format_context.put_new_line
3586 editor_tool.text_area.handle_after_processing
3587 end
3588
3589 scroll_to_feature (feat_as: E_FEATURE; displayed_class: CLASS_I) is
3590 -- highlight the feature correspnding to `feat_as' in the class represented by `displayed_class'
3591 require
3592 class_is_not_void: displayed_class /= Void
3593 feat_as_is_not_void: feat_as /= Void
3594 local
3595 begin_index, offset: INTEGER
3596 tmp_text: STRING
3597 do
3598 if not feat_as.is_il_external then
3599 if not managed_main_formatters.first.selected then
3600 if feat_as.ast /= Void then
3601 editor_tool.text_area.find_feature_named (feat_as.name)
3602 end
3603 else
3604 if feat_as.ast /= Void then
3605 begin_index := feat_as.ast.start_position
3606 tmp_text := displayed_class.text.substring (1, begin_index)
3607 offset := tmp_text.occurrences('%R')
3608 editor_tool.text_area.scroll_to_when_ready (begin_index.item - offset)
3609 end
3610 end
3611 else
3612 -- Nothing for .NET features for now.
3613 fixme ("It should be implemented.")
3614 end
3615 end
3616
3617 check_passed: BOOLEAN
3618
3619 save_canceled: BOOLEAN
3620 -- did user cancel save ?
3621
3622 save_only: BOOLEAN
3623 -- skip parse and update after save ?
3624
3625 text_saved: BOOLEAN
3626 -- has the user chosen to save the file
3627
3628 is_destroying: BOOLEAN
3629 -- Is `current' being currently destroyed?
3630
3631 feature_stone_already_processed: BOOLEAN
3632 -- Is the processed stone a feature stone and has it
3633 -- been already processed by the editor ?
3634
3635 feature {NONE} -- Implementation
3636
3637 update_save_symbol is
3638 do
3639 Precursor {EB_FILEABLE}
3640 if changed then
3641 save_cmd.enable_sensitive
3642 address_manager.disable_formatters
3643 else
3644 save_cmd.disable_sensitive
3645 update_formatters
3646 end
3647 if is_empty then
3648 print_cmd.disable_sensitive
3649 save_as_cmd.disable_sensitive
3650 else
3651 print_cmd.enable_sensitive
3652 save_as_cmd.enable_sensitive
3653 end
3654 end
3655
3656 is_stone_external: BOOLEAN
3657 -- Does 'stone' contain a .NET consumed type?
3658
3659 update_formatters is
3660 -- Give a correct sensitivity to formatters.
3661 local
3662 cist: CLASSI_STONE
3663 cst: CLASSC_STONE
3664 type_changed: BOOLEAN
3665 do
3666 cst ?= stone
3667 cist ?= stone
3668 -- Check to if formatting context has changed.
3669 if cst /= Void then
3670 type_changed := (cst.e_class.is_true_external and not is_stone_external) or
3671 (not cst.e_class.is_true_external and is_stone_external)
3672 elseif cist /= Void then
3673 type_changed := (cist.class_i.is_external_class and not is_stone_external) or
3674 (not cist.class_i.is_external_class and is_stone_external)
3675 end
3676
3677 if type_changed then
3678 -- Toggle stone flag.
3679 is_stone_external := not is_stone_external
3680 end
3681
3682 if cst /= Void then
3683 address_manager.enable_formatters
3684 if is_stone_external then
3685 -- Change formatters to .NET sensitivity (from normal).
3686 enable_dotnet_formatters
3687 if type_changed then
3688 managed_main_formatters.i_th (4).enable_select
3689 end
3690 else
3691 if changed then
3692 address_manager.disable_formatters
3693 else
3694 --managed_main_formatters.first.disable_sensitive
3695 end
3696 end
3697 elseif cist /= Void and is_stone_external then
3698 -- Change formatters to .NET sensitivity (from normal).
3699 enable_dotnet_formatters
3700 if type_changed then
3701 managed_main_formatters.i_th (4).enable_select
3702 end
3703 else
3704 address_manager.disable_formatters
3705 if cist /= stone then
3706 managed_main_formatters.first.execute
3707 end
3708 end
3709 end
3710
3711 enable_dotnet_formatters is
3712 -- Enable only the .NET class text formatters.
3713 local
3714 l_formatters: like managed_main_formatters
3715 do
3716 l_formatters := managed_main_formatters.twin
3717 from
3718 l_formatters.start
3719 until
3720 l_formatters.after
3721 loop
3722 if l_formatters.item.is_dotnet_formatter then
3723 l_formatters.item.enable_sensitive
3724 else
3725 l_formatters.item.disable_sensitive
3726 end
3727 l_formatters.forth
3728 end
3729 end
3730
3731 on_text_reset is
3732 -- The main editor has just been wiped out
3733 -- before loading a new file.
3734 local
3735 str: STRING
3736 do
3737 str := title.twin
3738 if str @ 1 = '*' then
3739 str.keep_tail (str.count - 2)
3740 set_title (str)
3741 end
3742 address_manager.disable_formatters
3743 status_bar.reset
3744 status_bar.remove_cursor_position
3745 text_edited := False
3746 end
3747
3748 on_cursor_moved is
3749 -- The cursor has moved, reflect the change in the status bar.
3750 -- And reflect location editing in the text in features tool and address bar.
3751 do
3752 refresh_cursor_position
3753 if context_refreshing_timer = Void then
3754 create context_refreshing_timer.make_with_interval (100)
3755 context_refreshing_timer.actions.extend (agent refresh_context_info)
3756 end
3757 if feature_locating then
3758 context_refreshing_timer.set_interval (0)
3759 else
3760 context_refreshing_timer.set_interval (100)
3761 end
3762
3763 end
3764
3765 on_text_fully_loaded is
3766 -- The main editor has just been reloaded.
3767 do
3768 update_paste_cmd
3769 update_formatters
3770 if editor_tool.text_area.syntax_is_correct then
3771 status_bar.reset
3772 else
3773 status_bar.display_message (Interface_names.L_syntax_error)
3774 end
3775 refresh_cursor_position
3776 text_edited := False
3777 end
3778
3779 on_text_back_to_its_last_saved_state is
3780 local
3781 str: STRING
3782 do
3783 str := title.twin
3784 if str @ 1 = '*' then
3785 str.keep_tail (str.count - 2)
3786 set_title (str)
3787 end
3788 update_formatters
3789 text_edited := False
3790 end
3791
3792 text_edited: BOOLEAN
3793 -- Do we know that the text was edited?
3794 -- If so, no need to update the display each time it is edited.
3795
3796 on_text_edited (unused: BOOLEAN) is
3797 -- The text in the editor is modified, add the '*' in the title.
3798 -- Gray out the formatters.
3799 local
3800 str: STRING
3801 cst: CLASSI_STONE
3802 do
3803 if not text_edited then
3804 str := title.twin
3805 if str @ 1 /= '*' then
3806 str.prepend ("* ")
3807 set_title (str)
3808 end
3809 address_manager.disable_formatters
3810 cst ?= stone
3811 if cst /= Void then
3812 Eiffel_project.Manager.class_is_edited (cst.class_i)
3813 end
3814 text_edited := True
3815 end
3816 if not status_bar.message.is_equal (interface_names.e_c_compilation_running) then
3817 -- We don't want the "Background C compilation in progress" message flash every time
3818 -- user presses a key.
3819 status_bar.display_message ("")
3820 end
3821 end
3822
3823 on_back is
3824 -- User pressed Alt+left.
3825 -- Go back in the history (or the context history).
3826 do
3827 if context_tool_has_focus then
3828 if context_tool.history_manager.is_back_possible then
3829 context_tool.history_manager.back_command.execute
3830 end
3831 elseif history_manager.is_back_possible then
3832 history_manager.back_command.execute
3833 end
3834 end
3835
3836 on_forth is
3837 -- User pressed Alt+right.
3838 -- Go forth in the history (or the context history).
3839 do
3840 if context_tool_has_focus then
3841 if context_tool.history_manager.is_forth_possible then
3842 context_tool.history_manager.forth_command.execute
3843 end
3844 elseif history_manager.is_forth_possible then
3845 history_manager.forth_command.execute
3846 end
3847 end
3848
3849 context_tool_has_focus: BOOLEAN is
3850 -- Does the context tool or one of its children has the focus?
3851 local
3852 fw: EV_WIDGET
3853 cont: EV_CONTAINER
3854 wid: EV_WIDGET
3855 do
3856 fw := (create {EV_ENVIRONMENT}).application.focused_widget
3857 wid := context_tool.explorer_bar_item.widget
3858 if wid = fw then
3859 Result := True
3860 elseif fw = Void then
3861 Result := False
3862 else
3863 from
3864 cont := fw.parent
3865 until
3866 cont = wid or cont = Void
3867 loop
3868 cont := cont.parent
3869 end
3870 if cont = wid then
3871 Result := True
3872 end
3873 end
3874 end
3875
3876 saved_cursor: CURSOR
3877 -- Saved cursor position for displaying the stack.
3878
3879 send_stone_to_context is
3880 -- Send current stone to the context tool.
3881 -- Used by `send_stone_to_context_cmd'.
3882 do
3883 if stone /= Void then
3884 context_tool.set_stone (stone)
3885 end
3886 end
3887
3888 destroy is
3889 -- check if current text has been saved and destroy
3890 local
3891 dialog_w: EV_WARNING_DIALOG
3892 do
3893 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
3894 process_manager.confirm_external_command_termination (agent terminate_external_command_and_destroy, agent do_nothing, window)
3895 else
3896 if editor_tool /= Void and then editor_tool.text_area /= Void and then changed and then not confirmed then
3897 if Window_manager.development_windows_count > 1 then
3898 create dialog_w.make_with_text (Warning_messages.w_save_before_closing)
3899 dialog_w.set_buttons_and_actions (<<"Yes", "No", "Cancel">>, <<agent save_and_destroy, agent force_destroy, agent do_nothing>>)
3900 dialog_w.set_default_push_button (dialog_w.button("Yes"))
3901 dialog_w.set_default_cancel_button (dialog_w.button("Cancel"))
3902 dialog_w.show_modal_to_window (window)
3903 else
3904 -- We let the window manager handle the saving, along with other windows
3905 -- (not development windows)
3906 force_destroy
3907 end
3908 else
3909 Precursor {EB_TOOL_MANAGER}
3910 if context_refreshing_timer /= Void then
3911 context_refreshing_timer.destroy
3912 context_refreshing_timer := Void
3913 end
3914 end
3915 end
3916 end
3917
3918 terminate_external_command_and_destroy is
3919 -- Terminate running external command and destroy.
3920 do
3921 process_manager.terminate_external_command
3922 destroy
3923 ensure
3924 external_command_not_running: not process_manager.is_external_command_running
3925 end
3926
3927 save_and_destroy is
3928 do
3929 save_text
3930 destroy
3931 end
3932
3933 force_destroy is
3934 -- Destroy without asking.
3935 do
3936 confirmed := True
3937 destroy
3938 confirmed := False
3939 end
3940
3941 confirmed: BOOLEAN
3942 -- Did the user say he wanted to exit?
3943
3944 show_dynamic_library_dialog is
3945 -- Create a new dynamic library window and display it.
3946 do
3947 Window_manager.create_dynamic_lib_window
3948 end
3949
3950 context_refreshing_timer: EV_TIMEOUT
3951 -- Timer to refresh feature tree address bar.
3952
3953 on_viewpoint_changed is
3954 -- Switch viewpoint.
3955 local
3956 l_formatter: EB_CLASS_TEXT_FORMATTER
3957 l_line: INTEGER
3958 do
3959 l_formatter := selected_formatter
3960 if l_formatter.button.is_sensitive and then l_formatter /= managed_main_formatters.first then
3961 l_line := editor_tool.text_area.first_line_displayed
3962 l_formatter.execute
3963 editor_tool.text_area.display_line_at_top_when_ready (l_line)
3964 end
3965 end
3966
3967 selected_formatter: EB_CLASS_TEXT_FORMATTER is
3968 -- Current selected formatter
3969 local
3970 l_end : BOOLEAN
3971 l_index: INTEGER
3972 l_formatter: like managed_main_formatters
3973 do
3974 l_formatter := managed_main_formatters
3975 l_index := l_formatter.index
3976 from
3977 l_formatter.start
3978 until
3979 l_formatter.after or l_end
3980 loop
3981 if l_formatter.item.selected then
3982 l_end := true
3983 Result := l_formatter.item
3984 end
3985 l_formatter.forth
3986 end
3987 l_formatter.go_i_th (l_index)
3988 end
3989
3990 feature -- Recycle
3991
3992 recycle is
3993 -- Call the precursors.
3994 do
3995 recycle_command
3996 recycle_formatters
3997 recycle_menu
3998 Precursor {EB_TOOL_MANAGER}
3999 save_as_cmd.recycle
4000 open_cmd.recycle
4001 save_cmd.recycle
4002 save_as_cmd := Void
4003 open_cmd := Void
4004 save_cmd := Void
4005 command_controller.recycle
4006 if refactoring_manager /= Void then
4007 refactoring_manager.destroy
4008 end
4009 editor_tool := Void
4010 favorites_tool := Void
4011 properties_tool := Void
4012 history_manager := Void
4013 features_tool := Void
4014 breakpoints_tool := Void
4015 favorites_manager := Void
4016 cluster_manager := Void
4017 search_tool := Void
4018 editors.wipe_out
4019 end
4020
4021 recycle_command is
4022 -- Recycle command
4023 local
4024 os_cmd: EB_ON_SELECTION_COMMAND
4025 do
4026 c_finalized_compilation_cmd.recycle
4027 c_workbench_compilation_cmd.recycle
4028 editor_paste_cmd.recycle
4029 new_class_cmd.recycle
4030 new_cluster_cmd.recycle
4031 new_library_cmd.recycle
4032 new_assembly_cmd.recycle
4033 new_feature_cmd.recycle
4034 shell_cmd.recycle
4035 toggle_feature_alias_cmd.recycle
4036 toggle_feature_assigner_cmd.recycle
4037 toggle_feature_signature_cmd.recycle
4038 undo_cmd.recycle
4039 redo_cmd.recycle
4040 toggle_stone_cmd.recycle
4041 delete_class_cluster_cmd.recycle
4042 print_cmd.recycle
4043 from
4044 show_tool_commands.start
4045 until
4046 show_tool_commands.after
4047 loop
4048 show_tool_commands.item.recycle
4049 show_tool_commands.forth
4050 end
4051 show_tool_commands.wipe_out
4052 show_tool_commands := Void
4053
4054 from
4055 toolbarable_commands.start
4056 until
4057 toolbarable_commands.after
4058 loop
4059 os_cmd ?= toolbarable_commands.item
4060 if os_cmd /= Void then
4061 os_cmd.recycle
4062 end
4063 toolbarable_commands.forth
4064 end
4065
4066 c_finalized_compilation_cmd := Void
4067 c_finalized_compilation_cmd := Void
4068 new_class_cmd := Void
4069 new_cluster_cmd := Void
4070 new_feature_cmd := Void
4071 shell_cmd := Void
4072 toggle_feature_alias_cmd := Void
4073 toggle_feature_assigner_cmd := Void
4074 toggle_feature_signature_cmd := Void
4075 undo_cmd := Void
4076 redo_cmd := Void
4077 toggle_stone_cmd := Void
4078 delete_class_cluster_cmd := Void
4079 print_cmd := Void
4080 end
4081
4082 recycle_formatters is
4083 -- Recycle formatters
4084 do
4085 from
4086 managed_class_formatters.start
4087 until
4088 managed_class_formatters.after
4089 loop
4090 if managed_class_formatters.item /= Void then
4091 managed_class_formatters.item.recycle
4092 end
4093 managed_class_formatters.forth
4094 end
4095
4096 from
4097 managed_feature_formatters.start
4098 until
4099 managed_feature_formatters.after
4100 loop
4101 if managed_feature_formatters.item /= Void then
4102 managed_feature_formatters.item.recycle
4103 end
4104 managed_feature_formatters.forth
4105 end
4106
4107 from
4108 managed_main_formatters.start
4109 until
4110 managed_main_formatters.after
4111 loop
4112 if managed_main_formatters.item /= Void then
4113 managed_main_formatters.item.recycle
4114 end
4115 managed_main_formatters.forth
4116 end
4117 end
4118
4119 recycle_menu is
4120 --
4121 do
4122 tools_menu.destroy
4123 window_menu.destroy
4124 metric_menu.destroy
4125 -- compile_menu.destroy
4126 debug_menu.destroy
4127 debugging_tools_menu.destroy
4128 favorites_menu.destroy
4129 view_menu.destroy
4130
4131 tools_menu := Void
4132 window_menu := Void
4133 metric_menu := Void
4134 format_menu := Void
4135 compile_menu := Void
4136 debug_menu := Void
4137 debugging_tools_menu := Void
4138 favorites_menu := Void
4139 view_menu := Void
4140 end
4141
4142
4143 feature {NONE} -- Implementation: Editor commands
4144
4145 refresh_cursor_position is
4146 -- Display the current cursor position in the status bar.
4147 require
4148 text_loaded: not is_empty
4149 local
4150 l, c, v: INTEGER
4151 do
4152 l := editor_tool.text_area.cursor_y_position
4153 c := editor_tool.text_area.cursor_x_position
4154 v := editor_tool.text_area.cursor_visible_x_position
4155 status_bar.set_cursor_position (l, c, v)
4156 end
4157
4158 refresh_context_info is
4159 -- Refresh address bar and features tool to relect
4160 -- where in the code the cursor is located.
4161 local
4162 l_feature: FEATURE_AS
4163 l_classc_stone: CLASSC_STONE
4164 do
4165 context_refreshing_timer.set_interval (0)
4166 l_classc_stone ?= stone
4167 if l_classc_stone /= Void then
4168 l_feature := editor_tool.text_area.text_displayed.current_feature_containing
4169 if l_feature /= Void then
4170 set_editing_location_by_feature (l_feature)
4171 else
4172 set_editing_location_by_feature (Void)
4173 end
4174 end
4175 end
4176
4177 set_editing_location_by_feature (a_feature: FEATURE_AS) is
4178 -- Set editing location, feature tool and combo box changes according to `a_feature'.
4179 local
4180 l_efeature: E_FEATURE
4181 l_class_i: CLASS_I
4182 l_classc: CLASS_C
4183 do
4184 if a_feature /= Void then
4185 address_manager.set_feature_text_simply (a_feature.feature_names.first.internal_name)
4186 l_class_i := eiffel_universe.safe_class_named (class_name, group)
4187 if l_class_i /= Void and then l_class_i.is_compiled then
4188 l_classc := l_class_i.compiled_class
4189 if l_classc.has_feature_table then
4190 l_efeature := l_classc.feature_with_name (a_feature.feature_names.first.internal_name)
4191 if l_efeature /= Void and then l_efeature.written_in /= l_classc.class_id then
4192 l_efeature := Void
4193 end
4194 end
4195 end
4196 if l_efeature /= Void then
4197 seek_item_in_feature_tool (l_efeature)
4198 else
4199 features_tool.seek_ast_item_in_feature_tool (a_feature.feature_names.first.internal_name)
4200 end
4201 else
4202 address_manager.set_feature_text_simply (once "")
4203 seek_item_in_feature_tool (Void)
4204 end
4205 end
4206
4207 seek_item_in_feature_tool (a_feature: E_FEATURE) is
4208 -- Seek and select item contains data of `a_feature' in features tool.
4209 -- If `a_feature' is void, deselect item in features tool.
4210 do
4211 features_tool.seek_item_in_feature_tool (a_feature)
4212 end
4213
4214 select_all is
4215 -- Select the whole text in the focused editor.
4216 do
4217 current_editor.select_all
4218 end
4219
4220 search is
4221 -- Search some text in the focused editor.
4222 local
4223 cv_ced: EB_CLICKABLE_EDITOR
4224 do
4225 cv_ced ?= current_editor
4226 if cv_ced /= Void then
4227 cv_ced.search
4228 end
4229 end
4230
4231 goto is
4232 -- Display a dialog to select a line to go to in the editor.
4233 local
4234 ed: EB_EDITOR
4235 do
4236 ed ?= current_editor
4237 if ed /= Void then
4238 create goto_dialog.make (ed)
4239 goto_dialog.show_modal_to_window (Current.window)
4240 end
4241 end
4242
4243 toggle_line_number_display is
4244 -- Toggle line number display on/off in editor
4245 do
4246 preferences.editor_data.show_line_numbers_preference.set_value (not preferences.editor_data.show_line_numbers)
4247 end
4248
4249 find_next is
4250 -- Find the next occurrence of the search text.
4251 local
4252 cv_ced: EB_CLICKABLE_EDITOR
4253 do
4254 if search_tool.currently_searched /= Void then
4255 cv_ced ?= current_editor
4256 if cv_ced /= Void then
4257 cv_ced.find_next
4258 end
4259 else
4260 search_tool.show_and_set_focus
4261 end
4262 end
4263
4264 find_previous is
4265 -- Find the previous occurrence of the search text.
4266 local
4267 cv_ced: EB_CLICKABLE_EDITOR
4268 do
4269 if search_tool.currently_searched /= Void then
4270 cv_ced ?= current_editor
4271 if cv_ced /= Void then
4272 cv_ced.find_previous
4273 end
4274 else
4275 search_tool.show_and_set_focus
4276 end
4277 end
4278
4279 find_selection is
4280 -- Find the next occurrence of the selection.
4281 local
4282 cv_ced: EB_CLICKABLE_EDITOR
4283 do
4284 cv_ced ?= current_editor
4285 if cv_ced /= Void then
4286 cv_ced.find_selection
4287 end
4288 end
4289
4290 cut_selection is
4291 -- Cut the selection in the current editor.
4292 do
4293 current_editor.cut_selection
4294 end
4295
4296 copy_selection is
4297 -- Cut the selection in the current editor.
4298 do
4299 current_editor.copy_selection
4300 end
4301
4302 toggle_formatting_marks is
4303 -- Show/Hide formatting marks in the editor and update related menu item.
4304 do
4305 current_editor.toggle_view_invisible_symbols
4306 if current_editor.view_invisible_symbols then
4307 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
4308 else
4309 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
4310 end
4311 end
4312
4313 feature {NONE} -- Implementation / Menus
4314
4315 number_of_displayed_external_commands: INTEGER
4316 -- Number of external commands in the tools menu.
4317
4318 old_cur: EV_POINTER_STYLE
4319 -- Cursor saved while displaying the hourglass cursor.
4320
4321 cur_wid: EV_WIDGET
4322 -- Widget on which the hourglass cursor was set.
4323
4324 project_menu: EV_MENU
4325 -- Menu for entries relative to the Project.
4326
4327 recent_projects_menu: EB_RECENT_PROJECTS_MANAGER_MENU
4328 -- SubMenu for recent projects.
4329
4330 during_synchronization: BOOLEAN
4331 -- Are we during a resynchronization?
4332
4333 formatting_marks_command_menu_item: EB_COMMAND_MENU_ITEM
4334 -- Menu item used to shw/hide formatting marks.
4335
4336 undo_accelerator: EV_ACCELERATOR
4337 -- Accelerator for Ctrl+Z
4338
4339 redo_accelerator: EV_ACCELERATOR
4340 -- Accelerator for Ctrl+Y
4341
4342 feature {EB_TOOL} -- Implementation / Commands
4343
4344 shell_cmd: EB_OPEN_SHELL_COMMAND
4345 -- Command to use an external editor.
4346
4347 undo_cmd: EB_UNDO_COMMAND
4348 -- Command to undo in the editor.
4349
4350 redo_cmd: EB_REDO_COMMAND
4351 -- Command to redo in the editor.
4352
4353 editor_paste_cmd: EB_EDITOR_PASTE_COMMAND
4354 -- Command to paste text in the editor.
4355
4356 melt_cmd: EB_MELT_PROJECT_COMMAND
4357 -- Command to start compilation.
4358
4359 feature{EB_TOOL, EB_C_COMPILER_LAUNCHER}
4360
4361 c_workbench_compilation_cmd: EB_C_COMPILATION_COMMAND
4362 -- Command to compile the workbench C code.
4363
4364 c_finalized_compilation_cmd: EB_C_COMPILATION_COMMAND
4365 -- Command to compile the finalized C code.
4366
4367 feature{EB_TOOL}
4368
4369 new_cluster_cmd: EB_NEW_CLUSTER_COMMAND
4370 -- Command to create a new cluster.
4371
4372 new_library_cmd: EB_NEW_LIBRARY_COMMAND
4373 -- Command to create a new library.
4374
4375 new_assembly_cmd: EB_NEW_ASSEMBLY_COMMAND
4376 -- Command to create a new assembly.
4377
4378 new_class_cmd: EB_NEW_CLASS_COMMAND
4379 -- Command to create a new class.
4380
4381 new_feature_cmd: EB_NEW_FEATURE_COMMAND
4382 -- Command to execute the feature wizard.
4383
4384 toggle_feature_alias_cmd: EB_TOGGLE_FEATURE_ALIAS_COMMAND
4385 -- Show/Hide alias name of feature node in eb_feature_tool
4386
4387 toggle_feature_signature_cmd: EB_TOGGLE_FEATURE_SIGNATURE_COMMAND
4388 -- Show/Hide signature of feature node in eb_feature_tool
4389
4390 toggle_feature_assigner_cmd: EB_TOGGLE_FEATURE_ASSIGNER_COMMAND
4391 -- Show/Hide assigner name of feature node in eb_feature_tool
4392
4393 toggle_stone_cmd: EB_UNIFY_STONE_CMD
4394 -- Command to toggle between the stone management modes.
4395
4396 delete_class_cluster_cmd: EB_DELETE_CLASS_CLUSTER_COMMAND
4397 -- Command to remove a class or a cluster from the system
4398 -- (permanent deletion).
4399
4400 show_profiler: EB_SHOW_PROFILE_TOOL
4401 -- What allows us to display the profiler window.
4402
4403 toolbarable_commands: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
4404 -- All commands that can be put in a toolbar.
4405
4406 command_controller: EB_EDITOR_COMMAND_CONTROLLER
4407 -- Object that takes care of updating the sensitivity of all editor commands.
4408
4409 save_as_cmd: EB_SAVE_FILE_AS_COMMAND
4410 -- Command to save a class with a different file name.
4411
4412 feature{EB_TOOL, EB_EXTERNAL_OUTPUT_TOOL}
4413
4414 Edit_external_commands_cmd: EB_EXTERNAL_COMMANDS_EDITOR is
4415 -- Command that lets the user add new external commands to the tools menu.
4416 once
4417 create Result.make
4418 Result.enable_sensitive
4419 end
4420
4421 feature{EB_TOOL}
4422
4423 system_info_cmd: EB_STANDARD_CMD is
4424 -- Command to display information about the system (root class,...)
4425 do
4426 Result := Eb_debugger_manager.system_info_cmd
4427 end
4428
4429 display_error_help_cmd: EB_ERROR_INFORMATION_CMD is
4430 -- Command to pop up a dialog giving help on compilation errors.
4431 do
4432 Result := Eb_debugger_manager.display_error_help_cmd
4433 end
4434
4435 send_stone_to_context_cmd: EB_STANDARD_CMD
4436 -- Command to send the current stone to the context tool.
4437
4438 print_cmd: EB_PRINT_COMMAND
4439 -- Command to print the content of editor with focus
4440
4441 eac_browser_cmd: EB_OPEN_EAC_BROWSER_CMD is
4442 -- Command to display the eac browser
4443 do
4444 Result := Eb_debugger_manager.eac_browser_cmd
4445 end
4446
4447 show_favorites_menu_item: EV_MENU_ITEM
4448 -- Show/Hide favorites menu item.
4449
4450 update_show_favorites_menu_item is
4451 -- Update `show_favorites_menu_item' menu label.
4452 do
4453 if favorites_tool.shown then
4454 show_favorites_menu_item.set_text (Interface_names.m_hide_favorites)
4455 else
4456 show_favorites_menu_item.set_text (Interface_names.m_show_favorites)
4457 end
4458 end
4459
4460 execute_show_favorites is
4461 -- Show `favorites_tool' if it is closed, close
4462 -- it in the opposite case.
4463 do
4464 update_show_favorites_menu_item
4465 if favorites_tool.shown then
4466 favorites_tool.close
4467 else
4468 favorites_tool.show
4469 end
4470 end
4471
4472 feature {EB_TOOL_WINDOW, EB_EXPLORER_BAR, EB_DEBUGGER_MANAGER} -- Floating tool handling
4473
4474 all_tool_windows: ARRAYED_LIST [EB_TOOL_WINDOW]
4475 -- All tool windows under the control of `Current'.
4476
4477 add_tool_window (a_tool_window: EB_TOOL_WINDOW) is
4478 -- Add `a_tool_window' to `all_tool_windows', ensuring it is
4479 -- then under the control of `Current'.
4480 require
4481 a_tool_window_not_void: a_tool_window /= Void
4482 do
4483 if all_tool_windows = Void then
4484 create all_tool_windows.make (2)
4485 end
4486 all_tool_windows.extend (a_tool_window)
4487 ensure
4488 extended: all_tool_windows.has (a_tool_window)
4489 end
4490
4491 remove_tool_window (a_widget: EV_WIDGET) is
4492 -- Remove tool window associate with `a_widget'.
4493 require
4494 a_widget_not_void: a_widget /= Void
4495 do
4496 if all_tool_windows /= Void then
4497 from
4498 all_tool_windows.start
4499 until
4500 all_tool_windows.off
4501 loop
4502 if all_tool_windows.item.tool = a_widget then
4503 all_tool_windows.remove
4504 all_tool_windows.finish
4505 end
4506 all_tool_windows.forth
4507 end
4508 end
4509 end
4510
4511 remove_all_tool_windows is
4512 -- Ensure `all_tool_windows' is empty if non Void.
4513 do
4514 if all_tool_windows /= Void then
4515 all_tool_windows.wipe_out
4516 end
4517 ensure
4518 tool_windows_empty: all_tool_windows /= Void implies all_tool_windows.is_empty
4519 end
4520
4521 window_moved (x_pos, y_pos: INTEGER) is
4522 -- `Current' has been moved, so move all associated tool windows within `all_tool_windows'.
4523 local
4524 tool_window: EB_TOOL_WINDOW
4525 do
4526 if all_tool_windows /= Void then
4527 from
4528 all_tool_windows.start
4529 until
4530 all_tool_windows.off
4531 loop
4532 tool_window := all_tool_windows.item
4533 check
4534 not_destroyed: not tool_window.window.is_destroyed
4535 end
4536 if preferences.development_window_data.dock_tracking then
4537 tool_window.window.move_actions.block
4538 tool_window.window.set_x_position (x_pos + tool_window.x_position)
4539 tool_window.window.set_y_position (y_pos + tool_window.y_position)
4540 tool_window.window.move_actions.resume
4541 else
4542 -- If we are not performing dock tracking, we must update the relative position
4543 -- of the tool window, so that if dock tracking is enabled, the relative
4544 -- positions are correct.
4545 tool_window.set_x_position ( tool_window.window.screen_x - x_pos)
4546 tool_window.set_y_position ( tool_window.window.screen_y - y_pos)
4547 end
4548 all_tool_windows.forth
4549 end
4550 end
4551 end
4552
4553 feature {NONE} -- Execution
4554
4555 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
4556 -- Action called when the user right-click in the toolbar.
4557 -- Display a popup menu to show/hide toolbars and customize the general toolbar.
4558 local
4559 popup_menu: EV_MENU
4560 do
4561 if a_button = 3 then
4562 popup_menu := build_toolbar_menu
4563 popup_menu.show
4564 end
4565 end
4566
4567 enable_commands_on_project_created is
4568 -- Enable commands when a new project has been created (not yet compiled)
4569 do
4570 system_info_cmd.enable_sensitive
4571 if
4572 stone /= Void and then
4573 not unified_stone
4574 then
4575 send_stone_to_context_cmd.enable_sensitive
4576 end
4577 end
4578
4579 enable_commands_on_project_loaded is
4580 -- Enable commands when a new project has been created and compiled
4581 do
4582 if has_profiler then
4583 show_profiler.enable_sensitive
4584 end
4585 if has_dll_generation then
4586 show_dynamic_lib_tool.enable_sensitive
4587 end
4588 open_cmd.enable_sensitive
4589 new_class_cmd.enable_sensitive
4590 new_cluster_cmd.enable_sensitive
4591 new_library_cmd.enable_sensitive
4592 new_assembly_cmd.enable_sensitive
4593 system_info_cmd.enable_sensitive
4594 if unified_stone then
4595 send_stone_to_context_cmd.disable_sensitive
4596 elseif stone /= Void then
4597 send_stone_to_context_cmd.enable_sensitive
4598 end
4599 new_class_cmd.enable_sensitive
4600 new_cluster_cmd.enable_sensitive
4601 delete_class_cluster_cmd.enable_sensitive
4602 c_workbench_compilation_cmd.enable_sensitive
4603 c_finalized_compilation_cmd.enable_sensitive
4604 refactoring_manager.enable_sensitive
4605 end
4606
4607 disable_commands_on_project_unloaded is
4608 -- Enable commands when a project has been closed.
4609 do
4610 if has_dll_generation then
4611 show_dynamic_lib_tool.disable_sensitive
4612 end
4613 if has_profiler then
4614 show_profiler.disable_sensitive
4615 end
4616 open_cmd.disable_sensitive
4617 new_class_cmd.disable_sensitive
4618 new_cluster_cmd.disable_sensitive
4619 new_library_cmd.disable_sensitive
4620 new_assembly_cmd.disable_sensitive
4621 if not project_manager.is_created then
4622 system_info_cmd.disable_sensitive
4623 send_stone_to_context_cmd.disable_sensitive
4624 end
4625 delete_class_cluster_cmd.disable_sensitive
4626 c_workbench_compilation_cmd.disable_sensitive
4627 c_finalized_compilation_cmd.disable_sensitive
4628 refactoring_manager.disable_sensitive
4629 refactoring_manager.forget_undo_redo
4630 end
4631
4632 feature {NONE} -- Access
4633
4634 development_window_data: EB_DEVELOPMENT_WINDOW_DATA is
4635 -- Meta data describing `Current'.
4636 do
4637 if internal_development_window_data /= Void then
4638 Result := internal_development_window_data
4639 else
4640 Result := preferences.development_window_data
4641 end
4642 end
4643
4644 internal_development_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA;
4645 -- Internal custom meta data for `Current'.
4646
4647 feature {NONE} -- Implementation
4648
4649 is_string_started_by (s1, s2: STRING_GENERAL): BOOLEAN is
4650 -- Is `s1' starting by `s2' characters
4651 require
4652 s2_not_void: s2 /= Void
4653 local
4654 i: INTEGER
4655 do
4656 if s1 /= Void and then s1.count >= s2.count then
4657 from
4658 i := 1
4659 Result := True
4660 until
4661 i > s2.count or not Result
4662 loop
4663 Result := s1.code (i) = s2.code (i)
4664 i := i + 1
4665 end
4666 end
4667 end
4668
4669 indexing
4670 copyright: "Copyright (c) 1984-2006, Eiffel Software"
4671 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
4672 licensing_options: "http://www.eiffel.com/licensing"
4673 copying: "[
4674 This file is part of Eiffel Software's Eiffel Development Environment.
4675
4676 Eiffel Software's Eiffel Development Environment is free
4677 software; you can redistribute it and/or modify it under
4678 the terms of the GNU General Public License as published
4679 by the Free Software Foundation, version 2 of the License
4680 (available at the URL listed under "license" above).
4681
4682 Eiffel Software's Eiffel Development Environment is
4683 distributed in the hope that it will be useful, but
4684 WITHOUT ANY WARRANTY; without even the implied warranty
4685 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4686 See the GNU General Public License for more details.
4687
4688 You should have received a copy of the GNU General Public
4689 License along with Eiffel Software's Eiffel Development
4690 Environment; if not, write to the Free Software Foundation,
4691 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
4692 ]"
4693 source: "[
4694 Eiffel Software
4695 356 Storke Road, Goleta, CA 93117 USA
4696 Telephone 805-685-1006, Fax 805-685-6869
4697 Website http://www.eiffel.com
4698 Customer support http://support.eiffel.com
4699 ]"
4700
4701 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