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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23