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