/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
ViewVC logotype

Annotation of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 56237 - (hide annotations)
Tue Dec 20 17:12:15 2005 UTC (14 years, 2 months ago) by tedf
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 122855 byte(s)
Fixed that when pointer pressing a feature in the tree it locates the feature in the text, but after that cursor moving may cause feature locating in the tree, consequently the second feature of a body sharing feature never be selected in the tree.

1 manus 26913 indexing
2     description : "Window holding a project tool"
3     date : "$Date$"
4     revision : "$Revision$"
5 jfiat 54401 author : "$Author$"
6 manus 26913
7     class
8     EB_DEVELOPMENT_WINDOW
9    
10     inherit
11     EB_TOOL_MANAGER
12     redefine
13     make,
14     init_size_and_position,
15 rogers 40708 window_displayed,
16 manus 26913 init_commands,
17     build_menu_bar,
18     build_menus,
19     build_file_menu,
20     build_edit_menu,
21     build_view_menu,
22     build_tools_menu,
23     build_favorites_menu,
24     refresh,
25 xavier 27860 recycle,
26 manus 26913 destroy_imp,
27 tedf 55179 destroy,
28     position,
29     pos_container
30 manus 26913 end
31    
32     EB_FILEABLE
33 tedf 55179 export {NONE}
34     set_position,
35     set_pos_container
36 manus 26913 redefine
37     set_stone,
38     reset,
39     stone,
40     on_text_saved,
41     perform_check_before_save,
42     check_passed,
43 tedf 55179 update_save_symbol,
44     position,
45     pos_container
46 manus 26913 select
47     set_stone
48     end
49    
50     EB_FILEABLE
51     rename
52     set_stone as old_set_stone
53     export {NONE}
54 tedf 55179 old_set_stone,
55     set_position,
56     set_pos_container
57 manus 26913 redefine
58     reset,
59     stone,
60     on_text_saved,
61     perform_check_before_save,
62     check_passed,
63 tedf 55179 update_save_symbol,
64     position,
65     pos_container
66 manus 26913 end
67    
68    
69     -- Shared tools & contexts
70     SHARED_APPLICATION_EXECUTION
71    
72     SHARED_EIFFEL_PROJECT
73    
74     PROJECT_CONTEXT
75    
76     EB_SHARED_MANAGERS
77    
78     EB_SHARED_GRAPHICAL_COMMANDS
79    
80 neilc 49534 EB_SHARED_PREFERENCES
81 xavier 30020 export
82     {NONE} all
83     end
84 manus 26913
85     EV_STOCK_PIXMAPS
86    
87     EB_CONFIRM_SAVE_CALLBACK
88    
89     -- Errors
90     EB_GRAPHICAL_ERROR_MANAGER
91    
92     TEXT_OBSERVER
93     redefine
94 manus 51111 on_text_reset, on_text_edited,
95 xavier 27840 on_text_back_to_its_last_saved_state,
96 xavier 29812 on_text_fully_loaded, on_cursor_moved
97 manus 26913 end
98 manus 51111
99 manus 26913 EV_KEY_CONSTANTS
100     export
101     {NONE} All
102     end
103 manus 51111
104 neilc 49534 EIFFEL_ENV
105     export
106     {NONE} All
107     end
108 manus 51111
109 manus 47824 SHARED_TEXT_ITEMS
110     export
111     {NONE} All
112     end
113 manus 26913
114 julieng 37686 create {EB_WINDOW_MANAGER}
115 manus 26913 make,
116 king 55319 make_with_session_data,
117 manus 26913 make_as_context_tool,
118     make_as_editor
119    
120     feature {NONE} -- Initialization
121    
122     make_as_context_tool is
123     -- Create a new development window and expand the context tool.
124     do
125     make
126 rogers 40708 -- Perform window setting from `show_actions', as the
127     -- resizing executed as a result only works correctly
128     -- while the window is displayed.
129     window.show_actions.extend (agent set_context_mode)
130     end
131 manus 51111
132 rogers 40708 set_context_mode is
133     -- Set `current' into context mode, that is the context tool
134     -- maximized, and the non editor panel is hidden.
135     do
136 manus 26913 if not context_tool.shown then
137     context_tool.show
138     end
139     if not unified_stone then
140     toggle_stone_cmd.execute
141     end
142     context_tool.explorer_bar_item.maximize
143 rogers 40708 close_all_bars_except (right_panel)
144 manus 26913 end
145    
146     make_as_editor is
147     -- Create a new development window and expand the editor tool.
148     do
149     make
150 rogers 40708 -- Perform window setting from `show_actions', as the resizing executed
151     -- must be performed after `current' is displayed.
152     window.show_actions.extend (agent (editor_tool.explorer_bar_item).maximize)
153     window.show_actions.extend (agent close_all_bars_except (right_panel))
154 manus 26913 end
155    
156 king 55319 make_with_session_data (a_session_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA) is
157     -- Recreate a previously existing development window using `a_session_data'.
158     local
159     l_class_i: CLASS_I
160     l_class_c_stone: CLASSC_STONE
161     l_cluster_string, l_class_string, l_feature_string: STRING
162     do
163     internal_development_window_data := a_session_data
164 manus 55527 make
165 king 55319 -- Attempt to reload last edited class of `Current'.
166     if a_session_data.file_name /= Void then
167     l_class_i := eiffel_universe.class_with_file_name (a_session_data.file_name)
168     if l_class_i /= Void and then l_class_i.compiled then
169     -- Create compiled class stone and target `Current' to it.
170     create l_class_c_stone.make (l_class_i.compiled_class)
171     set_stone_after_check (l_class_c_stone)
172     if a_session_data.editor_position > 0 then
173     editor_tool.text_area.display_line_when_ready (a_session_data.editor_position, False)
174     end
175     end
176     end
177     if context_tool /= Void then
178     -- Presumption is made that if the strings are not void then they represent
179     -- valid entities in the project.
180     l_cluster_string := a_session_data.context_cluster_string
181     l_class_string := a_session_data.context_class_string
182     l_feature_string := a_session_data.context_feature_string
183     if l_feature_string /= Void then
184     context_tool.address_manager.feature_address.set_text (l_feature_string)
185     context_tool.address_manager.class_address.set_text (l_class_string)
186     context_tool.address_manager.execute_with_feature
187     elseif l_class_string /= Void then
188     context_tool.address_manager.class_address.set_text (l_class_string)
189     context_tool.address_manager.execute_with_class
190     elseif l_cluster_string /= Void then
191     context_tool.address_manager.cluster_address.set_text (l_cluster_string)
192     context_tool.address_manager.execute_with_cluster
193     end
194     -- Set the appropriate notebook tab
195     context_tool.notebook.select_item (context_tool.notebook [a_session_data.context_tab_index])
196     end
197     end
198    
199 manus 26913 make is
200     -- Create a new development window.
201     do
202 neilc 50976 unified_stone := preferences.development_window_data.context_unified_stone
203 manus 26913 -- Build the history manager, the address manager, ...
204     create history_manager.make (Current)
205     create address_manager.make (Current, False)
206     build_formatters
207     address_manager.set_formatters (managed_main_formatters)
208    
209     -- Init commands, build interface, build menus, ...
210     Precursor
211    
212     initialized := False -- Reset the flag since initialization is not yet complete.
213 xavier 28303 set_up_accelerators
214 manus 51111
215 neilc 51796 window.focus_in_actions.extend(agent on_focus)
216    
217 xavier 28514 -- Create the toolbars.
218     build_toolbars_area
219     container.put_front (toolbars_area)
220     container.disable_item_expand (toolbars_area)
221 manus 26913
222     -- Update widgets visibilities
223 rogers 40708 window.show_actions.extend (agent update)
224 xavier 29812 status_bar.remove_cursor_position
225 xavier 29871 address_manager.set_output_line (status_bar.label)
226 manus 26913
227     -- Finish initializing the main editor formatters
228     end_build_formatters
229 manus 51111
230 xavier 28280 address_manager.disable_formatters
231 xavier 28303 if Eiffel_project.manager.is_project_loaded then
232 xavier 28304 on_project_created
233 xavier 28303 on_project_loaded
234 xavier 28304 elseif Eiffel_project.manager.is_created then
235     on_project_unloaded
236     on_project_created
237 xavier 28303 else
238     on_project_unloaded
239     end
240 manus 51111
241 neilc 33858 -- Create feature position table
242     create feature_positions.make (1)
243     feature_positions.compare_objects
244 manus 51111
245 rogers 40708 window.move_actions.force_extend (agent window_moved)
246 manus 26913
247     initialized := True
248     is_destroying := False
249     end
250 manus 51111
251 manus 26913 init_size_and_position is
252     -- Initialize window size.
253     local
254 manus 52172 screen: EB_STUDIO_SCREEN
255     l_x, l_y: INTEGER
256 manus 26913 do
257     create screen
258 manus 51180 window.set_size (
259 king 55319 development_window_data.width.min (screen.width),
260     development_window_data.height.min (screen.height))
261     l_x := development_window_data.x_position
262 manus 52172 if l_x < screen.virtual_left or l_x > screen.virtual_right then
263     -- Somehow screens have changed, reset it to 0
264     l_x := 0
265     end
266 king 55319 l_y := development_window_data.y_position
267 manus 52172 if l_y < screen.virtual_top or l_y > screen.virtual_bottom then
268     -- Somehow screens have changed, reset it to 0
269     l_y := 0
270     end
271     window.set_position (l_x, l_y)
272 rogers 40708 end
273 manus 51111
274 rogers 40708 window_displayed is
275     -- `Current' has been displayed on screen.
276     do
277 king 55319 -- Minimize or Maximize window if needed.
278     if development_window_data.is_maximized then
279 manus 26913 window.maximize
280 king 55319 elseif development_window_data.is_minimized then
281     window.minimize
282 manus 26913 end
283     end
284    
285     init_commands is
286     -- Initialize commands.
287 xavier 27498 local
288     accel: EV_ACCELERATOR
289 manus 26913 do
290     Precursor
291     create toolbarable_commands.make (15)
292    
293     -- Open, save, ...
294     toolbarable_commands.extend (new_editor_cmd)
295    
296     toolbarable_commands.extend (new_context_tool_cmd)
297    
298     create open_cmd.make (Current)
299     toolbarable_commands.extend (open_cmd)
300    
301     create save_cmd.make (Current)
302     toolbarable_commands.extend (save_cmd)
303    
304     create save_as_cmd.make (Current)
305     if editor_tool = Void or else editor_tool.text_area.is_empty then
306     save_as_cmd.disable_sensitive
307     else
308     save_as_cmd.enable_sensitive
309     end
310    
311     create shell_cmd.make (Current)
312     toolbarable_commands.extend (shell_cmd)
313    
314     create print_cmd.make (Current)
315     if is_empty then
316     print_cmd.disable_sensitive
317     else
318     print_cmd.enable_sensitive
319     end
320     toolbarable_commands.extend (print_cmd)
321    
322     -- Compilation
323     create c_workbench_compilation_cmd.make_workbench (Current)
324     create c_finalized_compilation_cmd.make_finalized (Current)
325 xavier 27549 if has_dll_generation then
326     create show_dynamic_lib_tool.make
327 manus 51111 show_dynamic_lib_tool.set_menu_name (Interface_names.m_new_dynamic_lib)
328 manus 36309 show_dynamic_lib_tool.add_agent (agent show_dynamic_library_dialog)
329 xavier 27549 end
330     if has_profiler then
331     create show_profiler
332     end
333 manus 26913
334     -- Undo/redo, cut, copy, paste.
335     create undo_cmd.make (Current)
336     toolbarable_commands.extend (undo_cmd)
337    
338     create redo_cmd.make (Current)
339     toolbarable_commands.extend (redo_cmd)
340    
341     create editor_paste_cmd.make (Current)
342     toolbarable_commands.extend (editor_paste_cmd)
343    
344     create new_cluster_cmd.make (Current)
345     toolbarable_commands.extend (new_cluster_cmd)
346    
347     create new_class_cmd.make (Current)
348     toolbarable_commands.extend (new_class_cmd)
349    
350     create delete_class_cluster_cmd.make (Current)
351     toolbarable_commands.extend (delete_class_cluster_cmd)
352    
353     create new_feature_cmd.make (Current)
354     toolbarable_commands.extend (new_feature_cmd)
355 manus 51111
356 alexk 51136 create toggle_feature_alias_cmd.make (Current)
357     toolbarable_commands.extend (toggle_feature_alias_cmd)
358    
359 jfiat 42965 create toggle_feature_signature_cmd.make (Current)
360 jfiat 42973 toolbarable_commands.extend (toggle_feature_signature_cmd)
361 manus 26913
362 alexk 51887 create toggle_feature_assigner_cmd.make (Current)
363     toolbarable_commands.extend (toggle_feature_assigner_cmd)
364    
365 manus 26913 create toggle_stone_cmd.make (Current)
366     toolbarable_commands.extend (toggle_stone_cmd)
367    
368     create send_stone_to_context_cmd.make
369     send_stone_to_context_cmd.set_pixmaps (Pixmaps.Icon_send_stone_down)
370 manus 51111 send_stone_to_context_cmd.set_tooltip (Interface_names.e_send_stone_to_context)
371     send_stone_to_context_cmd.set_menu_name (Interface_names.m_send_stone_to_context)
372 manus 26913 send_stone_to_context_cmd.set_name ("Send_to_context")
373 manus 51111 send_stone_to_context_cmd.set_tooltext (Interface_names.b_send_stone_to_context)
374 manus 36309 send_stone_to_context_cmd.add_agent (agent send_stone_to_context)
375 xavier 27498 create accel.make_with_key_combination (
376     create {EV_KEY}.make_with_code (Kcst.Key_down), False, True, False
377     )
378 manus 36309 accel.actions.extend (agent send_stone_to_context)
379 xavier 27498 send_stone_to_context_cmd.set_accelerator (accel)
380 manus 26913 send_stone_to_context_cmd.disable_sensitive
381     toolbarable_commands.extend (send_stone_to_context_cmd)
382    
383     toolbarable_commands.extend (window_manager.minimize_all_cmd)
384     window_manager.minimize_all_cmd.enable_sensitive
385     toolbarable_commands.extend (window_manager.raise_all_cmd)
386     window_manager.raise_all_cmd.enable_sensitive
387    
388     toolbarable_commands.extend (New_development_window_cmd)
389     -- Show tool/toolbar commands (will be filled when tools will
390     -- be created)
391     create show_tool_commands.make (7)
392     create show_toolbar_commands.make (3)
393    
394 xavier 28303 new_feature_cmd.disable_sensitive
395 alexk 51136 toggle_feature_alias_cmd.disable_sensitive
396 jfiat 42965 toggle_feature_signature_cmd.disable_sensitive
397 alexk 51887 toggle_feature_assigner_cmd.disable_sensitive
398 xavier 28303
399     create editors.make (5)
400 larryl 54857 estudio_debug_cmd.set_main_window (window)
401 xavier 28303 end
402    
403     set_up_accelerators is
404     -- Fill the accelerator of `window' with the accelerators of the `toolbarable_commands'.
405     do
406 jfiat 54580 --| Accelerators related to toolbarable_commands
407 manus 26913 from
408     toolbarable_commands.start
409     until
410     toolbarable_commands.after
411     loop
412     if toolbarable_commands.item.accelerator /= Void then
413     window.accelerators.extend (toolbarable_commands.item.accelerator)
414     end
415     toolbarable_commands.forth
416     end
417    
418 jfiat 54580 --| Accelerators related to debugging toolbarable_commands
419 manus 26913 from
420     debugger_manager.toolbarable_commands.start
421     until
422     debugger_manager.toolbarable_commands.after
423     loop
424     if
425     debugger_manager.toolbarable_commands.item.accelerator /= Void
426     then
427     window.accelerators.extend (debugger_manager.toolbarable_commands.item.accelerator)
428     end
429     debugger_manager.toolbarable_commands.forth
430     end
431     end
432    
433     build_formatters is
434     -- Build all formatters used.
435     local
436     form: EB_CLASS_TEXT_FORMATTER
437     accel: EV_ACCELERATOR
438     do
439 neilc 33294 create managed_class_formatters.make (17)
440 manus 26913 managed_class_formatters.extend (create {EB_CLICKABLE_FORMATTER}.make (Current))
441     managed_class_formatters.extend (create {EB_FLAT_FORMATTER}.make (Current))
442     managed_class_formatters.extend (create {EB_SHORT_FORMATTER}.make (Current))
443     managed_class_formatters.extend (create {EB_FLAT_SHORT_FORMATTER}.make (Current))
444     managed_class_formatters.extend (Void)
445     managed_class_formatters.extend (create {EB_ANCESTORS_FORMATTER}.make (Current))
446     managed_class_formatters.extend (create {EB_DESCENDANTS_FORMATTER}.make (Current))
447     managed_class_formatters.extend (create {EB_CLIENTS_FORMATTER}.make (Current))
448     managed_class_formatters.extend (create {EB_SUPPLIERS_FORMATTER}.make (Current))
449     managed_class_formatters.extend (Void)
450     managed_class_formatters.extend (create {EB_ATTRIBUTES_FORMATTER}.make (Current))
451     managed_class_formatters.extend (create {EB_ROUTINES_FORMATTER}.make (Current))
452 manus 54560 managed_class_formatters.extend (create {EB_INVARIANTS_FORMATTER}.make (Current))
453 manus 54538 managed_class_formatters.extend (create {EB_CREATORS_FORMATTER}.make (Current))
454 manus 26913 managed_class_formatters.extend (create {EB_DEFERREDS_FORMATTER}.make (Current))
455     managed_class_formatters.extend (create {EB_ONCES_FORMATTER}.make (Current))
456     managed_class_formatters.extend (create {EB_EXTERNALS_FORMATTER}.make (Current))
457     managed_class_formatters.extend (create {EB_EXPORTED_FORMATTER}.make (Current))
458    
459 manus 48565 create managed_feature_formatters.make (12)
460 manus 26913 managed_feature_formatters.extend (create {EB_BASIC_FEATURE_FORMATTER}.make (Current))
461     managed_feature_formatters.extend (create {EB_ROUTINE_FLAT_FORMATTER}.make (Current))
462     managed_feature_formatters.extend (Void)
463 manus 48565 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current, 0))
464     managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
465 manus 49446 {DEPEND_UNIT}.is_in_assignment_flag))
466 manus 51111 managed_feature_formatters.extend (create {EB_CALLERS_FORMATTER}.make (Current,
467 manus 49446 {DEPEND_UNIT}.is_in_creation_flag))
468 manus 48565 managed_feature_formatters.extend (Void)
469 manus 26913 managed_feature_formatters.extend (create {EB_IMPLEMENTERS_FORMATTER}.make (Current))
470     managed_feature_formatters.extend (create {EB_ROUTINE_ANCESTORS_FORMATTER}.make (Current))
471     managed_feature_formatters.extend (create {EB_ROUTINE_DESCENDANTS_FORMATTER}.make (Current))
472 manus 48565 managed_feature_formatters.extend (Void)
473 manus 26913 managed_feature_formatters.extend (create {EB_HOMONYMS_FORMATTER}.make (Current))
474    
475 manus 51111
476 neilc 33294 create managed_main_formatters.make (6)
477 manus 51111
478 manus 26913 create {EB_BASIC_TEXT_FORMATTER} form.make (Current)
479     create accel.make_with_key_combination (
480     create {EV_KEY}.make_with_code (Kcst.Key_t),
481     True, False, True)
482 manus 36309 accel.actions.extend (agent form.execute)
483 manus 26913 form.set_accelerator (accel)
484     managed_main_formatters.extend (form)
485    
486     create {EB_CLICKABLE_FORMATTER} form.make (Current)
487     create accel.make_with_key_combination (
488     create {EV_KEY}.make_with_code (Kcst.Key_c),
489     True, False, True)
490 manus 36309 accel.actions.extend (agent form.execute)
491 manus 26913 form.set_accelerator (accel)
492     managed_main_formatters.extend (form)
493    
494     create {EB_FLAT_FORMATTER} form.make (Current)
495     create accel.make_with_key_combination (
496     create {EV_KEY}.make_with_code (Kcst.Key_f),
497     True, False, True)
498 manus 36309 accel.actions.extend (agent form.execute)
499 manus 26913 form.set_accelerator (accel)
500     managed_main_formatters.extend (form)
501    
502     create {EB_SHORT_FORMATTER} form.make (Current)
503     create accel.make_with_key_combination (
504     create {EV_KEY}.make_with_code (Kcst.Key_o),
505     True, False, True)
506 manus 36309 accel.actions.extend (agent form.execute)
507 manus 26913 form.set_accelerator (accel)
508     managed_main_formatters.extend (form)
509    
510     create {EB_FLAT_SHORT_FORMATTER} form.make (Current)
511     create accel.make_with_key_combination (
512     create {EV_KEY}.make_with_code (Kcst.Key_i),
513     True, False, True)
514 manus 36309 accel.actions.extend (agent form.execute)
515 manus 26913 form.set_accelerator (accel)
516 manus 51111 managed_main_formatters.extend (form)
517 manus 26913 end
518    
519     end_build_formatters is
520 manus 33315 -- Finish initialization of formatters (associate them with editor
521     -- and select a formatter).
522 manus 26913 local
523     f_ind: INTEGER
524     do
525     from
526     managed_class_formatters.start
527     until
528     managed_class_formatters.after
529     loop
530     if managed_class_formatters.item /= Void then
531     managed_class_formatters.item.set_manager (context_tool)
532     end
533     managed_class_formatters.forth
534     end
535     from
536     managed_feature_formatters.start
537     until
538     managed_feature_formatters.after
539     loop
540     if managed_feature_formatters.item /= Void then
541     managed_feature_formatters.item.set_manager (context_tool)
542     end
543     managed_feature_formatters.forth
544     end
545     from
546     managed_main_formatters.start
547     until
548     managed_main_formatters.after
549     loop
550     managed_main_formatters.item.set_editor (editor_tool.text_area)
551     managed_main_formatters.item.on_shown
552     if managed_main_formatters.item.accelerator /= Void then
553     window.accelerators.extend (managed_main_formatters.item.accelerator)
554     end
555     managed_main_formatters.forth
556     end
557    
558     (managed_main_formatters @ 1).enable_select;
559 manus 51111
560 manus 26913 -- We now select the correct class formatter.
561 neilc 53432 f_ind := preferences.context_tool_data.default_class_formatter_index
562 manus 26913 --| This takes the formatter separators in consideration.
563 neilc 33365 if f_ind > 4 then
564 manus 26913 f_ind := f_ind + 1
565     end
566 neilc 33365 if f_ind > 8 then
567 manus 26913 f_ind := f_ind + 1
568     end
569     if f_ind < 1 or f_ind > managed_class_formatters.count then
570 neilc 33365 f_ind := 6
571 manus 26913 end
572 manus 51111 (managed_class_formatters @ f_ind).enable_select;
573 manus 26913 -- We now select the correct feature formatter.
574 neilc 53432 f_ind := preferences.context_tool_data.default_feature_formatter_index
575 manus 26913 if f_ind > 2 then
576     f_ind := f_ind + 1
577     end
578     if f_ind < 1 or f_ind > managed_feature_formatters.count then
579     f_ind := 2
580     end
581 manus 33315 managed_class_formatters.i_th (f_ind).enable_select
582 manus 26913 end
583    
584     build_tools is
585     -- Build all tools that can take place in this window and put them
586     -- in `left_tools' or `bottom_tools'.
587     local
588     show_cmd: EB_SHOW_TOOL_COMMAND
589     do
590 rogers 43098 lock_update
591 manus 26913 -- Build the features tool
592 jfiat 48452 create features_tool.make (Current)
593     features_tool.attach_to_explorer_bar (left_panel)
594 manus 26913 left_tools.extend (features_tool.explorer_bar_item)
595     create show_cmd.make (Current, features_tool.explorer_bar_item)
596     show_tool_commands.extend (show_cmd)
597     toolbarable_commands.extend (show_cmd)
598     add_recyclable (features_tool)
599    
600 jfiat 54610 -- Build the breakpoints tool
601     create breakpoints_tool.make (Current)
602     breakpoints_tool.attach_to_explorer_bar (left_panel)
603     left_tools.extend (breakpoints_tool.explorer_bar_item)
604     create show_cmd.make (Current, breakpoints_tool.explorer_bar_item)
605     show_tool_commands.extend (show_cmd)
606     toolbarable_commands.extend (show_cmd)
607     add_recyclable (breakpoints_tool)
608    
609 manus 26913 -- Build the cluster tool
610 jfiat 48452 create cluster_tool.make (Current, Current)
611     cluster_tool.attach_to_explorer_bar (left_panel)
612 manus 26913 left_tools.extend (cluster_tool.explorer_bar_item)
613     create show_cmd.make (Current, cluster_tool.explorer_bar_item)
614     show_tool_commands.extend (show_cmd)
615     toolbarable_commands.extend (show_cmd)
616     add_recyclable (cluster_tool)
617    
618     -- Build the favorites tool
619 jfiat 48452 create favorites_tool.make (Current, favorites_manager)
620     favorites_tool.attach_to_explorer_bar (left_panel)
621 manus 26913 left_tools.extend (favorites_tool.explorer_bar_item)
622     create show_cmd.make (Current, favorites_tool.explorer_bar_item)
623     show_tool_commands.extend (show_cmd)
624     toolbarable_commands.extend (show_cmd)
625     add_recyclable (favorites_tool)
626    
627     -- Build the windows tool (formerly known as Selector tool)
628 jfiat 48452 create windows_tool.make (Current)
629     windows_tool.attach_to_explorer_bar (left_panel)
630 manus 26913 left_tools.extend (windows_tool.explorer_bar_item)
631     create show_cmd.make (Current, windows_tool.explorer_bar_item)
632     show_tool_commands.extend (show_cmd)
633     toolbarable_commands.extend (show_cmd)
634     add_recyclable (windows_tool)
635 manus 55527
636 tedf 55179 -- Build the search tool
637     create {EB_MULTI_SEARCH_TOOL}search_tool.make (Current)
638     search_tool.attach_to_explorer_bar (right_panel)
639     bottom_tools.extend (search_tool.explorer_bar_item)
640     create show_cmd.make (Current, search_tool.explorer_bar_item)
641     show_tool_commands.extend (show_cmd)
642     toolbarable_commands.extend (show_cmd)
643     add_recyclable (search_tool)
644 manus 26913
645     -- Build the editor tool
646 jfiat 48452 create editor_tool.make (Current)
647     editor_tool.attach_to_explorer_bar (right_panel)
648 manus 26913 bottom_tools.extend (editor_tool.explorer_bar_item)
649     editor_tool.text_area.add_edition_observer(save_cmd)
650     editor_tool.text_area.add_edition_observer(save_as_cmd)
651     editor_tool.text_area.add_edition_observer(print_cmd)
652     editor_tool.text_area.add_edition_observer(Current)
653 tedf 55179 editor_tool.text_area.add_edition_observer(search_tool)
654 manus 36309 editor_tool.text_area.drop_actions.set_veto_pebble_function (agent can_drop)
655 xavier 29812 editor_tool.text_area.add_cursor_observer (Current)
656 tedf 55179 create show_cmd.make(Current, editor_tool.explorer_bar_item)
657     show_tool_commands.extend (show_cmd)
658     toolbarable_commands.extend (show_cmd)
659 manus 51111
660 rogers 40708 -- The minimim height masks a bug on windows to do with the sizing of the editors
661     -- scroll bars, which were affecting the resizing although they should not have done so.
662     -- Having a default minimum height on the editor is perfectly reasonable.
663     editor_tool.widget.set_minimum_height (20)
664 manus 26913 add_recyclable (editor_tool)
665    
666     -- Build the context tool
667 jfiat 48452 create context_tool.make (Current)
668     context_tool.attach_to_explorer_bar (right_panel)
669 manus 26913 bottom_tools.extend (context_tool.explorer_bar_item)
670     create show_cmd.make (Current, context_tool.explorer_bar_item)
671     show_tool_commands.extend (show_cmd)
672     toolbarable_commands.extend (show_cmd)
673     add_recyclable (context_tool)
674    
675     -- Set the flag "Tools initialized"
676     tools_initialized := True
677 manus 51111
678 manus 26913 -- Initialize undo / redo accelerators
679 manus 51111 create undo_accelerator.make_with_key_combination (
680     create {EV_KEY}.make_with_code (Key_z), True, False, False)
681 xavier 27549 if has_case then
682     undo_accelerator.actions.extend (agent (context_tool.editor.undo_cmd).on_ctrl_z)
683     end
684 manus 26913 undo_accelerator.actions.extend (agent undo_cmd.accelerator_execute)
685 manus 51111 create redo_accelerator.make_with_key_combination (
686     create {EV_KEY}.make_with_code (Key_y), True, False, False)
687 xavier 27549 if has_case then
688     redo_accelerator.actions.extend (agent (context_tool.editor.redo_cmd).on_ctrl_y)
689     end
690 manus 26913 redo_accelerator.actions.extend (agent redo_cmd.accelerator_execute)
691     window.accelerators.extend (undo_accelerator)
692     window.accelerators.extend (redo_accelerator)
693 rogers 43098 unlock_update
694 manus 26913 end
695    
696     feature -- Access
697    
698     cluster: CLUSTER_I is
699     -- Cluster for current class. Void if none.
700     local
701     classi_stone: CLASSI_STONE
702     cluster_stone: CLUSTER_STONE
703     do
704     classi_stone ?= stone
705     if classi_stone /= Void then
706     Result := classi_stone.cluster
707     end
708     cluster_stone ?= stone
709     if cluster_stone /= Void then
710     Result := cluster_stone.cluster_i
711     end
712     end
713    
714     class_name: STRING is
715     -- Name of the current class, Void if none.
716     local
717     class_stone: CLASSI_STONE
718     do
719     class_stone ?= stone
720     if class_stone /= Void then
721     Result := class_stone.class_name
722     end
723     end
724    
725     feature_name: STRING is
726     -- Name of the current feature, Void if none.
727     local
728     feature_stone: FEATURE_STONE
729     do
730     feature_stone ?= stone
731     if feature_stone /= Void then
732     Result := feature_stone.feature_name
733     end
734     end
735 manus 51111
736 xavier 30005 feature -- Status setting
737    
738     disable_sensitive is
739     -- Disable sensitivity of all widgets.
740     do
741     window.disable_sensitive
742     end
743    
744     enable_sensitive is
745     -- Enable sensitivity of all widgets.
746     do
747     window.enable_sensitive
748     end
749    
750 manus 26913 feature -- Window Settings
751    
752     set_initialized is
753     -- Set `initialized' to True.
754     do
755     initialized := True
756     end
757    
758     set_text (a_text: STRING) is
759     -- Assign `a_text' to `text'.
760     require
761     a_text_not_void: a_text /= Void
762     do
763 neilc 49534 editor_tool.text_area.set_editor_text (a_text)
764 manus 26913 ensure
765     --| FIXME This needs to work: text_assigned: text.is_equal (a_text)
766     --| FIXME changed_flag_set: changed
767     end
768    
769     feature -- Window Properties
770    
771     changed: BOOLEAN is
772     -- Has something been changed and not yet been saved?
773     do
774     Result := editor_tool.changed
775     end
776    
777     is_empty: BOOLEAN is
778     -- Does `Current's text is empty?
779     do
780     Result := editor_tool = Void or else editor_tool.text_area.is_empty
781     end
782    
783     text: STRING is
784     -- Text representing Current
785     do
786     Result := editor_tool.text_area.text
787     end
788    
789     pixmap: EV_PIXMAP is
790     -- Pixmap representing Current window.
791     do
792     Result := Pixmaps.Icon_development_window
793     end
794    
795     feature -- Pulldown Menus
796    
797     metric_menu: EV_MENU
798     -- Menu for entries of metric tool.
799 manus 51111
800 manus 26913 format_menu: EV_MENU
801     -- ID Menu for formats.
802     -- Only used during debugging
803    
804     compile_menu: EV_MENU
805     -- Compile ID menu.
806    
807     debug_menu: EV_MENU
808     -- Debug ID menu.
809 manus 55527
810 jfiat 54577 debugging_tools_menu: EV_MENU
811     -- Debugging tools menu item
812 manus 26913
813     active_menus (erase: BOOLEAN) is
814     -- Enable all the menus and if `erase' clean
815     -- the content of the Project tool.
816     do
817     compile_menu.enable_sensitive
818     if erase then
819     output_manager.clear
820     end
821     end
822    
823     disable_menus is
824     -- Disable all the menus.
825     do
826     compile_menu.disable_sensitive
827     end
828 manus 55527
829 jfiat 54577 update_debug_menu is
830     -- Update debug menu
831     do
832     debugger_manager.update_debugging_tools_menu_from (Current)
833     end
834 manus 26913
835     feature -- Modifiable menus
836    
837     melt_menu_item: EV_MENU_ITEM
838     -- Melt menu entry
839    
840     freeze_menu_item: EV_MENU_ITEM
841     -- Freeze menu entry
842    
843     finalize_menu_item: EV_MENU_ITEM
844     -- Finalize menu entry
845    
846     feature -- Update
847    
848     synchronize is
849     -- Synchronize stones.
850     local
851     st: STONE
852     do
853     during_synchronization := True
854     favorites_manager.refresh
855     context_tool.synchronize
856     cluster_tool.synchronize
857     history_manager.synchronize
858     features_tool.synchronize
859 jfiat 54610 breakpoints_tool.synchronize
860 alexk 53977 -- Update main views
861     managed_main_formatters.i_th (2).invalidate
862     managed_main_formatters.i_th (3).invalidate
863     managed_main_formatters.i_th (4).invalidate
864     managed_main_formatters.i_th (5).invalidate
865 manus 26913 if stone /= Void then
866     st := stone.synchronized_stone
867     end
868 manus 27952 editor_tool.text_area.update_click_list (False)
869 manus 26913 set_stone (st)
870     update_save_symbol
871     address_manager.refresh
872     during_synchronization := False
873     end
874 manus 55527
875 manus 26913 synchronize_routine_tool_to_default is
876     -- Synchronize the editor tool to the debug format.
877     do
878     --| FIXME ARNAUD: To be implemented
879     end
880    
881     clear_object_tool is
882     -- Clear the contents of the object tool if shown.
883     do
884     --| FIXME ARNAUD: To be implemented
885     end
886    
887     build_menus is
888     -- Build all menus displayed in the development window.
889     do
890     -- Build each menu
891     build_file_menu
892     build_edit_menu
893     build_view_menu
894     build_favorites_menu
895     build_project_menu
896     build_debug_menu
897     build_tools_menu
898     build_window_menu
899 manus 55527 build_help_menu
900 manus 26913 -- Build the menu bar.
901     build_menu_bar
902     end
903    
904     build_debug_menu is
905     -- Build the `Debug' menu through the debugger_manager.
906     local
907     conv_mit: EB_COMMAND_MENU_ITEM
908     do
909     debug_menu := debugger_manager.new_debug_menu
910     from
911     debug_menu.start
912     until
913     debug_menu.after
914     loop
915     conv_mit ?= debug_menu.item
916     if conv_mit /= Void then
917     add_recyclable (conv_mit)
918     end
919     debug_menu.forth
920     end
921 jfiat 54577 --| Debugging tools menu
922     debugging_tools_menu := debugger_manager.new_debugging_tools_menu
923     debug_menu.extend (create {EV_MENU_SEPARATOR})
924     debug_menu.extend (debugging_tools_menu)
925     update_debug_menu
926 manus 26913 end
927    
928     build_menu_bar is
929     -- Build the menu bar
930     local
931     mb: EV_MENU_BAR
932     do
933     check
934     window.menu_bar /= Void implies not window.menu_bar.is_empty
935     -- If a menu bar was already present, it shouldn't be empty.
936     end
937     if window.menu_bar /= Void then
938     mb := window.menu_bar
939     from
940     mb.start
941     mb.forth
942     until
943     mb.after
944     loop
945     mb.remove
946     end
947     else
948     create mb
949     window.set_menu_bar (mb)
950     mb.extend (file_menu)
951     end
952    
953     if Eiffel_project.manager.is_created then
954     mb.extend (edit_menu)
955     mb.extend (view_menu)
956     mb.extend (favorites_menu)
957     mb.extend (project_menu)
958     mb.extend (debug_menu)
959     else
960     mb.extend (view_menu)
961     end
962     mb.extend (tools_menu)
963     mb.extend (window_menu)
964     mb.extend (help_menu)
965 larryl 54857 estudio_debug_cmd.build_menu_bar
966 manus 26913 end
967    
968     feature -- Graphical Interface
969    
970     build_general_toolbar is
971     -- Set up the general toolbar (New, Save, Search, Shell, Undo, Redo, ...)
972     local
973     cell: EV_CELL
974     hsep: EV_HORIZONTAL_SEPARATOR
975     hbox: EV_HORIZONTAL_BOX
976     do
977     -- Create the toolbar.
978     create general_toolbar
979 king 55319 general_customizable_toolbar := development_window_data.retrieve_general_toolbar (toolbarable_commands)
980     if development_window_data.show_text_in_general_toolbar then
981 king 46348 general_customizable_toolbar.enable_important_text
982 king 55319 elseif development_window_data.show_all_text_in_general_toolbar then
983 manus 26913 general_customizable_toolbar.enable_text_displayed
984     end
985 manus 51111
986 manus 26913 create hbox
987     hbox.extend (general_customizable_toolbar.widget)
988     hbox.disable_item_expand (general_customizable_toolbar.widget)
989    
990     -- Generate the toolbar.
991     general_customizable_toolbar.update_toolbar
992    
993     -- Cell to fill in empty space and receive the right click menu holder.
994     create cell
995 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
996 manus 26913 hbox.extend (cell)
997    
998     -- Create the vertical layout (separator + toolbar)
999     create hsep
1000     general_toolbar.set_padding (2)
1001     general_toolbar.extend (hsep)
1002     general_toolbar.disable_item_expand (hsep)
1003     general_toolbar.extend (hbox)
1004    
1005     -- Create the command to show/hide this toolbar.
1006 manus 51111 create show_general_toolbar_command.make (general_toolbar, Interface_names.m_general_toolbar)
1007 manus 26913 show_toolbar_commands.extend (show_general_toolbar_command)
1008 king 55319 if development_window_data.show_general_toolbar then
1009 manus 26913 show_general_toolbar_command.enable_visible
1010     else
1011     show_general_toolbar_command.disable_visible
1012     end
1013    
1014     end
1015    
1016     build_address_toolbar is
1017     -- Set up the address toolbar (Back, Forward, Current, Class name, feature name, ...)
1018     local
1019     tb: EV_TOOL_BAR
1020     -- address_bar: EV_HORIZONTAL_BOX -- Contains "Class" + Combobox + "Feature" + Combobox + "Format" + Combobox
1021     hsep: EV_HORIZONTAL_SEPARATOR
1022     hbox: EV_HORIZONTAL_BOX -- Contains HistoryToolbar (back, forth, current) + `address_bar'
1023     cell: EV_CELL
1024 xavier 27498 accel: EV_ACCELERATOR
1025 manus 26913 do
1026     -- Create the toolbar
1027     create address_toolbar
1028     create hsep
1029     create hbox
1030     -- create address_bar
1031     create tb
1032     address_toolbar.set_padding (2)
1033     address_toolbar.extend (hsep)
1034     address_toolbar.disable_item_expand (hsep)
1035     address_toolbar.extend (hbox)
1036    
1037     hbox.extend (tb)
1038     hbox.disable_item_expand (tb)
1039     -- hbox.extend (address_bar)
1040     -- hbox.disable_item_expand (address_bar)
1041    
1042     -- Back icon
1043     tb.extend (history_manager.back_command.new_toolbar_item (False, False))
1044    
1045     -- Forward icon
1046     tb.extend (history_manager.forth_command.new_toolbar_item (False, False))
1047 manus 51111
1048 xavier 27498 -- Set up the accelerators.
1049     create accel.make_with_key_combination (
1050     create {EV_KEY}.make_with_code (Kcst.Key_right), False, True, False
1051     )
1052 manus 36309 accel.actions.extend (agent on_forth)
1053 xavier 27498 window.accelerators.extend (accel)
1054 manus 51111
1055 xavier 27498 create accel.make_with_key_combination (
1056     create {EV_KEY}.make_with_code (Kcst.Key_left), False, True, False
1057     )
1058 manus 36309 accel.actions.extend (agent on_back)
1059 xavier 27498 window.accelerators.extend (accel)
1060 manus 26913
1061     ------------------------------------------
1062     -- Address bar (Class name & feature name)
1063     ------------------------------------------
1064     hbox.extend (address_manager.widget)
1065 neilc 49534 -- editor_tool.text_area.add_cursor_observer (address_manager)
1066 manus 26913
1067     -- Create the command to show/hide this toolbar.
1068 manus 51111 create show_address_toolbar_command.make (address_toolbar, Interface_names.m_address_toolbar)
1069 manus 26913 show_toolbar_commands.extend (show_address_toolbar_command)
1070    
1071 king 55319 if development_window_data.show_address_toolbar then
1072 manus 26913 show_address_toolbar_command.enable_visible
1073     else
1074     show_address_toolbar_command.disable_visible
1075     end
1076    
1077     -- Cell to fill in empty space and receive the right click menu holder.
1078     create cell
1079 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1080 manus 26913 hbox.extend (cell)
1081     end
1082    
1083     build_project_toolbar is
1084     -- Build toolbar corresponding to the project options bar
1085     local
1086     cell: EV_CELL
1087     hsep: EV_HORIZONTAL_SEPARATOR
1088     hbox: EV_HORIZONTAL_BOX
1089     do
1090     create project_toolbar
1091     create hsep
1092     project_toolbar.extend (hsep)
1093     project_toolbar.disable_item_expand (hsep)
1094    
1095     -- Generate the toolbar.
1096     create hbox
1097     project_customizable_toolbar := debugger_manager.new_toolbar
1098     hbox.extend (project_customizable_toolbar.widget)
1099     hbox.disable_item_expand (project_customizable_toolbar.widget)
1100    
1101     project_customizable_toolbar.update_toolbar
1102    
1103     -- Create the command to show/hide this toolbar.
1104 manus 51111 create show_project_toolbar_command.make (project_toolbar, Interface_names.m_project_toolbar)
1105 manus 26913 show_toolbar_commands.extend (show_project_toolbar_command)
1106 king 55319 if development_window_data.show_project_toolbar then
1107 manus 26913 show_project_toolbar_command.enable_visible
1108     else
1109     show_project_toolbar_command.disable_visible
1110     end
1111    
1112     -- Cell to fill in empty space and receive the right click menu holder.
1113     create cell
1114 manus 36309 cell.pointer_button_release_actions.extend (agent toolbar_right_click_action)
1115 manus 26913 hbox.extend (cell)
1116     project_toolbar.extend (hbox)
1117     end
1118    
1119 manus 45562 feature {NONE} -- Menu Building
1120 manus 26913
1121     build_file_menu is
1122     -- Build the file menu.
1123     local
1124     new_project_cmd: EB_NEW_PROJECT_COMMAND
1125     open_project_cmd: EB_OPEN_PROJECT_COMMAND
1126     send_to_menu: EV_MENU
1127     menu_item: EV_MENU_ITEM
1128     command_menu_item: EB_COMMAND_MENU_ITEM
1129     do
1130 manus 51111 create file_menu.make_with_text (Interface_names.m_file)
1131 manus 26913
1132     -- New
1133     command_menu_item := New_development_window_cmd.new_menu_item
1134     add_recyclable (command_menu_item)
1135     file_menu.extend (command_menu_item)
1136    
1137     -- New editor
1138     command_menu_item := New_editor_cmd.new_menu_item
1139     add_recyclable (command_menu_item)
1140     file_menu.extend (command_menu_item)
1141    
1142     -- New context tool
1143     command_menu_item := New_context_tool_cmd.new_menu_item
1144     add_recyclable (command_menu_item)
1145     file_menu.extend (command_menu_item)
1146    
1147     -- Open
1148     command_menu_item := open_cmd.new_menu_item
1149     add_recyclable (command_menu_item)
1150     file_menu.extend (command_menu_item)
1151    
1152     -- Close
1153 manus 51111 create menu_item.make_with_text (Interface_names.m_close)
1154 manus 36309 menu_item.select_actions.extend (agent destroy)
1155 manus 26913 file_menu.extend (menu_item)
1156    
1157     -- Separator --------------------------------------
1158     file_menu.extend (create {EV_MENU_SEPARATOR})
1159    
1160     -- Save
1161     command_menu_item := save_cmd.new_menu_item
1162     add_recyclable (command_menu_item)
1163     file_menu.extend (command_menu_item)
1164    
1165     -- Save as
1166     command_menu_item := save_as_cmd.new_menu_item
1167     add_recyclable (command_menu_item)
1168     file_menu.extend (command_menu_item)
1169    
1170     -- Sent to
1171 manus 51111 create send_to_menu.make_with_text (Interface_names.m_send_to)
1172 manus 26913 -- External editor
1173     command_menu_item := shell_cmd.new_menu_item
1174     add_recyclable (command_menu_item)
1175     send_to_menu.extend (command_menu_item)
1176     file_menu.extend (send_to_menu)
1177    
1178     -- Separator --------------------------------------
1179     file_menu.extend (create {EV_MENU_SEPARATOR})
1180     command_menu_item := print_cmd.new_menu_item
1181     add_recyclable (command_menu_item)
1182     file_menu.extend (command_menu_item)
1183    
1184     -- Separator --------------------------------------
1185     file_menu.extend (create {EV_MENU_SEPARATOR})
1186    
1187     -- New Project
1188     create new_project_cmd.make_with_parent (window)
1189 manus 51111 create menu_item.make_with_text (Interface_names.m_new_project)
1190 manus 36309 menu_item.select_actions.extend (agent new_project_cmd.execute)
1191 manus 26913 file_menu.extend (menu_item)
1192    
1193     -- Open Project
1194     create open_project_cmd.make_with_parent (window)
1195 manus 51111 create menu_item.make_with_text (Interface_names.m_open_project)
1196 manus 26913 menu_item.select_actions.extend (agent open_project_cmd.execute)
1197     file_menu.extend (menu_item)
1198    
1199     -- Recent Projects
1200     recent_projects_menu := recent_projects_manager.new_menu
1201     add_recyclable (recent_projects_menu)
1202     file_menu.extend (recent_projects_menu)
1203    
1204     -- Separator --------------------------------------
1205     file_menu.extend (create {EV_MENU_SEPARATOR})
1206    
1207     -- Exit
1208     command_menu_item := Exit_application_cmd.new_menu_item
1209     add_recyclable (Command_menu_item)
1210     file_menu.extend (command_menu_item)
1211     end
1212    
1213     build_class_info_menu: EV_MENU is
1214     -- Build the class format sub-menu.
1215     local
1216     form: EB_CLASS_INFO_FORMATTER
1217     empty_menu: EV_MENU_ITEM
1218     i: INTEGER
1219     do
1220 manus 51111 create Result.make_with_text (Interface_names.m_class_info)
1221 manus 26913 i := 1
1222    
1223 manus 51111 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1224 manus 26913 i := i + 1
1225     empty_menu.disable_sensitive
1226     Result.extend (empty_menu)
1227     from
1228     managed_class_formatters.start
1229     until
1230     managed_class_formatters.after
1231     loop
1232     form := managed_class_formatters.item
1233     if form /= Void then
1234     Result.extend (form.new_menu_item)
1235     else
1236 manus 51111 create empty_menu.make_with_text (Interface_names.m_formatter_separators @ i)
1237 manus 26913 i := i + 1
1238     empty_menu.disable_sensitive
1239     Result.extend (empty_menu)
1240     end
1241     managed_class_formatters.forth
1242     end
1243     end
1244    
1245     build_feature_info_menu: EV_MENU is
1246     -- Build the feature format sub-menu.
1247     local
1248     form: EB_FEATURE_INFO_FORMATTER
1249     do
1250 manus 51111 create Result.make_with_text (Interface_names.m_feature_info)
1251 manus 26913 from
1252     managed_feature_formatters.start
1253     until
1254     managed_feature_formatters.after
1255     loop
1256     form := managed_feature_formatters.item
1257     if form /= Void then
1258     Result.extend (form.new_menu_item)
1259     end
1260     managed_feature_formatters.forth
1261     end
1262     end
1263    
1264     build_edit_menu is
1265     -- Create and build `edit_menu'
1266     local
1267     command_menu_item: EB_COMMAND_MENU_ITEM
1268     sub_menu: EV_MENU
1269     cmd: EB_EDITOR_COMMAND
1270     os_cmd: EB_ON_SELECTION_COMMAND
1271     editor: EB_SMART_EDITOR
1272 neilc 53728 ln_cmd: EB_TOGGLE_LINE_NUMBERS_COMMAND
1273 manus 26913 do
1274     editor := editor_tool.text_area
1275 xavier 28303 create command_controller.make
1276 manus 26913
1277 manus 51111 create edit_menu.make_with_text (Interface_names.m_edit)
1278 manus 26913
1279     -- Undo
1280     command_menu_item := undo_cmd.new_menu_item
1281     add_recyclable (command_menu_item)
1282     edit_menu.extend (command_menu_item)
1283    
1284     -- Redo
1285     command_menu_item := redo_cmd.new_menu_item
1286     add_recyclable (command_menu_item)
1287     edit_menu.extend (command_menu_item)
1288    
1289     -- Separator --------------------------------------
1290     edit_menu.extend (create {EV_MENU_SEPARATOR})
1291    
1292     -- Cut
1293 xavier 28303 create os_cmd.make (Current)
1294     os_cmd.set_menu_name (Interface_names.M_cut)
1295     os_cmd.set_pixmaps (pixmaps.icon_cut)
1296     os_cmd.set_name ("Editor_cut")
1297     os_cmd.set_tooltip (interface_names.f_cut)
1298 manus 36309 os_cmd.add_agent (agent cut_selection)
1299 manus 51111 os_cmd.set_tooltext (Interface_names.b_cut)
1300 xavier 28303 toolbarable_commands.extend (os_cmd)
1301     os_cmd.set_needs_editable (True)
1302     command_controller.add_selection_command (os_cmd)
1303     command_menu_item := os_cmd.new_menu_item
1304 manus 26913 add_recyclable (command_menu_item)
1305     edit_menu.extend (command_menu_item)
1306    
1307     -- Copy
1308 xavier 28303 create os_cmd.make (Current)
1309     os_cmd.set_menu_name (Interface_names.M_copy)
1310     os_cmd.set_pixmaps (pixmaps.icon_copy)
1311     os_cmd.set_name ("Editor_copy")
1312     os_cmd.set_tooltip (interface_names.f_copy)
1313 manus 51111 os_cmd.set_tooltext (Interface_names.b_copy)
1314 manus 36309 os_cmd.add_agent (agent copy_selection)
1315 xavier 28303 toolbarable_commands.extend (os_cmd)
1316     os_cmd.set_needs_editable (False)
1317     command_controller.add_selection_command (os_cmd)
1318     command_menu_item := os_cmd.new_menu_item
1319 manus 26913 add_recyclable (command_menu_item)
1320     edit_menu.extend (command_menu_item)
1321    
1322     -- Paste
1323     command_menu_item := editor_paste_cmd.new_menu_item
1324     add_recyclable (command_menu_item)
1325     edit_menu.extend (command_menu_item)
1326    
1327     -- Separator --------------------------------------
1328     edit_menu.extend (create {EV_MENU_SEPARATOR})
1329    
1330     -- Select all
1331     create cmd.make
1332     cmd.set_menu_name (Interface_names.m_select_all)
1333 manus 36309 cmd.add_agent (agent select_all)
1334 manus 26913 command_menu_item := cmd.new_menu_item
1335 xavier 28303 command_controller.add_edition_command (cmd)
1336 manus 26913 add_recyclable (command_menu_item)
1337     edit_menu.extend (command_menu_item)
1338    
1339     -- Separator --------------------------------------
1340     edit_menu.extend (create {EV_MENU_SEPARATOR})
1341    
1342 neilc 49534 -- Line numbers
1343 neilc 53728 create ln_cmd.make
1344     command_menu_item := ln_cmd.new_menu_item
1345 neilc 49534 add_recyclable (command_menu_item)
1346     edit_menu.extend (command_menu_item)
1347 neilc 53728 window.accelerators.extend (ln_cmd.accelerator)
1348 neilc 49534
1349 manus 55527
1350 neilc 49534 -- Separator --------------------------------------
1351     edit_menu.extend (create {EV_MENU_SEPARATOR})
1352    
1353 manus 26913 -- Search
1354     create cmd.make
1355 neilc 55887 cmd.set_menu_name (Interface_names.m_search + "%T" + preferences.editor_data.shortcuts.item ("show_search_panel").display_string)
1356 manus 36309 cmd.add_agent (agent search)
1357 manus 26913 command_menu_item := cmd.new_menu_item
1358 xavier 28303 command_controller.add_edition_command (cmd)
1359 manus 26913 add_recyclable (command_menu_item)
1360     edit_menu.extend (command_menu_item)
1361    
1362 neilc 49534 -- Go to
1363     create cmd.make
1364 manus 51111 cmd.set_menu_name (Interface_names.m_go_to)
1365 neilc 49534 cmd.add_agent (agent goto)
1366     cmd.set_needs_editable (True)
1367     command_menu_item := cmd.new_menu_item
1368     command_controller.add_edition_command (cmd)
1369     add_recyclable (command_menu_item)
1370     edit_menu.extend (command_menu_item)
1371    
1372 manus 26913 -- Replace
1373     create cmd.make
1374 neilc 55887 cmd.set_menu_name (Interface_names.m_replace + "%T" + preferences.editor_data.shortcuts.item ("show_search_and_replace_panel").display_string)
1375 manus 36309 cmd.add_agent (agent editor.replace)
1376 xavier 27860 cmd.set_needs_editable (True)
1377 manus 26913 command_menu_item := cmd.new_menu_item
1378 xavier 28303 command_controller.add_edition_command (cmd)
1379 manus 26913 add_recyclable (command_menu_item)
1380     edit_menu.extend (command_menu_item)
1381    
1382     -- Find sub menu
1383    
1384 manus 51111 create sub_menu.make_with_text (Interface_names.m_find)
1385 manus 26913
1386     -- Find next
1387     create cmd.make
1388 neilc 55887 cmd.set_menu_name (Interface_names.m_find_next + "%T" + preferences.editor_data.shortcuts.item ("search_last").display_string)
1389 manus 36309 cmd.add_agent (agent find_next)
1390 manus 26913 command_menu_item := cmd.new_menu_item
1391 xavier 28303 command_controller.add_edition_command (cmd)
1392 manus 26913 add_recyclable (command_menu_item)
1393     sub_menu.extend (command_menu_item)
1394    
1395     -- Find previous
1396     create cmd.make
1397 neilc 55887 cmd.set_menu_name (Interface_names.m_find_previous + "%T" + preferences.editor_data.shortcuts.item ("search_backward").display_string)
1398 manus 36309 cmd.add_agent (agent find_previous)
1399 manus 26913 command_menu_item := cmd.new_menu_item
1400 xavier 28303 command_controller.add_edition_command (cmd)
1401 manus 26913 add_recyclable (command_menu_item)
1402     sub_menu.extend (command_menu_item)
1403    
1404     -- Find selection
1405     create os_cmd.make (Current)
1406 neilc 55887 os_cmd.set_menu_name (Interface_names.m_find_selection + "%T" + preferences.editor_data.shortcuts.item ("search_selection").display_string)
1407 manus 36309 os_cmd.add_agent (agent find_selection)
1408 manus 26913 command_menu_item := os_cmd.new_menu_item
1409 xavier 28303 command_controller.add_selection_command (os_cmd)
1410 manus 26913 add_recyclable (command_menu_item)
1411     sub_menu.extend (command_menu_item)
1412    
1413     edit_menu.extend (sub_menu)
1414    
1415    
1416     -- Separator --------------------------------------
1417     edit_menu.extend (create {EV_MENU_SEPARATOR})
1418    
1419 manus 51111 create sub_menu.make_with_text (Interface_names.m_advanced)
1420 manus 26913
1421     create os_cmd.make (Current)
1422 xavier 27860 os_cmd.set_needs_editable (True)
1423 xavier 28303 command_controller.add_selection_command (os_cmd)
1424 manus 51111 os_cmd.set_menu_name (Interface_names.m_indent)
1425 manus 36309 os_cmd.add_agent (agent editor.indent_selection)
1426 manus 26913 command_menu_item := os_cmd.new_menu_item
1427     add_recyclable (command_menu_item)
1428     sub_menu.extend (command_menu_item)
1429    
1430     create os_cmd.make (Current)
1431 xavier 27860 os_cmd.set_needs_editable (True)
1432 xavier 28303 command_controller.add_selection_command (os_cmd)
1433 manus 51111 os_cmd.set_menu_name (Interface_names.m_unindent)
1434 manus 36309 os_cmd.add_agent (agent editor.unindent_selection)
1435 manus 26913 command_menu_item := os_cmd.new_menu_item
1436     add_recyclable (command_menu_item)
1437     sub_menu.extend (command_menu_item)
1438    
1439     create os_cmd.make (Current)
1440 xavier 27860 os_cmd.set_needs_editable (True)
1441 xavier 28303 command_controller.add_selection_command (os_cmd)
1442 manus 51111 os_cmd.set_menu_name (Interface_names.m_to_lower)
1443 manus 36309 os_cmd.add_agent (agent editor.set_selection_case (True))
1444 manus 26913 command_menu_item := os_cmd.new_menu_item
1445     add_recyclable (command_menu_item)
1446     sub_menu.extend (command_menu_item)
1447    
1448     create os_cmd.make (Current)
1449 xavier 27860 os_cmd.set_needs_editable (True)
1450 xavier 28303 command_controller.add_selection_command (os_cmd)
1451 manus 51111 os_cmd.set_menu_name (Interface_names.m_to_upper)
1452 manus 36309 os_cmd.add_agent (agent editor.set_selection_case (False))
1453 manus 26913 command_menu_item := os_cmd.new_menu_item
1454     add_recyclable (command_menu_item)
1455     sub_menu.extend (command_menu_item)
1456    
1457     create cmd.make
1458 xavier 27860 cmd.set_needs_editable (True)
1459 manus 51111 cmd.set_menu_name (Interface_names.m_comment)
1460 manus 36309 cmd.add_agent (agent editor.comment_selection)
1461 manus 26913 command_menu_item := cmd.new_menu_item
1462 xavier 28303 command_controller.add_edition_command (cmd)
1463 manus 26913 add_recyclable (command_menu_item)
1464     sub_menu.extend (command_menu_item)
1465    
1466     create cmd.make
1467 xavier 27860 cmd.set_needs_editable (True)
1468 manus 51111 cmd.set_menu_name (Interface_names.m_uncomment)
1469 manus 36309 cmd.add_agent (agent editor.uncomment_selection)
1470 manus 26913 command_menu_item := cmd.new_menu_item
1471 xavier 28303 command_controller.add_edition_command (cmd)
1472 manus 26913 add_recyclable (command_menu_item)
1473     sub_menu.extend (command_menu_item)
1474    
1475     -- Separator --------------------------------------
1476     sub_menu.extend (create {EV_MENU_SEPARATOR})
1477    
1478     -- Insert if block
1479     create cmd.make
1480 xavier 27860 cmd.set_needs_editable (True)
1481 manus 51111 cmd.set_menu_name (Interface_names.m_if_block)
1482 manus 36309 cmd.add_agent (agent editor.embed_in_block("if then", 3))
1483 manus 26913 command_menu_item := cmd.new_menu_item
1484 xavier 28303 command_controller.add_edition_command (cmd)
1485 manus 26913 add_recyclable (command_menu_item)
1486     sub_menu.extend (command_menu_item)
1487    
1488     -- Insert debug block
1489     create cmd.make
1490 xavier 27860 cmd.set_needs_editable (True)
1491 manus 26913 cmd.set_menu_name (Interface_names.m_debug_block)
1492 manus 36309 cmd.add_agent (agent editor.embed_in_block("debug", 5))
1493 manus 26913 command_menu_item := cmd.new_menu_item
1494 xavier 28303 command_controller.add_edition_command (cmd)
1495 manus 26913 add_recyclable (command_menu_item)
1496     sub_menu.extend (command_menu_item)
1497    
1498    
1499     -- Separator --------------------------------------
1500     sub_menu.extend (create {EV_MENU_SEPARATOR})
1501    
1502     -- Complete word
1503     create cmd.make
1504 xavier 27860 cmd.set_needs_editable (True)
1505 neilc 55887 cmd.set_menu_name (Interface_names.m_complete_word + "%T" + preferences.editor_data.shortcuts.item ("autocomplete").display_string)
1506 manus 26913 command_menu_item := cmd.new_menu_item
1507 xavier 28303 command_controller.add_edition_command (cmd)
1508 manus 36309 cmd.add_agent (agent editor.complete_feature_name)
1509 manus 26913
1510     add_recyclable (command_menu_item)
1511     sub_menu.extend (command_menu_item)
1512    
1513 etienne 27163 -- Complete class name
1514     create cmd.make
1515 xavier 27860 cmd.set_needs_editable (True)
1516 neilc 55887 cmd.set_menu_name (Interface_names.m_complete_class_name + "%T" + preferences.editor_data.shortcuts.item ("class_autocomplete").display_string)
1517 etienne 27163 command_menu_item := cmd.new_menu_item
1518 xavier 28303 command_controller.add_edition_command (cmd)
1519 manus 36309 cmd.add_agent (agent editor.complete_class_name)
1520 etienne 27163
1521     add_recyclable (command_menu_item)
1522     sub_menu.extend (command_menu_item)
1523    
1524 manus 26913 sub_menu.extend (create {EV_MENU_SEPARATOR})
1525    
1526     -- show/hide formatting marks.
1527     create cmd.make
1528     if editor_tool.text_area.view_invisible_symbols then
1529 manus 51111 cmd.set_menu_name (Interface_names.m_hide_formatting_marks)
1530 manus 26913 else
1531 manus 51111 cmd.set_menu_name (Interface_names.m_show_formatting_marks)
1532 manus 26913 end
1533     formatting_marks_command_menu_item := cmd.new_menu_item
1534 xavier 28303 command_controller.add_edition_command (cmd)
1535 manus 36309 cmd.add_agent (agent toggle_formatting_marks)
1536 manus 26913
1537     add_recyclable (formatting_marks_command_menu_item)
1538     sub_menu.extend (formatting_marks_command_menu_item)
1539    
1540     edit_menu.extend (sub_menu)
1541     end
1542    
1543     build_view_menu is
1544     -- Build the view menu.
1545     local
1546     form: EB_CLASS_INFO_FORMATTER
1547     new_menu_item: EB_COMMAND_MENU_ITEM
1548     new_basic_item: EV_MENU_ITEM
1549     do
1550     Precursor
1551    
1552     new_menu_item := toggle_stone_cmd.new_menu_item
1553     view_menu.extend (new_menu_item)
1554     add_recyclable (new_menu_item)
1555    
1556     new_menu_item := send_stone_to_context_cmd.new_menu_item
1557     view_menu.extend (new_menu_item)
1558     add_recyclable (new_menu_item)
1559     -- Go to menu
1560     new_basic_item := history_manager.new_menu
1561     view_menu.extend (new_basic_item)
1562    
1563     -- Separator --------------------------------------
1564     view_menu.extend (create {EV_MENU_SEPARATOR})
1565     view_menu.extend (build_class_info_menu)
1566     view_menu.extend (build_feature_info_menu)
1567    
1568     -- Separator --------------------------------------
1569     view_menu.extend (create {EV_MENU_SEPARATOR})
1570    
1571     from
1572     managed_main_formatters.start
1573     until
1574     managed_main_formatters.after
1575     loop
1576     form := managed_main_formatters.item
1577     new_basic_item := form.new_menu_item
1578 manus 36309 new_basic_item.select_actions.put_front (agent form.invalidate)
1579 manus 26913 view_menu.extend (new_basic_item)
1580     --add_recyclable (new_basic_item)
1581     managed_main_formatters.forth
1582     end
1583     end
1584 manus 51111
1585 manus 26913 build_favorites_menu is
1586     -- Build the favorites menu
1587     do
1588     Precursor {EB_TOOL_MANAGER}
1589 manus 51111
1590 manus 26913 create show_favorites_menu_item
1591     update_show_favorites_menu_item
1592 manus 36309 show_favorites_menu_item.select_actions.extend (agent execute_show_favorites)
1593 manus 51111
1594 manus 26913 favorites_menu.start
1595     favorites_menu.put_right (show_favorites_menu_item)
1596 manus 36309 favorites_menu.select_actions.extend (agent update_show_favorites_menu_item)
1597 manus 26913 end
1598 manus 51111
1599 jasonw 54933 -- Jason Wei modified the following on Aug 31 2005
1600 manus 26913 build_project_menu is
1601     -- Build the project menu.
1602     local
1603     command_menu_item: EB_COMMAND_MENU_ITEM
1604     do
1605 manus 51111 create project_menu.make_with_text (Interface_names.m_project)
1606 manus 26913
1607     -- Melt
1608     command_menu_item := Melt_project_cmd.new_menu_item
1609     add_recyclable (command_menu_item)
1610     project_menu.extend (command_menu_item)
1611    
1612 xavier 29812 -- Quick melt
1613     command_menu_item := Quick_melt_project_cmd.new_menu_item
1614     add_recyclable (command_menu_item)
1615     project_menu.extend (command_menu_item)
1616    
1617 manus 26913 -- Freeze
1618     command_menu_item := Freeze_project_cmd.new_menu_item
1619     add_recyclable (command_menu_item)
1620     project_menu.extend (command_menu_item)
1621    
1622     -- Finalize
1623     command_menu_item := Finalize_project_cmd.new_menu_item
1624     add_recyclable (command_menu_item)
1625     project_menu.extend (command_menu_item)
1626    
1627     -- Precompile
1628     command_menu_item := precompilation_cmd.new_menu_item
1629     add_recyclable (command_menu_item)
1630     project_menu.extend (command_menu_item)
1631 manus 55527
1632 king 55319 -- Cancel
1633     command_menu_item := project_cancel_cmd.new_menu_item
1634     add_recyclable (command_menu_item)
1635     project_menu.extend (command_menu_item)
1636 manus 26913
1637     -- Separator -------------------------------------------------
1638     project_menu.extend (create {EV_MENU_SEPARATOR})
1639    
1640     -- Compile Workbench C code
1641     command_menu_item := c_workbench_compilation_cmd.new_menu_item
1642     add_recyclable (command_menu_item)
1643     project_menu.extend (command_menu_item)
1644    
1645     -- Compile Finalized C code
1646     command_menu_item := c_finalized_compilation_cmd.new_menu_item
1647     add_recyclable (command_menu_item)
1648     project_menu.extend (command_menu_item)
1649    
1650 jasonw 54933 -- Jason Wei
1651     -- Terminate C compilation
1652     command_menu_item := Terminate_c_compilation_cmd.new_menu_item
1653     add_recyclable (command_menu_item)
1654     project_menu.extend (command_menu_item)
1655     -- Jason Wei
1656 manus 55527
1657 manus 26913 -- Execute Finalized code
1658     command_menu_item := run_finalized_cmd.new_menu_item
1659     add_recyclable (command_menu_item)
1660     project_menu.extend (command_menu_item)
1661    
1662     -- Separator -------------------------------------------------
1663     project_menu.extend (create {EV_MENU_SEPARATOR})
1664    
1665     -- System Tool window
1666     command_menu_item := system_cmd.new_menu_item
1667     add_recyclable (command_menu_item)
1668     project_menu.extend (command_menu_item)
1669    
1670     -- System information
1671     command_menu_item := system_info_cmd.new_menu_item
1672     add_recyclable (command_menu_item)
1673     project_menu.extend (command_menu_item)
1674    
1675     -- Error information
1676     command_menu_item := display_error_help_cmd.new_menu_item
1677     add_recyclable (command_menu_item)
1678     project_menu.extend (command_menu_item)
1679    
1680 xavier 27549 if has_documentation_generation or has_xmi_generation then
1681     -- Separator -------------------------------------------------
1682     project_menu.extend (create {EV_MENU_SEPARATOR})
1683     end
1684 manus 26913
1685 xavier 27549 if has_documentation_generation then
1686     -- Generate Documentation
1687     command_menu_item := document_cmd.new_menu_item
1688     add_recyclable (command_menu_item)
1689     project_menu.extend (command_menu_item)
1690     end
1691 manus 26913
1692 xavier 27549 if has_xmi_generation then
1693     -- Export XMI
1694     command_menu_item := export_cmd.new_menu_item
1695     add_recyclable (command_menu_item)
1696     project_menu.extend (command_menu_item)
1697     end
1698 manus 26913 end
1699    
1700 jasonw 54933 ------- This is the original version
1701     -- build_project_menu is
1702     -- -- Build the project menu.
1703     -- local
1704     -- command_menu_item: EB_COMMAND_MENU_ITEM
1705     -- do
1706     -- create project_menu.make_with_text (Interface_names.m_project)
1707     --
1708     -- -- Melt
1709     -- command_menu_item := Melt_project_cmd.new_menu_item
1710     -- add_recyclable (command_menu_item)
1711     -- project_menu.extend (command_menu_item)
1712     --
1713     -- -- Quick melt
1714     -- command_menu_item := Quick_melt_project_cmd.new_menu_item
1715     -- add_recyclable (command_menu_item)
1716     -- project_menu.extend (command_menu_item)
1717     --
1718     -- -- Freeze
1719     -- command_menu_item := Freeze_project_cmd.new_menu_item
1720     -- add_recyclable (command_menu_item)
1721     -- project_menu.extend (command_menu_item)
1722     --
1723     -- -- Finalize
1724     -- command_menu_item := Finalize_project_cmd.new_menu_item
1725     -- add_recyclable (command_menu_item)
1726     -- project_menu.extend (command_menu_item)
1727     --
1728     -- -- Precompile
1729     -- command_menu_item := precompilation_cmd.new_menu_item
1730     -- add_recyclable (command_menu_item)
1731     -- project_menu.extend (command_menu_item)
1732     --
1733     -- -- Separator -------------------------------------------------
1734     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1735     --
1736     -- -- Compile Workbench C code
1737     -- command_menu_item := c_workbench_compilation_cmd.new_menu_item
1738     -- add_recyclable (command_menu_item)
1739     -- project_menu.extend (command_menu_item)
1740     --
1741     -- -- Compile Finalized C code
1742     -- command_menu_item := c_finalized_compilation_cmd.new_menu_item
1743     -- add_recyclable (command_menu_item)
1744     -- project_menu.extend (command_menu_item)
1745     --
1746     -- -- Execute Finalized code
1747     -- command_menu_item := run_finalized_cmd.new_menu_item
1748     -- add_recyclable (command_menu_item)
1749     -- project_menu.extend (command_menu_item)
1750     --
1751     -- -- Separator -------------------------------------------------
1752     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1753     --
1754     -- -- System Tool window
1755     -- command_menu_item := system_cmd.new_menu_item
1756     -- add_recyclable (command_menu_item)
1757     -- project_menu.extend (command_menu_item)
1758     --
1759     -- -- System information
1760     -- command_menu_item := system_info_cmd.new_menu_item
1761     -- add_recyclable (command_menu_item)
1762     -- project_menu.extend (command_menu_item)
1763     --
1764     -- -- Error information
1765     -- command_menu_item := display_error_help_cmd.new_menu_item
1766     -- add_recyclable (command_menu_item)
1767     -- project_menu.extend (command_menu_item)
1768     --
1769     -- if has_documentation_generation or has_xmi_generation then
1770     -- -- Separator -------------------------------------------------
1771     -- project_menu.extend (create {EV_MENU_SEPARATOR})
1772     -- end
1773     --
1774     -- if has_documentation_generation then
1775     -- -- Generate Documentation
1776     -- command_menu_item := document_cmd.new_menu_item
1777     -- add_recyclable (command_menu_item)
1778     -- project_menu.extend (command_menu_item)
1779     -- end
1780     --
1781     -- if has_xmi_generation then
1782     -- -- Export XMI
1783     -- command_menu_item := export_cmd.new_menu_item
1784     -- add_recyclable (command_menu_item)
1785     -- project_menu.extend (command_menu_item)
1786     -- end
1787     -- end
1788     -- Jason Wei modified the above on Aug 31 2005
1789    
1790 manus 26913 build_tools_menu is
1791     -- Create and build `tools_menu'
1792     local
1793     command_menu_item: EB_COMMAND_MENU_ITEM
1794     menu_item: EV_MENU_ITEM
1795     do
1796 manus 51111 create tools_menu.make_with_text (Interface_names.m_tools)
1797 manus 26913
1798 xavier 28240 -- New Cluster command.
1799     command_menu_item := new_cluster_cmd.new_menu_item
1800     add_recyclable (command_menu_item)
1801     tools_menu.extend (command_menu_item)
1802 manus 26913
1803 xavier 28240 -- New Class command.
1804     command_menu_item := new_class_cmd.new_menu_item
1805     add_recyclable (command_menu_item)
1806     tools_menu.extend (command_menu_item)
1807    
1808     -- New Feature command.
1809     command_menu_item := new_feature_cmd.new_menu_item
1810     add_recyclable (command_menu_item)
1811     tools_menu.extend (command_menu_item)
1812 manus 51111
1813 xavier 28240 -- Delete class/cluster command.
1814     command_menu_item := delete_class_cluster_cmd.new_menu_item
1815     add_recyclable (command_menu_item)
1816     tools_menu.extend (command_menu_item)
1817    
1818     -- Separator --------------------------------------
1819     tools_menu.extend (create {EV_MENU_SEPARATOR})
1820    
1821    
1822 xavier 27549 if has_metrics then
1823     -- Metric tool
1824 xavier 28693 create metric_menu.make_with_text (interface_names.metric_metrics)
1825 xavier 27549 create menu_item.make_with_text (interface_names.metric_calculate)
1826     metric_menu.extend (menu_item)
1827     create menu_item.make_with_text (interface_names.metric_add)
1828     metric_menu.extend (menu_item)
1829     create menu_item.make_with_text (interface_names.metric_delete)
1830     metric_menu.extend (menu_item)
1831     create menu_item.make_with_text (interface_names.metric_details)
1832     metric_menu.extend (menu_item)
1833     create menu_item.make_with_text (interface_names.metric_new_metrics)
1834     metric_menu.extend (menu_item)
1835     create menu_item.make_with_text (interface_names.metric_management)
1836     metric_menu.extend (menu_item)
1837     create menu_item.make_with_text (interface_names.metric_archive)
1838     metric_menu.extend (menu_item)
1839     metric_menu.disable_sensitive
1840     tools_menu.extend (metric_menu)
1841     end
1842 manus 51111
1843 xavier 27549 if has_profiler then
1844     -- Profiler Window
1845     command_menu_item := show_profiler.new_menu_item
1846     add_recyclable (command_menu_item)
1847     tools_menu.extend (command_menu_item)
1848     end
1849 manus 26913
1850     -- Precompile Wizard
1851     command_menu_item := wizard_precompile_cmd.new_menu_item
1852     add_recyclable (command_menu_item)
1853     tools_menu.extend (command_menu_item)
1854    
1855 xavier 27549 if has_dll_generation then
1856     -- Dynamic Library Window
1857     command_menu_item := show_dynamic_lib_tool.new_menu_item
1858     add_recyclable (command_menu_item)
1859     tools_menu.extend (command_menu_item)
1860     end
1861 manus 26913
1862     -- Separator -------------------------------------------------
1863     tools_menu.extend (create {EV_MENU_SEPARATOR})
1864    
1865     -- Preferences
1866     command_menu_item := Show_preferences_cmd.new_menu_item
1867     add_recyclable (command_menu_item)
1868     tools_menu.extend (command_menu_item)
1869 xavier 30005
1870     -- External commands editor
1871     command_menu_item := Edit_external_commands_cmd.new_menu_item
1872     add_recyclable (command_menu_item)
1873     tools_menu.extend (command_menu_item)
1874    
1875     rebuild_tools_menu
1876 manus 26913 end
1877 manus 55527
1878 manus 26913 feature -- Stone process
1879    
1880     stone: STONE
1881     -- Current stone
1882    
1883     toggle_unified_stone is
1884     -- Change the stone management mode.
1885     do
1886     unified_stone := not unified_stone
1887     if unified_stone then
1888     send_stone_to_context
1889     send_stone_to_context_cmd.disable_sensitive
1890     context_tool.link_to_development_window
1891     else
1892     if stone /= Void then
1893     send_stone_to_context_cmd.enable_sensitive
1894     end
1895     context_tool.cut_from_development_window
1896     end
1897     end
1898    
1899     set_stone (a_stone: STONE) is
1900 xavier 29993 -- Change the currently focused stone.
1901     local
1902 xavier 30037 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
1903 xavier 29993 cv_cst: CLASSI_STONE
1904 neilc 49534 ef_stone: EXTERNAL_FILE_STONE
1905 xavier 29993 l: LIST [EB_DEVELOPMENT_WINDOW]
1906 neilc 49534 l_filename: STRING
1907 xavier 29993 do
1908     cv_cst ?= a_stone
1909     if cv_cst /= Void then
1910 neilc 49534 l_filename := cv_cst.class_i.name
1911     else
1912     ef_stone ?= a_stone
1913     if ef_stone /= Void then
1914     l_filename := ef_stone.file_name.string
1915     end
1916     end
1917 manus 51111
1918 neilc 49534 if cv_cst /= Void or ef_stone /= Void then
1919     l := Window_manager.development_windows_with_class (l_filename)
1920     if l.is_empty or else l.has (Current) then
1921 xavier 29993 -- We're not editing the class in another window.
1922     set_stone_after_first_check (a_stone)
1923     else
1924 manus 51111 create cd.make_initialized (2,
1925     preferences.dialog_data.already_editing_class_string,
1926     warning_messages.w_class_already_edited,
1927     Interface_names.l_do_not_show_again,
1928     preferences.preferences)
1929 manus 36309 cd.set_ok_action (agent set_stone_after_first_check (a_stone))
1930 xavier 29993 cd.show_modal_to_window (window)
1931     end
1932 manus 50607 else
1933     set_stone_after_first_check (a_stone)
1934 xavier 29993 end
1935     end
1936    
1937 manus 50607 set_stone_after_first_check (a_stone: STONE) is
1938     -- Display text associated with `a_stone', if any and if possible
1939     local
1940     feature_stone: FEATURE_STONE
1941     old_class_stone: CLASSI_STONE
1942     test_stone: CLASSI_STONE
1943     same_class: BOOLEAN
1944     conv_ferrst: FEATURE_ERROR_STONE
1945     ef_stone: EXTERNAL_FILE_STONE
1946 tedf 55179 cluster_st: CLUSTER_STONE
1947     new_class_stone: CLASSI_STONE
1948     conv_ace: ACE_SYNTAX_STONE
1949     conv_errst: ERROR_STONE
1950     conv_brkstone: BREAKABLE_STONE
1951 manus 50607 do
1952     old_class_stone ?= stone
1953     feature_stone ?= a_stone
1954     ef_stone ?= a_stone
1955 tedf 55179 new_class_stone ?= a_stone
1956     cluster_st ?= a_stone
1957 manus 55527
1958 tedf 55179 -- Update the history.
1959     conv_brkstone ?= a_stone
1960     conv_errst ?= a_stone
1961     conv_ace ?= a_stone
1962 manus 55527 if
1963 tedf 55179 conv_brkstone = Void and
1964     conv_errst = Void and
1965     conv_ace = Void and
1966 manus 55527 ef_stone = Void
1967 tedf 55179 then
1968     if
1969     new_class_stone /= Void
1970     then
1971     history_manager.extend (new_class_stone)
1972     elseif
1973     cluster_st /= Void
1974     then
1975     history_manager.extend (cluster_st)
1976     end
1977     end
1978 manus 55527
1979 manus 50607 if old_class_stone /= Void then
1980     create test_stone.make (old_class_stone.class_i)
1981     same_class := test_stone.same_as (a_stone)
1982     -- We need to compare classes. If `old_class_stone' is a FEATURE_STONE
1983     -- `same_as' will compare features. Therefore, we need `test_stone' to be sure
1984     -- we have a CLASSI_STONE.
1985     if same_class and then feature_stone /= Void then
1986     same_class := False
1987     -- if the stone corresponding to a feature of currently opened class is dropped
1988     -- we attempt to scroll to the feature without asking to save the file
1989     -- except if it is during a resynchronization, in which case we do not scroll at all.
1990     if editor_tool.text_area.text_is_fully_loaded then
1991 manus 26913 if not during_synchronization then
1992 tedf 55441 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
1993 tedf 55673 feature_stone_already_processed := True
1994 manus 50607 else
1995     feature_stone_already_processed := True
1996 manus 26913 end
1997 manus 50607 conv_ferrst ?= feature_stone
1998     if feature_stone_already_processed and conv_ferrst /= Void then
1999     -- Scroll to the line of the error.
2000     if not during_synchronization then
2001     editor_tool.text_area.display_line_when_ready (conv_ferrst.line_number, True)
2002     end
2003     end
2004 manus 26913 end
2005     end
2006 manus 50607 elseif ef_stone /= Void then
2007 manus 26913 end
2008 manus 51111
2009 manus 50607 -- first, let's check if there is already something in this window
2010     -- if there's nothing, there's no need to save anything...
2011     if stone = Void or else not changed or else feature_stone_already_processed or else same_class then
2012     set_stone_after_check (a_stone)
2013     feature_stone_already_processed := False
2014     else
2015     -- there is something to be saved
2016     -- if user chooses to save, current file will be parsed
2017 manus 51111 -- if there is a syntax_error, new file is not loaded
2018 manus 50607 save_and (agent set_stone_after_check (a_stone))
2019     if text_saved and then not syntax_is_correct then
2020     text_saved := False
2021     during_synchronization := True
2022     set_stone_after_check (stone)
2023     during_synchronization := False
2024     address_manager.refresh
2025     end
2026     end
2027 neilc 49534 end
2028 manus 50607
2029     force_stone (s: STONE) is
2030     -- make `s' the new value of `stone', and
2031     -- change the display accordingly. Try to
2032     -- extract a class from `s' whenever possible.
2033     do
2034     if s.is_storable then
2035     set_stone (s)
2036     if not unified_stone then
2037     context_tool.advanced_set_stone (s)
2038     end
2039 manus 26913 end
2040     end
2041    
2042 manus 50607 process_class (s: CLASSI_STONE) is
2043     -- Process class stone
2044     do
2045 neilc 49534 set_stone (s)
2046 manus 50607 end
2047 manus 51111
2048 manus 50607 process_feature_error (s: FEATURE_ERROR_STONE) is
2049     -- Process feature error stone.
2050     local
2051     cl_stone: CLASSC_STONE
2052     e_class: CLASS_C
2053     do
2054     set_default_format
2055     e_class := s.e_feature.written_class
2056     create cl_stone.make (e_class)
2057     set_stone (cl_stone)
2058     editor_tool.text_area.deselect_all
2059     if s.line_number > 0 then
2060     editor_tool.text_area.highlight_selected (s.line_number, s.line_number)
2061 manus 26913 end
2062     end
2063    
2064 manus 50607
2065     process_class_syntax (s: CL_SYNTAX_STONE) is
2066     -- Process class syntax.
2067     local
2068     cl_stone: CLASSC_STONE
2069     do
2070     -- call set_stone to ensure the proper class is displayed
2071     create cl_stone.make (s.e_class)
2072     set_stone (cl_stone)
2073     editor_tool.text_area.deselect_all
2074     editor_tool.text_area.highlight_when_ready (s.line, s.line)
2075 manus 26913 end
2076 manus 51111
2077 manus 50607 refresh is
2078     -- Synchronize clickable elements with text, if possible.
2079     do
2080     --| FIXME ARNAUD
2081     -- synchronise_stone
2082     --| END FIXME
2083     --| FIXME XR: Refresh current display in the editor.
2084     editor_tool.text_area.update_click_list (False)
2085     update_save_symbol
2086     address_manager.refresh
2087     -- The cluster manager should already be refreshed by the window manager.
2088     -- cluster_manager.refresh
2089     -- context_tool.refresh
2090     end
2091 manus 26913
2092 manus 52526 quick_refresh_editors is
2093     -- Redraw editors' drawing area.
2094 manus 50607 do
2095     editor_tool.text_area.refresh
2096 manus 52526 context_tool.quick_refresh_editors
2097 manus 50607 end
2098 manus 26913
2099 manus 52526 quick_refresh_margins is
2100     -- Redraw the main editor's drawing area.
2101     do
2102     editor_tool.text_area.margin.refresh
2103     context_tool.quick_refresh_margins
2104     end
2105    
2106 manus 50607 set_default_format is
2107     -- Default format of windows.
2108     --| FIXME ARNAUD: To be implemented.
2109     -- local
2110     -- f: EB_FORMATTER
2111     do
2112     -- if stone /= Void then
2113     -- if stone.class_i.hide_implementation then
2114     -- f := format_list.precompiled_default_format
2115     -- else
2116     -- f := format_list.default_format
2117     -- end
2118     -- else
2119     -- f := format_list.default_format
2120     -- end
2121     -- set_last_format (f)
2122     --| END FIXME
2123     end
2124 manus 26913
2125 tedf 55179 feature -- Position provider
2126    
2127     position: like position_internal is
2128     -- Currently shown text position in the editor
2129     do
2130     Result := editor_tool.text_area.first_line_displayed
2131 manus 55527 end
2132    
2133 tedf 55179 pos_container: like pos_container_internal is
2134     -- Current selected formatter
2135     local
2136     l_end : BOOLEAN
2137     do
2138     from
2139     managed_main_formatters.start
2140     until
2141     managed_main_formatters.after or l_end
2142     loop
2143     if managed_main_formatters.item.selected then
2144     l_end := true
2145     Result := managed_main_formatters.item
2146     end
2147     managed_main_formatters.forth
2148     end
2149     end
2150    
2151 manus 51111 feature -- Resource Update
2152 manus 26913
2153 manus 50607 update is
2154     -- Update Current with the registered resources.
2155     do
2156     lock_update
2157     -- Show/hide general toolbar
2158 king 55319 if development_window_data.show_general_toolbar then
2159 manus 50607 show_general_toolbar_command.enable_visible
2160     else
2161     show_general_toolbar_command.disable_visible
2162     end
2163 manus 26913
2164 manus 50607 -- Show/hide address toolbar
2165 king 55319 if development_window_data.show_address_toolbar then
2166 manus 50607 show_address_toolbar_command.enable_visible
2167     else
2168     show_address_toolbar_command.disable_visible
2169     end
2170 manus 26913
2171 manus 50607 -- Show/hide project toolbar
2172 king 55319 if development_window_data.show_project_toolbar then
2173 manus 50607 show_project_toolbar_command.enable_visible
2174     else
2175     show_project_toolbar_command.disable_visible
2176     end
2177    
2178 king 55319 left_panel.load_from_resource (development_window_data.left_panel_layout)
2179     right_panel.load_from_resource (development_window_data.right_panel_layout)
2180     splitter_position := development_window_data.left_panel_width
2181 manus 50607 update_splitters
2182     unlock_update
2183 manus 26913 end
2184    
2185 manus 50607 update_splitters is
2186 manus 51111 -- Refresh the position of the splitter on screen according to
2187 manus 50607 -- our internal values.
2188     do
2189     -- Set the interior layout
2190     if panel.full then
2191     panel.set_split_position (splitter_position.max (panel.minimum_split_position))
2192     end
2193 manus 26913 end
2194    
2195 manus 50607 register is
2196     -- Register to preferences we want notification of.
2197     do
2198 manus 26913 end
2199    
2200 manus 50607 unregister is
2201     -- unregister to preferences we want notification of.
2202     do
2203 manus 26913 end
2204    
2205 manus 50607 reset is
2206     -- Reset the window contents
2207     do
2208     Precursor
2209     address_manager.reset
2210 manus 26913
2211 manus 50607 --| FIXME ARNAUD, multiformat not yet implemented.
2212     -- format_list.enable_imp_formats_sensitive
2213     --| END FIXME
2214     end
2215 neilc 49534
2216 manus 50607 rebuild_tools_menu is
2217     -- Refresh the list of external commands.
2218     local
2219     ms: LIST [EB_COMMAND_MENU_ITEM]
2220 paulb 52511 l_sep: EV_MENU_SEPARATOR
2221 manus 50607 do
2222     -- Remove all the external commands, which are at the end of the menu.
2223     from
2224     tools_menu.go_i_th (tools_menu.count + 1 - number_of_displayed_external_commands)
2225     until
2226     tools_menu.after
2227     loop
2228     tools_menu.remove
2229     end
2230     ms := Edit_external_commands_cmd.menus
2231     number_of_displayed_external_commands := ms.count
2232 manus 55527
2233 paulb 52511 if not ms.is_empty and not tools_menu.is_empty then
2234     l_sep ?= tools_menu.last
2235     if l_sep = Void then
2236     create l_sep
2237     tools_menu.extend (l_sep)
2238     number_of_displayed_external_commands := number_of_displayed_external_commands + 1
2239     end
2240     end
2241    
2242 manus 50607 from
2243     ms.start
2244     until
2245     ms.after
2246     loop
2247     tools_menu.extend (ms.item)
2248     add_recyclable (ms.item)
2249     ms.forth
2250     end
2251     end
2252 neilc 49534
2253 manus 50607 syntax_is_correct: BOOLEAN is
2254     -- file was successfully parsed.
2255     do
2256     Result := editor_tool.text_area.syntax_is_correct
2257     end
2258 manus 26913
2259 manus 50607 on_project_created is
2260     -- Inform tools that the current project has been loaded or re-loaded.
2261     do
2262     build_menu_bar
2263     enable_commands_on_project_created
2264     context_tool.on_project_created
2265     address_manager.on_project_created
2266     if has_dll_generation then
2267     show_dynamic_lib_tool.enable_sensitive
2268     end
2269     if has_profiler then
2270     show_profiler.enable_sensitive
2271     end
2272 xavier 30005 end
2273 manus 50607
2274     on_project_loaded is
2275     -- Inform tools that the current project has been loaded or re-loaded.
2276     do
2277 jfiat 54577 -- cluster_manager.on_project_loaded
2278 manus 50607 enable_commands_on_project_loaded
2279     cluster_tool.on_project_loaded
2280     context_tool.on_project_loaded
2281 jfiat 54610 breakpoints_tool.on_project_loaded
2282 manus 26913 end
2283    
2284 manus 50607 on_project_unloaded is
2285     -- Inform tools that the current project will soon been unloaded.
2286     do
2287 jfiat 54577 -- cluster_manager.on_project_unloaded
2288 manus 50607 disable_commands_on_project_unloaded
2289     cluster_tool.on_project_unloaded
2290     context_tool.on_project_unloaded
2291     address_manager.on_project_unloaded
2292     build_menu_bar
2293     if has_dll_generation then
2294     show_dynamic_lib_tool.disable_sensitive
2295     end
2296     if has_profiler then
2297     show_profiler.disable_sensitive
2298     end
2299 manus 26913 end
2300    
2301 manus 50607 save_before_compiling is
2302     -- save the text but do not update clickable positions
2303     do
2304     save_only := True
2305     save_text
2306 manus 26913 end
2307    
2308 manus 50607 perform_check_before_save is
2309     -- Perform any pre-save operations/checks
2310     local
2311     dial: EV_CONFIRMATION_DIALOG
2312     do
2313     debug ("EDITOR")
2314     if editor_tool.text_area.current_text /= Void and then changed then
2315     io.error.put_string ("%N Warning: Attempting to save a non editable format%N")
2316     end
2317 tedf 55302 end
2318 tedf 55338 if preferences.editor_data.auto_remove_trailing_blank_when_saving then
2319     editor_tool.text_area.text_displayed.remove_trailing_blanks
2320 tedf 55302 editor_tool.text_area.refresh_now
2321     end
2322 manus 50607 if editor_tool.text_area.open_backup then
2323 manus 51111 create dial.make_with_text(Warning_messages.w_save_backup)
2324 manus 50607 dial.set_buttons_and_actions(<<"Continue", "Cancel">>, <<agent continue_save, agent cancel_save>>)
2325     dial.set_default_push_button(dial.button("Continue"))
2326     dial.set_default_cancel_button(dial.button("Cancel"))
2327     dial.set_title ("Save Backup")
2328     dial.show_modal_to_window (window)
2329     else
2330     check_passed := True
2331     end
2332 manus 26913 end
2333 manus 50607
2334     continue_save is
2335     -- continue saving
2336     do
2337 manus 26913 check_passed := True
2338     end
2339    
2340 manus 50607 cancel_save is
2341     -- cancel saving
2342     do
2343     check_passed := False
2344     end
2345 manus 26913
2346 manus 50607 process is
2347     -- process the user entry in the address bar
2348 tedf 55839 local
2349     l_class_stone: CLASSI_STONE
2350     l_multi_search_tool: EB_MULTI_SEARCH_TOOL
2351 manus 50607 do
2352     save_canceled := False
2353 tedf 55839 l_class_stone ?= stone
2354     if l_class_stone /= Void then
2355     l_multi_search_tool ?= search_tool
2356     if l_multi_search_tool /= Void then
2357     l_multi_search_tool.class_changed (l_class_stone.class_i)
2358     end
2359     end
2360 manus 50607 end
2361 manus 26913
2362 manus 50607 on_text_saved is
2363     -- Notify the editor that the text has been saved
2364     local
2365     str: STRING
2366     do
2367     Precursor
2368     editor_tool.on_text_saved
2369     text_saved := True
2370     if not save_only then
2371     editor_tool.text_area.update_click_list (True)
2372     end
2373     save_only := False
2374     str := title.twin
2375     if str @ 1 = '*' then
2376     str.keep_tail (str.count - 2)
2377     set_title (str)
2378     end
2379     update_formatters
2380     if editor_tool.text_area.syntax_is_correct then
2381     status_bar.display_message ("")
2382     else
2383     status_bar.display_message (Interface_names.L_syntax_error)
2384     end
2385     text_edited := False
2386 manus 26913 end
2387    
2388 neilc 51796 on_focus is
2389     -- Focus gained
2390 neilc 51830 local
2391     editor: TEXT_PANEL
2392 neilc 51796 do
2393 neilc 51830 editor ?= editor_tool.text_area
2394     if editor /= Void then
2395     editor.on_focus
2396     end
2397 neilc 51796 end
2398    
2399 manus 50607 save_and (an_action: PROCEDURE [ANY, TUPLE]) is
2400     local
2401     save_dialog: EB_CONFIRM_SAVE_DIALOG
2402     do
2403     save_canceled := True
2404     text_saved := False
2405     create save_dialog.make_and_launch (Current,Current)
2406     if not save_canceled and then syntax_is_correct then
2407     an_action.call(Void)
2408     end
2409 manus 26913 end
2410    
2411 manus 51111 feature -- Window management
2412 manus 26913
2413 manus 50607 show_window is
2414     -- Show the window
2415     do
2416     show
2417     end
2418 manus 26913
2419 manus 50607 raise_window is
2420     -- Show the window and set the focus to it.
2421     do
2422     show
2423     --| FIXME, set the focus.
2424     end
2425 manus 26913
2426 manus 50607 hide_window is
2427     -- Hide the window
2428     do
2429     hide
2430     end
2431 manus 26913
2432 manus 50607 destroy_window is
2433     -- Destroy the window.
2434     do
2435     destroy
2436     end
2437 manus 26913
2438 manus 50607 give_focus is
2439     -- Give the focus to the address manager.
2440     do
2441     address_manager.set_focus
2442 manus 26913 end
2443 manus 51111
2444 manus 50607 save_layout is
2445     -- Store layout of `current'.
2446     do
2447 king 55319 save_layout_to_window_data (development_window_data)
2448     -- Commit saves
2449     preferences.preferences.save_resources
2450     end
2451    
2452     save_layout_to_session (a_session: ES_SESSION) is
2453     -- Save session data of `Current' to session object `a_session'.
2454     local
2455     a_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA
2456     a_class_i: CLASSI_STONE
2457     do
2458     create a_window_data.make_from_window_data (preferences.development_window_data)
2459 manus 55527
2460 king 55319 a_class_i ?= stone
2461     if a_class_i /= Void then
2462     a_window_data.save_filename (a_class_i.file_name)
2463     a_window_data.save_editor_position (editor_tool.text_area.current_cursor_position)
2464     end
2465 manus 55527
2466 king 55319 if context_tool /= Void then
2467     a_window_data.save_context_data (
2468     context_tool.address_manager.cluster_label_text,
2469     context_tool.address_manager.class_label_text,
2470     context_tool.address_manager.feature_label_text,
2471     context_tool.notebook.selected_item_index
2472     )
2473     end
2474    
2475     save_layout_to_window_data (a_window_data)
2476 manus 55527
2477 king 55319 -- Add the session data of `Current' to the session object.
2478     a_session.window_session_data.extend (a_window_data)
2479     end
2480    
2481     save_layout_to_window_data (a_window_data: EB_DEVELOPMENT_WINDOW_DATA) is
2482     -- Store window data of `Current' in `a_window_data'.
2483     require
2484     a_window_data_not_void: a_window_data /= Void
2485     do
2486 manus 50607 -- Now save the windows's layout, but only if the
2487     -- debugger is not displayed in `Current'. By saving the layout,
2488     -- we ensure that future windows may use exactly the same layout.
2489 king 55319 -- If the debugger is displayed, the previous layout is already saved,
2490 manus 50607 -- and this is the one that must be used, as only one debugger is ever displayed.
2491     if (Application.is_running and debugger_manager.debugging_window /= Current) or not application.is_running then
2492 king 55319 a_window_data.save_left_panel_layout (left_panel.save_to_resource)
2493     a_window_data.save_right_panel_layout (right_panel.save_to_resource)
2494     a_window_data.save_left_panel_width (panel.split_position)
2495 manus 50607 -- Save width & height.
2496 king 55319 a_window_data.save_size (window.width, window.height)
2497     a_window_data.save_window_state (window.is_minimized, window.is_maximized)
2498     a_window_data.save_position (window.x_position, window.y_position)
2499 manus 50607 end
2500 manus 55527 a_window_data.save_show_search_options (search_tool.options_shown)
2501 manus 50607 end
2502 manus 26913
2503 manus 55527
2504 manus 51111 feature -- Tools & Controls
2505 manus 26913
2506 manus 50607 editor_tool: EB_EDITOR_TOOL
2507 manus 26913
2508 manus 50607 favorites_tool: EB_FAVORITES_TOOL
2509 manus 26913
2510 manus 50607 cluster_tool: EB_CLUSTER_TOOL
2511 manus 26913
2512 manus 50607 search_tool: EB_SEARCH_TOOL
2513 manus 26913
2514 manus 50607 features_tool: EB_FEATURES_TOOL
2515 manus 26913
2516 manus 55527 breakpoints_tool: ES_BREAKPOINTS_TOOL
2517    
2518 manus 50607 windows_tool: EB_WINDOWS_TOOL
2519 manus 26913
2520 manus 50607 context_tool: EB_CONTEXT_TOOL
2521     -- Context explorer for current class and system.
2522 manus 26913
2523 manus 50607 address_manager: EB_ADDRESS_MANAGER
2524     -- Text field in the toolbar
2525     -- Allow user to enter the name
2526     -- of the class he wants to edit.
2527 manus 26913
2528 manus 50607 project_manager: EB_PROJECT_MANAGER is
2529     -- Project manager associated to the project the user is working on.
2530     do
2531     Result := Eiffel_project.manager
2532     end
2533 manus 26913
2534 manus 50607 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2535     -- All formatters that operate on a class.
2536 manus 26913
2537 manus 50607 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2538     -- All formatters that operate on a class.
2539 manus 26913
2540 manus 50607 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2541     -- All formatters that can be displayed in the main editor frame.
2542 manus 26913
2543 manus 50607 unified_stone: BOOLEAN
2544     -- Is the stone common with the context tool or not?
2545 manus 51111
2546 manus 50607 arguments_dialog: EB_ARGUMENT_DIALOG
2547     -- The arguments dialog for current, if any
2548 manus 51111
2549 manus 50607 goto_dialog: EB_GOTO_DIALOG
2550     -- The goto dialog for line number access
2551 manus 26913
2552 manus 51111 feature -- Multiple editor management
2553 manus 26913
2554 manus 50607 add_editor_to_list (an_editor: EB_EDITOR) is
2555     -- adds `an_editor' to `editors'
2556     do
2557     editors.extend (an_editor)
2558     end
2559 neilc 49534
2560 manus 50607 current_editor: EB_EDITOR is
2561     -- current editor, if none, main editor
2562     do
2563     if current_editor_index /= 0 then
2564     Result := editors @ current_editor_index
2565     else
2566     Result := editors.first
2567     end
2568 manus 26913 end
2569 manus 51111
2570 manus 50607 set_current_editor (an_editor: EB_EDITOR) is
2571     -- set `an_editor' as main editor
2572     local
2573     old_index: INTEGER
2574     new_index: INTEGER
2575     do
2576     old_index := current_editor_index
2577     new_index := editors.index_of (an_editor, 1)
2578     if
2579     editors.valid_index (new_index) and
2580     old_index /= new_index
2581     then
2582     current_editor_index := new_index
2583     update_paste_cmd
2584     -- Last thing, update the menu entry for the formatting marks.
2585     if current_editor.view_invisible_symbols then
2586 manus 51111 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
2587 manus 50607 else
2588 manus 51111 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
2589 manus 50607 end
2590     command_controller.set_current_editor (an_editor)
2591 xavier 27840 end
2592 manus 50607 end
2593    
2594     update_paste_cmd is
2595     -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2596     do
2597     if
2598     not current_editor.is_empty and then
2599     current_editor.is_editable and then
2600     current_editor.clipboard.has_text
2601     then
2602     editor_paste_cmd.enable_sensitive
2603 xavier 27860 else
2604 manus 50607 editor_paste_cmd.disable_sensitive
2605 xavier 27860 end
2606     end
2607 neilc 49534
2608 manus 51111 feature {NONE} -- Multiple editor management
2609    
2610 manus 50607 editors: ARRAYED_LIST [EB_EDITOR]
2611     -- editor contained in `Current'
2612    
2613     current_editor_index: INTEGER
2614     -- Index in `editors' of the editor that has the focus.
2615 manus 51111
2616     feature {EB_FEATURES_TOOL, EB_FEATURES_TREE, DOTNET_CLASS_AS, DOTNET_CLASS_CONTEXT} -- Feature Clauses
2617    
2618 manus 50607 set_feature_clauses (a_features: ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]]; a_type: STRING) is
2619     -- Set 'features' to 'a_features' and store in hash table with key 'a_type' denoting name of consumed
2620     -- type pertinent to 'a_features'.
2621     require
2622     a_features_not_void: a_features /= Void
2623     do
2624     if feature_clauses = Void then
2625     create feature_clauses.make (5)
2626     end
2627     feature_clauses.put (a_features, a_type)
2628 neilc 49534 end
2629 manus 51111
2630 tedf 56237 set_feature_locating (a_locating: BOOLEAN) is
2631     -- Set `feature_locating' with `a_locating'.
2632     do
2633     feature_locating := a_locating
2634     end
2635    
2636 manus 50607 get_feature_clauses (a_type: STRING): ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]] is
2637     -- Get list of feature clauses relevant to .NET type with name 'a_type'.
2638     require
2639     a_type_not_void: a_type /= Void
2640     has_type_clauses: feature_clauses.has (a_type)
2641     do
2642     Result := feature_clauses.item (a_type)
2643     ensure
2644     result_not_void: Result /= Void
2645 neilc 33858 end
2646 manus 51111
2647 manus 50607 feature_clauses: HASH_TABLE [ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]], STRING]
2648     -- List of features clauses for Current window hashed by the .NET name of the consumed_type.
2649 manus 51111
2650 manus 50607 feature_positions: HASH_TABLE [INTEGER, E_FEATURE]
2651     -- Features indexed by line position in class text (for .NET features).
2652 manus 26913
2653 tedf 56237 feature_locating: BOOLEAN
2654     -- Is feature tool locating a feature?
2655    
2656 manus 51111 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2657 manus 26913
2658 manus 50607 destroy_imp is
2659     -- Destroy window.
2660     do
2661     -- To avoid reentrance
2662     if not is_destroying then
2663     is_destroying := True
2664     -- If a launched application is still running, kill it.
2665     if Application.is_running and then debugger_manager.debugging_window = Current then
2666     Application.kill
2667     else
2668 king 55319 development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2669     development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2670 manus 50607 end
2671 king 55319 development_window_data.save_left_panel_width (panel.split_position)
2672 manus 50607 -- Save width & height.
2673 king 55319 development_window_data.save_size (window.width, window.height)
2674     development_window_data.save_window_state (window.is_minimized, window.is_maximized)
2675     development_window_data.save_position (window.x_position, window.y_position)
2676 manus 50607 left_panel.wipe_out
2677     right_panel.wipe_out
2678 king 55319 development_window_data.save_show_search_options (search_tool.options_shown)
2679 manus 50607 hide
2680 manus 26913
2681 manus 50607 -- Commit saves
2682 manus 51180 preferences.preferences.save_resources
2683 manus 26913
2684 manus 50607 toolbars_area.wipe_out
2685     address_manager.recycle
2686     project_customizable_toolbar.recycle
2687     Precursor {EB_TOOL_MANAGER}
2688 manus 26913
2689 manus 50607 managed_class_formatters.wipe_out
2690     managed_feature_formatters.wipe_out
2691     managed_main_formatters.wipe_out
2692     toolbarable_commands.wipe_out
2693     editors.wipe_out
2694     stone := Void
2695 neilc 49534 end
2696     end
2697    
2698 manus 51111 feature {NONE} -- Implementation
2699 neilc 49534
2700 manus 50607 set_stone_after_check (a_stone: STONE) is
2701     local
2702     old_stone: STONE
2703     new_class_stone: CLASSI_STONE
2704     old_class_stone: CLASSI_STONE
2705     conv_classc: CLASSC_STONE
2706     conv_brkstone: BREAKABLE_STONE
2707     cluster_st: CLUSTER_STONE
2708 tedf 55179 old_cluster_st: CLUSTER_STONE
2709 manus 50607 feature_stone: FEATURE_STONE
2710     conv_ferrst: FEATURE_ERROR_STONE
2711 manus 51111
2712 manus 50607 ef_stone: EXTERNAL_FILE_STONE
2713     f: FILE
2714 manus 51111
2715 manus 50607 l_format_context: FORMAT_CONTEXT
2716     conv_errst: ERROR_STONE
2717 alexk 51083 cl_syntax_stone: CL_SYNTAX_STONE
2718     error_line: INTEGER
2719 manus 50607 class_file: RAW_FILE
2720     class_text_exists: BOOLEAN
2721     same_class: BOOLEAN
2722     test_stone: CLASSI_STONE
2723     conv_ace: ACE_SYNTAX_STONE
2724     externali: EXTERNAL_CLASS_I
2725     external_cons: CONSUMED_TYPE
2726     str: STRING
2727     dotnet_class: BOOLEAN
2728     l_short_formatter: EB_SHORT_FORMATTER
2729     l_flat_formatter: EB_FLAT_SHORT_FORMATTER
2730 tedf 55179 l_main_formatter: EB_CLASS_TEXT_FORMATTER
2731 manus 50607 do
2732     -- the text does not change if the text was saved with syntax errors
2733     cur_wid := window
2734     if cur_wid = Void then
2735     --| Do nothing.
2736 manus 26913 else
2737 manus 50607 if old_cur = Void then
2738     old_cur := cur_wid.pointer_style
2739     end
2740     -- cur_wid.enable_capture
2741     cur_wid.set_pointer_style (Wait_cursor)
2742 neilc 49534 end
2743 manus 26913
2744 manus 50607 conv_brkstone ?= a_stone
2745     conv_errst ?= a_stone
2746     conv_ace ?= a_stone
2747     ef_stone ?= a_stone
2748     if conv_brkstone /= Void then
2749     if Application.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2750     Application.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2751     else
2752     Application.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2753 manus 26913 end
2754 jfiat 55044 Debugger_manager.notify_breakpoints_changes
2755 manus 50607 elseif conv_errst /= Void then
2756     display_error_help_cmd.execute_with_stone (conv_errst)
2757     elseif conv_ace /= Void then
2758     --| FIXME XR: What should we do?!
2759     elseif ef_stone /= Void then
2760     f := ef_stone.file
2761     f.make_open_read (f.name)
2762     f.read_stream (f.count)
2763     f.close
2764     editor_tool.text_area.load_text (f.last_string)
2765     else
2766     -- Remember previous stone.
2767     old_stone := stone
2768     old_class_stone ?= stone
2769 tedf 55179 old_cluster_st ?= stone
2770 manus 51111
2771 manus 50607 -- New stone properties
2772     new_class_stone ?= a_stone
2773    
2774     -- Set the stone.
2775     old_set_stone (a_stone)
2776     cluster_st ?= a_stone
2777 manus 51111
2778 manus 50607 new_feature_cmd.disable_sensitive
2779 alexk 51136 toggle_feature_alias_cmd.disable_sensitive
2780 manus 50607 toggle_feature_signature_cmd.disable_sensitive
2781 alexk 51887 toggle_feature_assigner_cmd.disable_sensitive
2782 manus 51111
2783 manus 50607 -- We update the state of the `Add to Favorites' command.
2784     if new_class_stone /= Void then
2785     favorites_menu.first.enable_sensitive
2786     else
2787     favorites_menu.first.disable_sensitive
2788 neilc 49534 end
2789 manus 26913
2790 manus 50607 -- Update the address manager if needed.
2791     address_manager.refresh
2792     if new_class_stone /= Void then
2793 manus 54781 -- Text is now editable.
2794     editor_tool.text_area.set_read_only (False)
2795    
2796 manus 50607 -- class stone was dropped
2797     create class_file.make (new_class_stone.class_i.file_name)
2798     class_text_exists := class_file.exists
2799     feature_stone ?= a_stone
2800     --| We have to create a classi_stone to check whether the stones are really similar.
2801     --| Otherwise a redefinition of same_as may be called.
2802     create test_stone.make (new_class_stone.class_i)
2803     if test_stone.same_as (old_class_stone) then
2804     same_class := True
2805     end
2806     if not feature_stone_already_processed then
2807 manus 51111 if same_class and then text_saved then
2808 manus 50607 -- nothing changed in the editor
2809     -- we only have to update click_list
2810     if editor_tool.text_area.is_editable then
2811     editor_tool.text_area.update_click_list (False)
2812     end
2813 manus 26913 else
2814 manus 50607 if changed then
2815     -- user has already chosen not to save the file
2816     -- do not ask again
2817     Feature_positions.wipe_out
2818     editor_tool.text_area.no_save_before_next_load
2819     end
2820 manus 26913 end
2821     end
2822 manus 55527
2823 tedf 55179 conv_classc ?= new_class_stone
2824 neilc 49534
2825 tedf 55179 -- First choose possible formatter
2826     l_main_formatter ?= new_class_stone.pos_container
2827     if l_main_formatter /= Void and not during_synchronization then
2828 manus 55527 if
2829 tedf 55179 not (conv_classc /= Void and class_text_exists and (not changed or not same_class))
2830     then
2831     l_main_formatter.enable_select
2832 manus 55527 elseif feature_stone = Void then
2833 tedf 55179 if l_main_formatter /= pos_container then
2834     l_main_formatter.enable_select
2835     end
2836 tedf 55267 if new_class_stone.position > 0 then
2837     editor_tool.text_area.display_line_at_top_when_ready (new_class_stone.position)
2838 manus 55527 end
2839 tedf 55179 end
2840     end
2841 manus 55527
2842 manus 50607 if conv_classc = Void or else
2843     conv_classc.e_class.is_external or else
2844 manus 51111 feature_stone /= Void and not
2845 manus 50607 feature_stone_already_processed and not
2846     (same_class and context_tool.sending_stone) then
2847     -- If a classi_stone or a feature_stone or a external call
2848     -- has been dropped, check to see if a .NET class.
2849     if class_text_exists then
2850     if new_class_stone.class_i.is_external_class then
2851     externali ?= new_class_stone.class_i
2852 manus 52122 check
2853     externali_not_void: externali /= Void
2854     end
2855     external_cons := externali.external_consumed_type
2856 manus 50607 if external_cons /= Void then
2857     -- A .NET class.
2858     dotnet_class := True
2859     l_short_formatter ?= managed_main_formatters.i_th (4)
2860     l_flat_formatter ?= managed_main_formatters.i_th (5)
2861     if l_short_formatter /= Void then
2862     l_short_formatter.set_dotnet_mode (True)
2863     end
2864     if l_flat_formatter /= Void then
2865     l_flat_formatter.set_dotnet_mode (True)
2866     end
2867 manus 51111 end
2868 tedf 55267 elseif feature_stone /= Void then
2869     from
2870     managed_main_formatters.start
2871     until
2872     managed_main_formatters.after
2873     loop
2874     managed_main_formatters.item.set_stone (new_class_stone)
2875     managed_main_formatters.forth
2876     end
2877 manus 50607 else
2878     managed_main_formatters.first.set_stone (new_class_stone)
2879     managed_main_formatters.first.execute
2880     end
2881     else
2882     editor_tool.text_area.clear_window
2883     editor_tool.text_area.display_message (
2884     Warning_messages.w_file_not_exist (
2885     new_class_stone.class_i.file_name))
2886 neilc 33365 end
2887 manus 50607 end
2888     if conv_classc = Void then
2889     --| The dropped class is not compiled.
2890     --| Display only the textual formatter.
2891     if dotnet_class then
2892     managed_main_formatters.i_th (4).set_stone (new_class_stone)
2893     managed_main_formatters.i_th (5).set_stone (new_class_stone)
2894 manus 51111 managed_main_formatters.i_th (4).execute
2895 manus 50607 end
2896     address_manager.disable_formatters
2897 neilc 33365 else
2898 manus 50607 --| We have a compiled class.
2899     if
2900     class_text_exists and then
2901     Eiffel_project.Workbench.last_reached_degree <= 2
2902     then
2903     new_feature_cmd.enable_sensitive
2904 alexk 51136 toggle_feature_alias_cmd.enable_sensitive
2905 manus 50607 toggle_feature_signature_cmd.enable_sensitive
2906 alexk 51887 toggle_feature_assigner_cmd.enable_sensitive
2907 manus 50607 end
2908    
2909     --address_manager.enable_formatters
2910     update_formatters
2911     if not class_text_exists then
2912     --| Disable the textual formatter.
2913     managed_main_formatters.first.disable_sensitive
2914     from
2915     managed_main_formatters.start
2916     until
2917     managed_main_formatters.after
2918     loop
2919     managed_main_formatters.item.set_stone (new_class_stone)
2920     managed_main_formatters.forth
2921     end
2922     managed_main_formatters.i_th (2).execute
2923     else
2924     if not changed or not same_class then
2925     --| Enable all formatters.
2926     if
2927 tedf 55267 (not feature_stone_already_processed or
2928 manus 55527 not managed_main_formatters.first.selected) and
2929 tedf 55267 feature_stone = Void
2930 manus 50607 then
2931     from
2932     managed_main_formatters.start
2933     until
2934     managed_main_formatters.after
2935     loop
2936     managed_main_formatters.item.set_stone (new_class_stone)
2937     managed_main_formatters.forth
2938     end
2939     end
2940     else
2941 tedf 55673 if not feature_stone_already_processed then
2942     address_manager.disable_formatters
2943     from
2944     managed_main_formatters.start
2945     until
2946     managed_main_formatters.after
2947     loop
2948     managed_main_formatters.item.set_stone (new_class_stone)
2949     managed_main_formatters.forth
2950     end
2951 xavier 28693 end
2952 manus 26913 end
2953     end
2954     end
2955 tedf 56214 if managed_main_formatters.first.selected then
2956     editor_tool.text_area.set_read_only (false)
2957     else
2958     editor_tool.text_area.set_read_only (true)
2959     end
2960 manus 50607 else
2961 manus 51111 -- not a class text : cannot be edited
2962 manus 53708 editor_tool.text_area.set_read_only (True)
2963 manus 50607 address_manager.disable_formatters
2964 manus 26913
2965 manus 50607 --| Disable all formatters.
2966     from
2967     managed_main_formatters.start
2968     until
2969     managed_main_formatters.after
2970     loop
2971     managed_main_formatters.item.set_stone (Void)
2972     managed_main_formatters.forth
2973     end
2974     if cluster_st /= Void then
2975     --| FIXME XR: Really manage cluster display in the main editor
2976 jfiat 54401 l_format_context := formatted_context_for_cluster (cluster_st.cluster_i)
2977 manus 50607 editor_tool.text_area.process_text (l_format_context.text)
2978 tedf 55179 if cluster_st.position > 0 then
2979     editor_tool.text_area.display_line_at_top_when_ready (cluster_st.position)
2980     end
2981 manus 50607 --| END FIXME
2982     end
2983 neilc 49534 end
2984 alexk 51083 if class_text_exists then
2985     if feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
2986     conv_ferrst ?= feature_stone
2987     if conv_ferrst /= Void then
2988     error_line := conv_ferrst.line_number
2989     else
2990     -- if a feature_stone has been dropped
2991     -- scroll to the corresponding feature in the basic text format
2992     if not during_synchronization then
2993     scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
2994     end
2995     end
2996 manus 50607 else
2997 alexk 51083 cl_syntax_stone ?= a_stone
2998     if cl_syntax_stone /= Void then
2999     error_line := cl_syntax_stone.line
3000 manus 50607 end
3001 manus 26913 end
3002 alexk 51083 if error_line > 0 then
3003     -- Scroll to the line of the error.
3004     editor_tool.text_area.display_line_when_ready (error_line, True)
3005     end
3006 manus 26913 end
3007 manus 50607 -- Update the title of the window
3008     if a_stone /= Void then
3009     if changed then
3010     str := a_stone.header.twin
3011     str.prepend ("* ")
3012     set_title (str)
3013     else
3014     set_title (a_stone.header)
3015     end
3016 neilc 49534 else
3017 manus 51111 set_title (Interface_names.t_empty_development_window)
3018 manus 26913 end
3019 manus 50607
3020     -- Refresh the tools.
3021     features_tool.set_stone (a_stone)
3022     cluster_tool.set_stone (a_stone)
3023     -- Update the context tool.
3024     if unified_stone then
3025     context_tool.set_stone (a_stone)
3026     end
3027    
3028 neilc 49534 end
3029 manus 50607 if
3030     stone /= Void and then
3031     not unified_stone
3032     then
3033     send_stone_to_context_cmd.enable_sensitive
3034 manus 26913 else
3035 manus 50607 send_stone_to_context_cmd.disable_sensitive
3036 manus 26913 end
3037 manus 50607 if cur_wid = Void then
3038     --| Do nothing.
3039 manus 51111 else
3040 manus 50607 cur_wid.set_pointer_style (old_cur)
3041     old_cur := Void
3042     -- cur_wid.disable_capture
3043     cur_wid := Void
3044 manus 26913 end
3045     end
3046    
3047 jfiat 54401 formatted_context_for_cluster (a_cluster: CLUSTER_I): FORMAT_CONTEXT is
3048     -- Formatted context representing the list of classes inside `a_cluster'.
3049     require
3050     a_cluster_not_void: a_cluster /= Void
3051     local
3052 jfiat 54437 l_assembly: ASSEMBLY_I
3053 jfiat 54402 l_sorted_cluster: EB_SORTED_CLUSTER
3054 jfiat 54401 l_format_context: FORMAT_CONTEXT
3055     l_indexes: INDEXING_CLAUSE_AS
3056 jfiat 54402 l_classes: LIST [CLASS_I]
3057 manus 55527 l_subclu: LIST [EB_SORTED_CLUSTER]
3058 jfiat 54401 l_cl_i: CLASS_I
3059     l_list_cl_i: LIST [CLASS_I]
3060     l_cluster: CLUSTER_I
3061     l_assert_level: ASSERTION_I
3062     do
3063     create l_format_context.make_for_case
3064 manus 55527
3065 jfiat 54401 l_format_context.put_text_item (ti_indexing_keyword)
3066     l_format_context.put_new_line
3067     l_format_context.indent
3068 jfiat 54437 if a_cluster.is_assembly then
3069     l_assembly ?= a_cluster
3070     check l_assembly /= Void end
3071     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("assembly_name"))
3072     l_format_context.put_text_item_without_tabs (ti_colon)
3073     l_format_context.put_space
3074     l_format_context.put_quoted_string_item (l_assembly.assembly_name)
3075     l_format_context.put_new_line
3076     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("assembly_path"))
3077     l_format_context.put_text_item_without_tabs (ti_colon)
3078     l_format_context.put_space
3079     l_format_context.put_quoted_string_item (l_assembly.assembly_path)
3080     l_format_context.put_new_line
3081 manus 55527
3082 jfiat 54437 end
3083 jfiat 54401 l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("cluster"))
3084     l_format_context.put_text_item_without_tabs (ti_colon)
3085     l_format_context.put_space
3086     l_format_context.put_quoted_string_item (a_cluster.cluster_name)
3087    
3088     l_format_context.put_new_line
3089     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("cluster_path"))
3090     l_format_context.put_text_item_without_tabs (ti_colon)
3091     l_format_context.put_space
3092     l_format_context.put_quoted_string_item (a_cluster.path)
3093     l_format_context.put_new_line
3094     l_indexes := a_cluster.indexes
3095     if l_indexes /= Void then
3096     l_format_context.format_indexing_with_no_keyword (l_indexes)
3097 manus 55527 l_format_context.put_new_line
3098 jfiat 54401 end
3099 manus 55527
3100 jfiat 54401 if a_cluster.parent_cluster /= Void then
3101     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("parent cluster"))
3102     l_format_context.put_text_item_without_tabs (ti_colon)
3103     l_format_context.put_new_line
3104     l_format_context.indent
3105     l_format_context.put_manifest_string (" - ")
3106 manus 55527
3107 jfiat 54401 l_format_context.put_clusteri (a_cluster.parent_cluster)
3108     l_format_context.put_new_line
3109     l_format_context.exdent
3110     end
3111 jfiat 54402
3112     create l_sorted_cluster.make (a_cluster)
3113    
3114     if not l_sorted_cluster.clusters.is_empty then
3115 jfiat 54401 l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("sub cluster(s)"))
3116     l_format_context.put_text_item_without_tabs (ti_colon)
3117     l_format_context.put_new_line
3118     l_format_context.indent
3119     from
3120 jfiat 54402 l_subclu := l_sorted_cluster.clusters
3121 jfiat 54401 l_subclu.start
3122     until
3123     l_subclu.after
3124     loop
3125 jfiat 54402 l_cluster := l_subclu.item.actual_cluster
3126 jfiat 54401 l_format_context.put_manifest_string (" - ")
3127     l_format_context.put_clusteri (l_cluster)
3128     l_format_context.put_space
3129     l_format_context.put_text_item_without_tabs (ti_L_parenthesis)
3130     l_format_context.put_comment_text (l_cluster.classes.count.out)
3131 manus 55527 l_format_context.put_text_item_without_tabs (ti_R_parenthesis)
3132 jfiat 54401 l_format_context.put_new_line
3133     l_subclu.forth
3134     end
3135     l_format_context.exdent
3136     end
3137    
3138 jfiat 54402 if not l_sorted_cluster.classes.is_empty then
3139 jfiat 54401 l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("class(es)"))
3140     l_format_context.put_text_item_without_tabs (ti_colon)
3141     l_format_context.put_new_line
3142     l_format_context.indent
3143     from
3144 jfiat 54402 l_classes := l_sorted_cluster.classes
3145 jfiat 54401 l_classes.start
3146     until
3147     l_classes.after
3148     loop
3149 jfiat 54402 l_cl_i := l_classes.item
3150 jfiat 54401 l_assert_level := l_cl_i.assertion_level
3151     l_format_context.put_manifest_string (" - ")
3152     l_format_context.put_classi (l_cl_i)
3153     l_format_context.put_text_item_without_tabs (ti_colon)
3154 jfiat 54402 if l_cl_i.compiled then
3155     if l_assert_level.check_all then
3156 jfiat 54401 l_format_context.put_space
3157 jfiat 54402 l_format_context.put_text_item_without_tabs (ti_All_keyword)
3158     elseif l_assert_level.level = 0 then
3159 jfiat 54401 l_format_context.put_space
3160 jfiat 54402 l_format_context.put_comment_text (once "None")
3161     else
3162     if l_assert_level.check_precond then
3163     l_format_context.put_space
3164     l_format_context.put_text_item_without_tabs (ti_Require_keyword)
3165     end
3166     if l_assert_level.check_postcond then
3167     l_format_context.put_space
3168     l_format_context.put_text_item_without_tabs (ti_Ensure_keyword)
3169     end
3170     if l_assert_level.check_check then
3171     l_format_context.put_space
3172     l_format_context.put_text_item_without_tabs (ti_Check_keyword)
3173     end
3174     if l_assert_level.check_loop then
3175     l_format_context.put_space
3176     l_format_context.put_text_item_without_tabs (ti_Loop_keyword)
3177     end
3178     if l_assert_level.check_invariant then
3179     l_format_context.put_space
3180     l_format_context.put_text_item_without_tabs (ti_Invariant_keyword)
3181     end
3182 jfiat 54401 end
3183 jfiat 54402 else
3184     l_format_context.put_comment_text (" Not in system.")
3185 jfiat 54401 end
3186     l_format_context.put_new_line
3187     l_classes.forth
3188     end
3189     l_format_context.exdent
3190     end
3191    
3192     if not a_cluster.overriden_classes.is_empty then
3193     l_format_context.put_text_item (create {INDEXING_TAG_TEXT}.make ("overriden class(es)"))
3194     l_format_context.put_text_item_without_tabs (ti_colon)
3195     l_format_context.put_new_line
3196     l_format_context.indent
3197     from
3198 jfiat 54402 l_classes := a_cluster.overriden_classes.linear_representation
3199 jfiat 54401 l_classes.start
3200     until
3201     l_classes.after
3202     loop
3203 jfiat 54402 l_cl_i := l_classes.item
3204 jfiat 54401 l_format_context.put_manifest_string (" - ")
3205     l_format_context.put_classi (l_cl_i)
3206     l_list_cl_i := eiffel_universe.classes_with_name (l_cl_i.name)
3207     if l_list_cl_i /= Void and then not l_list_cl_i.is_empty then
3208     l_format_context.put_text_item_without_tabs (ti_colon)
3209     l_format_context.put_comment_text (" overriden by")
3210     from
3211     l_list_cl_i.start
3212     until
3213     l_list_cl_i.after
3214     loop
3215     l_cluster := l_list_cl_i.item.cluster
3216     if l_cluster /= a_cluster then
3217     l_format_context.put_space
3218     l_format_context.put_text_item_without_tabs (ti_double_quote)
3219     l_format_context.put_clusteri (l_list_cl_i.item.cluster)
3220     l_format_context.put_text_item_without_tabs (ti_double_quote)
3221     end
3222     l_list_cl_i.forth
3223     end
3224     end
3225     l_format_context.put_new_line
3226     l_classes.forth
3227     end
3228     l_format_context.exdent
3229     l_format_context.put_new_line
3230     end
3231    
3232     l_format_context.exdent
3233     l_format_context.put_new_line
3234     Result := l_format_context
3235     ensure
3236     result_not_void: Result /= Void
3237     end
3238 manus 55527
3239 manus 50607 scroll_to_feature (feat_as: E_FEATURE; displayed_class: CLASS_I) is
3240     -- highlight the feature correspnding to `feat_as' in the class represented by `displayed_class'
3241     require
3242     class_is_not_void: displayed_class /= Void
3243     feat_as_is_not_void: feat_as /= Void
3244     local
3245     begin_index, offset: INTEGER
3246     tmp_text: STRING
3247     do
3248     if not feat_as.is_il_external then
3249 tedf 55441 if not managed_main_formatters.first.selected then
3250     if feat_as.ast /= Void then
3251     editor_tool.text_area.find_feature_named (feat_as.name)
3252     end
3253     else
3254 tedf 55673 if feat_as.ast /= Void then
3255     begin_index := feat_as.ast.start_position
3256     if platform_constants.is_windows then
3257     tmp_text := displayed_class.text.substring (1, begin_index)
3258     offset := tmp_text.occurrences('%R')
3259     end
3260     editor_tool.text_area.scroll_to_when_ready (begin_index.item - offset)
3261 tedf 55441 end
3262 manus 50607 end
3263     else
3264 tedf 55441 if not managed_main_formatters.first.selected then
3265     managed_main_formatters.first.execute
3266     end
3267 manus 50607 -- FIXME NC: Doesn't work properly for .NET features
3268     -- .NET formatted feature.
3269     begin_index := feature_positions.item (feat_as)
3270 neilc 33858 if platform_constants.is_windows then
3271     tmp_text := displayed_class.text.substring (1, begin_index)
3272 manus 50607 offset := tmp_text.occurrences('%N')
3273 neilc 33858 end
3274 manus 50607 editor_tool.text_area.scroll_to_when_ready (begin_index // 2) -- - offset)
3275 manus 26913 end
3276     end
3277    
3278 manus 50607 check_passed: BOOLEAN
3279 manus 26913
3280 manus 50607 save_canceled: BOOLEAN
3281     -- did user cancel save ?
3282 manus 26913
3283 manus 50607 save_only: BOOLEAN
3284     -- skip parse and update after save ?
3285 manus 26913
3286 manus 50607 text_saved: BOOLEAN
3287     -- has the user chosen to save the file
3288 manus 26913
3289 manus 50607 is_destroying: BOOLEAN
3290