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