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