/[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 56781 - (hide annotations)
Fri Jan 27 16:27:42 2006 UTC (14 years, 1 month ago) by patrickr
Original Path: trunk/Src/bench/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 128541 byte(s)
-add type information to the ast during degree 3
-make a type check of all features, instead of only the changed ones, if a class has been parsed again (need because we have a new ast and we need to readd the type informations)
-changed parser used during degree 5 to light roundtrip parser (roundtrip parser without matchlist generation)
-refactoring tool
-refactored comment code to use the available information from the roundtrip ast
-added a server for matchlists, that generates matchlists on demand, using the fast scanner


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