/[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 60017 - (show annotations)
Tue Jun 20 17:01:52 2006 UTC (13 years, 8 months ago) by paulb
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 137279 byte(s)
Remapped 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_pixmaps.general_cut_icon)
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_pixmaps.general_copy_icon)
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 lock_update
2498 features_tool.synchronize
2499 refresh_cursor_position
2500 refresh_context_info
2501 unlock_update
2502 if editor_tool.text_area.syntax_is_correct then
2503 status_bar.display_message ("")
2504 else
2505 status_bar.display_message (Interface_names.L_syntax_error)
2506 end
2507 text_edited := False
2508 end
2509
2510 on_focus is
2511 -- Focus gained
2512 local
2513 editor: TEXT_PANEL
2514 do
2515 editor ?= editor_tool.text_area
2516 if editor /= Void then
2517 editor.on_focus
2518 end
2519 end
2520
2521 save_and (an_action: PROCEDURE [ANY, TUPLE]) is
2522 local
2523 save_dialog: EB_CONFIRM_SAVE_DIALOG
2524 do
2525 save_canceled := True
2526 text_saved := False
2527 create save_dialog.make_and_launch (Current,Current)
2528 if not save_canceled and then syntax_is_correct then
2529 an_action.call(Void)
2530 end
2531 end
2532
2533 feature -- Window management
2534
2535 show_window is
2536 -- Show the window
2537 do
2538 show
2539 end
2540
2541 raise_window is
2542 -- Show the window and set the focus to it.
2543 do
2544 show
2545 --| FIXME, set the focus.
2546 end
2547
2548 hide_window is
2549 -- Hide the window
2550 do
2551 hide
2552 end
2553
2554 destroy_window is
2555 -- Destroy the window.
2556 do
2557 destroy
2558 end
2559
2560 give_focus is
2561 -- Give the focus to the address manager.
2562 do
2563 address_manager.set_focus
2564 end
2565
2566 save_layout is
2567 -- Store layout of `current'.
2568 do
2569 save_layout_to_window_data (development_window_data)
2570 -- Commit saves
2571 preferences.preferences.save_preferences
2572 end
2573
2574 save_layout_to_session (a_session: ES_SESSION) is
2575 -- Save session data of `Current' to session object `a_session'.
2576 local
2577 a_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA
2578 a_class_i: CLASSI_STONE
2579 do
2580 create a_window_data.make_from_window_data (preferences.development_window_data)
2581
2582 a_class_i ?= stone
2583 if a_class_i /= Void then
2584 a_window_data.save_filename (a_class_i.file_name)
2585 a_window_data.save_editor_position (editor_tool.text_area.current_cursor_position)
2586 end
2587
2588 if context_tool /= Void then
2589 a_window_data.save_context_data (
2590 context_tool.address_manager.cluster_label_text,
2591 context_tool.address_manager.class_label_text,
2592 context_tool.address_manager.feature_label_text,
2593 context_tool.notebook.selected_item_index
2594 )
2595 end
2596
2597 save_layout_to_window_data (a_window_data)
2598
2599 -- Add the session data of `Current' to the session object.
2600 a_session.window_session_data.extend (a_window_data)
2601 end
2602
2603 save_layout_to_window_data (a_window_data: EB_DEVELOPMENT_WINDOW_DATA) is
2604 -- Store window data of `Current' in `a_window_data'.
2605 require
2606 a_window_data_not_void: a_window_data /= Void
2607 do
2608 -- Now save the windows's layout, but only if the
2609 -- debugger is not displayed in `Current'. By saving the layout,
2610 -- we ensure that future windows may use exactly the same layout.
2611 -- If the debugger is displayed, the previous layout is already saved,
2612 -- and this is the one that must be used, as only one debugger is ever displayed.
2613 if
2614 (Eb_debugger_manager.application_is_executing and Eb_debugger_manager.debugging_window /= Current)
2615 or not Eb_debugger_manager.application_is_executing
2616 then
2617 a_window_data.save_left_panel_layout (left_panel.save_to_resource)
2618 a_window_data.save_right_panel_layout (right_panel.save_to_resource)
2619 a_window_data.save_left_panel_width (panel.split_position)
2620 -- Save width & height.
2621 a_window_data.save_size (window.width, window.height)
2622 a_window_data.save_window_state (window.is_minimized, window.is_maximized)
2623 a_window_data.save_position (window.x_position, window.y_position)
2624 end
2625 a_window_data.save_show_search_options (search_tool.options_shown)
2626 end
2627
2628
2629 feature -- Tools & Controls
2630
2631 editor_tool: EB_EDITOR_TOOL
2632
2633 favorites_tool: EB_FAVORITES_TOOL
2634
2635 cluster_tool: EB_CLUSTER_TOOL
2636
2637 search_tool: EB_MULTI_SEARCH_TOOL
2638
2639 features_tool: EB_FEATURES_TOOL
2640
2641 breakpoints_tool: ES_BREAKPOINTS_TOOL
2642
2643 windows_tool: EB_WINDOWS_TOOL
2644
2645 context_tool: EB_CONTEXT_TOOL
2646 -- Context explorer for current class and system.
2647
2648 address_manager: EB_ADDRESS_MANAGER
2649 -- Text field in the toolbar
2650 -- Allow user to enter the name
2651 -- of the class he wants to edit.
2652
2653 project_manager: EB_PROJECT_MANAGER is
2654 -- Project manager associated to the project the user is working on.
2655 do
2656 Result := Eiffel_project.manager
2657 end
2658
2659 managed_class_formatters: ARRAYED_LIST [EB_CLASS_INFO_FORMATTER]
2660 -- All formatters that operate on a class.
2661
2662 managed_feature_formatters: ARRAYED_LIST [EB_FEATURE_INFO_FORMATTER]
2663 -- All formatters that operate on a class.
2664
2665 managed_main_formatters: ARRAYED_LIST [EB_CLASS_TEXT_FORMATTER]
2666 -- All formatters that can be displayed in the main editor frame.
2667
2668 unified_stone: BOOLEAN
2669 -- Is the stone common with the context tool or not?
2670
2671 arguments_dialog: EB_ARGUMENT_DIALOG
2672 -- The arguments dialog for current, if any
2673
2674 goto_dialog: EB_GOTO_DIALOG
2675 -- The goto dialog for line number access
2676
2677 feature -- Multiple editor management
2678
2679 add_editor_to_list (an_editor: EB_EDITOR) is
2680 -- adds `an_editor' to `editors'
2681 do
2682 editors.extend (an_editor)
2683 end
2684
2685 current_editor: EB_EDITOR is
2686 -- current editor, if none, main editor
2687 do
2688 if current_editor_index /= 0 then
2689 Result := editors @ current_editor_index
2690 else
2691 Result := editors.first
2692 end
2693 end
2694
2695 set_current_editor (an_editor: EB_EDITOR) is
2696 -- set `an_editor' as main editor
2697 local
2698 old_index: INTEGER
2699 new_index: INTEGER
2700 do
2701 old_index := current_editor_index
2702 new_index := editors.index_of (an_editor, 1)
2703 if
2704 editors.valid_index (new_index) and
2705 old_index /= new_index
2706 then
2707 current_editor_index := new_index
2708 update_paste_cmd
2709 -- Last thing, update the menu entry for the formatting marks.
2710 if current_editor.view_invisible_symbols then
2711 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
2712 else
2713 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
2714 end
2715 command_controller.set_current_editor (an_editor)
2716 end
2717 end
2718
2719 update_paste_cmd is
2720 -- Update `editor_paste_cmd'. To be performed when an editor grabs the focus.
2721 do
2722 if
2723 not current_editor.is_empty and then
2724 current_editor.is_editable and then
2725 current_editor.clipboard.has_text
2726 then
2727 editor_paste_cmd.enable_sensitive
2728 else
2729 editor_paste_cmd.disable_sensitive
2730 end
2731 end
2732
2733 feature {NONE} -- Multiple editor management
2734
2735 editors: ARRAYED_LIST [EB_EDITOR]
2736 -- editor contained in `Current'
2737
2738 current_editor_index: INTEGER
2739 -- Index in `editors' of the editor that has the focus.
2740
2741 feature {EB_FEATURES_TOOL, EB_FEATURES_TREE, DOTNET_CLASS_AS} -- Feature Clauses
2742
2743 set_feature_clauses (a_features: ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]]; a_type: STRING) is
2744 -- Set 'features' to 'a_features' and store in hash table with key 'a_type' denoting name of consumed
2745 -- type pertinent to 'a_features'.
2746 require
2747 a_features_not_void: a_features /= Void
2748 do
2749 if feature_clauses = Void then
2750 create feature_clauses.make (5)
2751 end
2752 feature_clauses.put (a_features, a_type)
2753 end
2754
2755 set_feature_locating (a_locating: BOOLEAN) is
2756 -- Set `feature_locating' with `a_locating'.
2757 do
2758 feature_locating := a_locating
2759 end
2760
2761 get_feature_clauses (a_type: STRING): ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]] is
2762 -- Get list of feature clauses relevant to .NET type with name 'a_type'.
2763 require
2764 a_type_not_void: a_type /= Void
2765 has_type_clauses: feature_clauses.has (a_type)
2766 do
2767 Result := feature_clauses.item (a_type)
2768 ensure
2769 result_not_void: Result /= Void
2770 end
2771
2772 feature_clauses: HASH_TABLE [ARRAYED_LIST [DOTNET_FEATURE_CLAUSE_AS [CONSUMED_ENTITY]], STRING]
2773 -- List of features clauses for Current window hashed by the .NET name of the consumed_type.
2774
2775 feature_positions: HASH_TABLE [INTEGER, E_FEATURE]
2776 -- Features indexed by line position in class text (for .NET features).
2777
2778 feature_locating: BOOLEAN
2779 -- Is feature tool locating a feature?
2780
2781 feature {EB_WINDOW_MANAGER} -- Window management / Implementation
2782
2783 destroy_imp is
2784 -- Destroy window.
2785 do
2786 -- To avoid reentrance
2787 if not is_destroying then
2788 is_destroying := True
2789 -- If a launched application is still running, kill it.
2790 if
2791 Eb_debugger_manager.application_is_executing
2792 and then Eb_debugger_manager.debugging_window = Current
2793 then
2794 Eb_debugger_manager.Application.kill
2795 else
2796 development_window_data.save_left_panel_layout (left_panel.save_to_resource)
2797 development_window_data.save_right_panel_layout (right_panel.save_to_resource)
2798 end
2799 development_window_data.save_left_panel_width (panel.split_position)
2800 -- Save width & height.
2801 development_window_data.save_size (window.width, window.height)
2802 development_window_data.save_window_state (window.is_minimized, window.is_maximized)
2803 development_window_data.save_position (window.x_position, window.y_position)
2804 development_window_data.save_show_search_options (search_tool.options_shown)
2805 hide
2806
2807 -- Commit saves
2808 preferences.preferences.save_preferences
2809
2810 estudio_debug_cmd.unattach_window (window)
2811 toolbars_area.wipe_out
2812 address_manager.recycle
2813 project_customizable_toolbar.recycle
2814 refactoring_customizable_toolbar.recycle
2815 Precursor {EB_TOOL_MANAGER}
2816 left_panel.recycle
2817 right_panel.recycle
2818 managed_class_formatters.wipe_out
2819 managed_feature_formatters.wipe_out
2820 managed_main_formatters.wipe_out
2821 toolbarable_commands.wipe_out
2822 editors.wipe_out
2823 editors := Void
2824 stone := Void
2825 end
2826 end
2827
2828 feature -- C output pixmap management
2829
2830 start_c_output_pixmap_timer is
2831 -- Start timer to draw c output pixmap.
2832 do
2833 if context_tool /= Void then
2834 context_tool.start_c_output_pixmap_timer
2835 end
2836 end
2837
2838 stop_c_output_pixmap_timer is
2839 -- Stop timer to draw c output pixmap.
2840 do
2841 if context_tool /= Void then
2842 context_tool.stop_c_output_pixmap_timer
2843 end
2844 end
2845
2846 feature {NONE} -- Implementation
2847
2848 set_stone_after_check (a_stone: STONE) is
2849 local
2850 old_stone: STONE
2851 new_class_stone: CLASSI_STONE
2852 old_class_stone: CLASSI_STONE
2853 conv_classc: CLASSC_STONE
2854 conv_brkstone: BREAKABLE_STONE
2855 cluster_st: CLUSTER_STONE
2856 old_cluster_st: CLUSTER_STONE
2857 feature_stone: FEATURE_STONE
2858 conv_ferrst: FEATURE_ERROR_STONE
2859
2860 ef_stone: EXTERNAL_FILE_STONE
2861 f: FILE
2862
2863 conv_errst: ERROR_STONE
2864 cl_syntax_stone: CL_SYNTAX_STONE
2865 error_line: INTEGER
2866 class_file: RAW_FILE
2867 class_text_exists: BOOLEAN
2868 same_class: BOOLEAN
2869 test_stone: CLASSI_STONE
2870 conv_ace: ACE_SYNTAX_STONE
2871 externali: EXTERNAL_CLASS_I
2872 external_cons: CONSUMED_TYPE
2873 str: STRING
2874 dotnet_class: BOOLEAN
2875 l_short_formatter: EB_SHORT_FORMATTER
2876 l_flat_formatter: EB_FLAT_SHORT_FORMATTER
2877 l_main_formatter: EB_CLASS_TEXT_FORMATTER
2878 app_exec: APPLICATION_EXECUTION
2879 do
2880 -- the text does not change if the text was saved with syntax errors
2881 cur_wid := window
2882 if cur_wid = Void then
2883 --| Do nothing.
2884 else
2885 if old_cur = Void then
2886 old_cur := cur_wid.pointer_style
2887 end
2888 -- cur_wid.enable_capture
2889 cur_wid.set_pointer_style (Wait_cursor)
2890 end
2891
2892 conv_brkstone ?= a_stone
2893 conv_errst ?= a_stone
2894 conv_ace ?= a_stone
2895 ef_stone ?= a_stone
2896 if conv_brkstone /= Void then
2897 app_exec := Debugger_manager.application
2898 if app_exec.is_breakpoint_enabled (conv_brkstone.routine, conv_brkstone.index) then
2899 app_exec.remove_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2900 else
2901 app_exec.set_breakpoint (conv_brkstone.routine, conv_brkstone.index)
2902 end
2903 Debugger_manager.notify_breakpoints_changes
2904 elseif conv_errst /= Void then
2905 display_error_help_cmd.execute_with_stone (conv_errst)
2906 elseif conv_ace /= Void then
2907 --| FIXME XR: What should we do?!
2908 elseif ef_stone /= Void then
2909 f := ef_stone.file
2910 f.make_open_read (f.name)
2911 f.read_stream (f.count)
2912 f.close
2913 editor_tool.text_area.set_stone (a_stone)
2914 editor_tool.text_area.load_text (f.last_string)
2915 else
2916 -- Remember previous stone.
2917 old_stone := stone
2918 old_class_stone ?= stone
2919 old_cluster_st ?= stone
2920
2921 -- New stone properties
2922 new_class_stone ?= a_stone
2923
2924 -- Set the stone.
2925 old_set_stone (a_stone)
2926 cluster_st ?= a_stone
2927
2928 new_feature_cmd.disable_sensitive
2929 toggle_feature_alias_cmd.disable_sensitive
2930 toggle_feature_signature_cmd.disable_sensitive
2931 toggle_feature_assigner_cmd.disable_sensitive
2932
2933 -- We update the state of the `Add to Favorites' command.
2934 if new_class_stone /= Void then
2935 favorites_menu.first.enable_sensitive
2936 else
2937 favorites_menu.first.disable_sensitive
2938 end
2939
2940 -- Update the address manager if needed.
2941 address_manager.refresh
2942 if new_class_stone /= Void then
2943 -- Text is now editable.
2944 editor_tool.text_area.set_read_only (False)
2945
2946 -- class stone was dropped
2947 create class_file.make (new_class_stone.class_i.file_name)
2948 class_text_exists := class_file.exists
2949 feature_stone ?= a_stone
2950 --| We have to create a classi_stone to check whether the stones are really similar.
2951 --| Otherwise a redefinition of same_as may be called.
2952 create test_stone.make (new_class_stone.class_i)
2953 if test_stone.same_as (old_class_stone) then
2954 same_class := True
2955 end
2956 if not feature_stone_already_processed then
2957 if same_class and then text_saved then
2958 -- nothing changed in the editor
2959 -- we only have to update click_list
2960 if editor_tool.text_area.is_editable then
2961 editor_tool.text_area.update_click_list (False)
2962 end
2963 else
2964 if changed then
2965 -- user has already chosen not to save the file
2966 -- do not ask again
2967 Feature_positions.wipe_out
2968 editor_tool.text_area.no_save_before_next_load
2969 end
2970 end
2971 end
2972
2973 conv_classc ?= new_class_stone
2974
2975 -- First choose possible formatter
2976 l_main_formatter ?= new_class_stone.pos_container
2977 if l_main_formatter /= Void and not during_synchronization then
2978 if
2979 not (conv_classc /= Void and class_text_exists and (not changed or not same_class))
2980 then
2981 l_main_formatter.enable_select
2982 elseif feature_stone = Void then
2983 if l_main_formatter /= pos_container then
2984 l_main_formatter.enable_select
2985 end
2986 if new_class_stone.position > 0 then
2987 editor_tool.text_area.display_line_at_top_when_ready (new_class_stone.position)
2988 end
2989 end
2990 end
2991
2992 if conv_classc = Void or else
2993 conv_classc.e_class.is_external or else
2994 feature_stone /= Void and not
2995 feature_stone_already_processed and not
2996 (same_class and context_tool.sending_stone) then
2997 -- If a classi_stone or a feature_stone or a external call
2998 -- has been dropped, check to see if a .NET class.
2999 if class_text_exists then
3000 if new_class_stone.class_i.is_external_class then
3001 externali ?= new_class_stone.class_i
3002 check
3003 externali_not_void: externali /= Void
3004 end
3005 external_cons := externali.external_consumed_type
3006 if external_cons /= Void then
3007 -- A .NET class.
3008 dotnet_class := True
3009 l_short_formatter ?= managed_main_formatters.i_th (4)
3010 l_flat_formatter ?= managed_main_formatters.i_th (5)
3011 if l_short_formatter /= Void then
3012 l_short_formatter.set_dotnet_mode (True)
3013 end
3014 if l_flat_formatter /= Void then
3015 l_flat_formatter.set_dotnet_mode (True)
3016 end
3017 end
3018 elseif feature_stone /= Void then
3019 from
3020 managed_main_formatters.start
3021 until
3022 managed_main_formatters.after
3023 loop
3024 managed_main_formatters.item.set_stone (new_class_stone)
3025 managed_main_formatters.forth
3026 end
3027 else
3028 managed_main_formatters.first.set_stone (new_class_stone)
3029 managed_main_formatters.first.execute
3030 end
3031 else
3032 editor_tool.text_area.clear_window
3033 editor_tool.text_area.display_message (
3034 Warning_messages.w_file_not_exist (
3035 new_class_stone.class_i.file_name))
3036 end
3037 end
3038 if conv_classc = Void then
3039 --| The dropped class is not compiled.
3040 --| Display only the textual formatter.
3041 if dotnet_class then
3042 managed_main_formatters.i_th (4).set_stone (new_class_stone)
3043 managed_main_formatters.i_th (5).set_stone (new_class_stone)
3044 managed_main_formatters.i_th (4).execute
3045 end
3046 address_manager.disable_formatters
3047 else
3048 --| We have a compiled class.
3049 if
3050 class_text_exists and then
3051 Eiffel_project.Workbench.last_reached_degree <= 2
3052 then
3053 new_feature_cmd.enable_sensitive
3054 toggle_feature_alias_cmd.enable_sensitive
3055 toggle_feature_signature_cmd.enable_sensitive
3056 toggle_feature_assigner_cmd.enable_sensitive
3057 end
3058
3059 --address_manager.enable_formatters
3060 update_formatters
3061 if not class_text_exists then
3062 --| Disable the textual formatter.
3063 managed_main_formatters.first.disable_sensitive
3064 from
3065 managed_main_formatters.start
3066 until
3067 managed_main_formatters.after
3068 loop
3069 managed_main_formatters.item.set_stone (new_class_stone)
3070 managed_main_formatters.forth
3071 end
3072 if not is_stone_external then
3073 managed_main_formatters.i_th (2).execute
3074 end
3075 else
3076 if not changed or not same_class then
3077 --| Enable all formatters.
3078 if
3079 (not feature_stone_already_processed or
3080 not managed_main_formatters.first.selected) and
3081 feature_stone = Void
3082 then
3083 from
3084 managed_main_formatters.start
3085 until
3086 managed_main_formatters.after
3087 loop
3088 managed_main_formatters.item.set_stone (new_class_stone)
3089 managed_main_formatters.forth
3090 end
3091 end
3092 else
3093 if not feature_stone_already_processed then
3094 address_manager.disable_formatters
3095 from
3096 managed_main_formatters.start
3097 until
3098 managed_main_formatters.after
3099 loop
3100 managed_main_formatters.item.set_stone (new_class_stone)
3101 managed_main_formatters.forth
3102 end
3103 end
3104 end
3105 end
3106 end
3107 if not managed_main_formatters.first.selected then
3108 editor_tool.text_area.set_read_only (true)
3109 elseif new_class_stone /= Void and then new_class_stone.class_i.is_read_only then
3110 editor_tool.text_area.set_read_only (true)
3111 end
3112 else
3113 -- not a class text : cannot be edited
3114 editor_tool.text_area.set_read_only (True)
3115 address_manager.disable_formatters
3116
3117 --| Disable all formatters.
3118 from
3119 managed_main_formatters.start
3120 until
3121 managed_main_formatters.after
3122 loop
3123 managed_main_formatters.item.set_stone (Void)
3124 managed_main_formatters.forth
3125 end
3126 if cluster_st /= Void and then cluster_st.is_cluster then
3127 --| FIXME XR: Really manage cluster display in the main editor
3128 formatted_context_for_cluster (cluster_st.cluster_i, cluster_st.path)
3129 if cluster_st.position > 0 then
3130 editor_tool.text_area.display_line_at_top_when_ready (cluster_st.position)
3131 end
3132 --| END FIXME
3133 end
3134 end
3135 if class_text_exists then
3136 if feature_stone /= Void and not feature_stone_already_processed and not (same_class and context_tool.sending_stone) then
3137 conv_ferrst ?= feature_stone
3138 if conv_ferrst /= Void then
3139 error_line := conv_ferrst.line_number
3140 else
3141 -- if a feature_stone has been dropped
3142 -- scroll to the corresponding feature in the basic text format
3143 if not during_synchronization then
3144 scroll_to_feature (feature_stone.e_feature, new_class_stone.class_i)
3145 end
3146 end
3147 else
3148 cl_syntax_stone ?= a_stone
3149 if cl_syntax_stone /= Void then
3150 error_line := cl_syntax_stone.line
3151 end
3152 end
3153 if error_line > 0 then
3154 -- Scroll to the line of the error.
3155 if not during_synchronization then
3156 if not managed_main_formatters.first.selected then
3157 managed_main_formatters.first.execute
3158 check
3159 new_class_stone_not_void: new_class_stone /= Void
3160 end
3161 if new_class_stone.class_i.is_read_only then
3162 editor_tool.text_area.set_read_only (true)
3163 end
3164 end
3165 editor_tool.text_area.display_line_when_ready (error_line, True)
3166 end
3167 end
3168 end
3169 -- Update the title of the window
3170 if a_stone /= Void then
3171 if changed then
3172 str := a_stone.header.twin
3173 str.prepend ("* ")
3174 set_title (str)
3175 else
3176 set_title (a_stone.header)
3177 end
3178 else
3179 set_title (Interface_names.t_empty_development_window)
3180 end
3181
3182 -- Refresh the tools.
3183 features_tool.set_stone (a_stone)
3184 cluster_tool.set_stone (a_stone)
3185 -- Update the context tool.
3186 if unified_stone then
3187 context_tool.set_stone (a_stone)
3188 end
3189
3190 end
3191 if
3192 stone /= Void and then
3193 not unified_stone
3194 then
3195 send_stone_to_context_cmd.enable_sensitive
3196 else
3197 send_stone_to_context_cmd.disable_sensitive
3198 end
3199 if cur_wid = Void then
3200 --| Do nothing.
3201 else
3202 cur_wid.set_pointer_style (old_cur)
3203 old_cur := Void
3204 -- cur_wid.disable_capture
3205 cur_wid := Void
3206 end
3207 end
3208
3209 formatted_context_for_cluster (a_cluster: CLUSTER_I; a_path: STRING) is
3210 -- Formatted context representing the list of classes inside `a_cluster'.
3211 require
3212 a_cluster_not_void: a_cluster /= Void
3213 a_path_not_void: a_path /= Void
3214 local
3215 l_assembly: ASSEMBLY_I
3216 l_sorted_cluster: EB_SORTED_CLUSTER
3217 l_classes: DS_ARRAYED_LIST [CLASS_I]
3218 l_in_classes: DS_ARRAYED_LIST [CLASS_I]
3219 l_out_classes: DS_ARRAYED_LIST [CLASS_I]
3220 l_over_classes: DS_ARRAYED_LIST [CLASS_I]
3221 l_subclu: DS_LIST [EB_SORTED_CLUSTER]
3222 l_cl_i, l_overridden_class: CLASS_I
3223 l_cluster: CLUSTER_I
3224 l_assert_level: ASSERTION_I
3225 l_format_context: TEXT_FORMATTER_DECORATOR
3226 l_description: STRING
3227 do
3228 create l_format_context.make_for_case (editor_tool.text_area.text_displayed)
3229 editor_tool.text_area.handle_before_processing (False)
3230 l_format_context.process_keyword_text (ti_indexing_keyword, Void)
3231 l_format_context.put_new_line
3232 l_format_context.indent
3233 if a_cluster.is_assembly then
3234 l_assembly ?= a_cluster
3235 check l_assembly /= Void end
3236 l_format_context.process_indexing_tag_text ("assembly_name")
3237 l_format_context.set_without_tabs
3238 l_format_context.process_symbol_text (ti_colon)
3239 l_format_context.put_space
3240 l_format_context.put_quoted_string_item (l_assembly.assembly_name)
3241 l_format_context.put_new_line
3242 l_format_context.process_indexing_tag_text ("assembly_path")
3243 l_format_context.set_without_tabs
3244 l_format_context.process_symbol_text (ti_colon)
3245 l_format_context.put_space
3246 l_format_context.put_quoted_string_item (l_assembly.location.evaluated_path)
3247 l_format_context.put_new_line
3248
3249 end
3250 l_format_context.process_indexing_tag_text ("cluster")
3251 l_format_context.set_without_tabs
3252 l_format_context.process_symbol_text (ti_colon)
3253 l_format_context.put_space
3254 l_format_context.add_group (a_cluster, a_cluster.cluster_name)
3255
3256 l_format_context.put_new_line
3257 l_format_context.process_indexing_tag_text ("cluster_path")
3258 l_format_context.set_without_tabs
3259 l_format_context.process_symbol_text (ti_colon)
3260 l_format_context.put_space
3261 l_format_context.put_quoted_string_item (a_cluster.path)
3262
3263 if a_path /= Void and then not a_path.is_empty then
3264 l_format_context.put_space
3265 l_format_context.set_without_tabs
3266 l_format_context.process_symbol_text (ti_l_parenthesis)
3267 l_format_context.put_quoted_string_item (a_path)
3268 l_format_context.set_without_tabs
3269 l_format_context.process_symbol_text (ti_r_parenthesis)
3270 end
3271 l_format_context.put_new_line
3272
3273 -- Now try to get the description of the cluster, and if not
3274 -- we take the one from its target.
3275 if a_cluster.description /= Void then
3276 l_description := a_cluster.description
3277 elseif a_cluster.target.description /= Void then
3278 l_description := a_cluster.target.description
3279 end
3280 if l_description /= Void then
3281 l_format_context.process_indexing_tag_text ("description")
3282 l_format_context.set_without_tabs
3283 l_format_context.process_symbol_text (ti_colon)
3284 l_format_context.put_space
3285 l_format_context.set_in_indexing_clause (True)
3286 l_format_context.process_symbol_text (ti_double_quote)
3287 l_format_context.process_symbol_text (ti_l_bracket)
3288 l_format_context.put_new_line
3289 if l_description.has ('%N') then
3290 -- Indenting looks strange below because
3291 -- `add_multiline_string' does not take into accounts
3292 -- how many indents already exists.
3293 l_format_context.exdent
3294 l_format_context.add_multiline_string (l_description, 3)
3295 l_format_context.indent
3296 else
3297 l_format_context.indent
3298 l_format_context.indent
3299 l_format_context.add_string (l_description)
3300 l_format_context.exdent
3301 l_format_context.exdent
3302 end
3303 l_format_context.put_new_line
3304 l_format_context.indent
3305 l_format_context.process_symbol_text (ti_r_bracket)
3306 l_format_context.process_symbol_text (ti_double_quote)
3307 l_format_context.exdent
3308 l_format_context.put_new_line
3309 end
3310
3311 if a_cluster.parent_cluster /= Void then
3312 l_format_context.process_indexing_tag_text ("parent cluster")
3313 l_format_context.set_without_tabs
3314 l_format_context.process_symbol_text (ti_colon)
3315 l_format_context.put_new_line
3316 l_format_context.indent
3317 l_format_context.put_manifest_string (" - ")
3318
3319 l_format_context.add_group (a_cluster.parent_cluster, a_cluster.parent_cluster.cluster_name)
3320 l_format_context.put_new_line
3321 l_format_context.exdent
3322 end
3323
3324 create l_sorted_cluster.make (a_cluster)
3325 l_sorted_cluster.initialize
3326
3327 if not l_sorted_cluster.clusters.is_empty then
3328 l_format_context.process_indexing_tag_text ("sub cluster(s)")
3329 l_format_context.set_without_tabs
3330 l_format_context.process_symbol_text (ti_colon)
3331 l_format_context.put_new_line
3332 l_format_context.indent
3333 from
3334 l_subclu := l_sorted_cluster.clusters
3335 l_subclu.start
3336 until
3337 l_subclu.after
3338 loop
3339 l_cluster := l_subclu.item_for_iteration.actual_cluster
3340 l_format_context.put_manifest_string (" - ")
3341 l_format_context.add_group (l_cluster, l_cluster.cluster_name)
3342 l_format_context.put_space
3343 l_format_context.set_without_tabs
3344 l_format_context.process_symbol_text (ti_L_parenthesis)
3345 l_format_context.process_comment_text (l_cluster.classes.count.out, Void)
3346 l_format_context.set_without_tabs
3347 l_format_context.process_symbol_text (ti_R_parenthesis)
3348 l_format_context.put_new_line
3349 l_subclu.forth
3350 end
3351 l_format_context.exdent
3352 end
3353
3354 if not l_sorted_cluster.classes.is_empty then
3355 l_classes := l_sorted_cluster.classes
3356 from
3357 l_classes.start
3358 create l_in_classes.make (l_classes.count)
3359 create l_out_classes.make (l_classes.count)
3360 create l_over_classes.make (l_classes.count)
3361 until
3362 l_classes.after
3363 loop
3364 l_cl_i := l_classes.item_for_iteration
3365 if
3366 a_path.is_empty
3367 or else is_string_started_by (l_cl_i.path, a_path)
3368 then
3369 if l_cl_i.compiled then
3370 l_in_classes.put_last (l_cl_i)
3371 if l_cl_i.config_class.is_overriden then
3372 l_over_classes.put_last (l_cl_i)
3373 end
3374 else
3375 l_out_classes.put_last (l_cl_i)
3376 end
3377 end
3378 l_classes.forth
3379 end
3380 l_classes := Void
3381
3382 if l_in_classes.count > 0 then
3383 l_format_context.put_new_line
3384 l_format_context.process_indexing_tag_text (l_in_classes.count.out + " compiled class(es)")
3385 l_format_context.set_without_tabs
3386 l_format_context.process_symbol_text (ti_colon)
3387 l_format_context.put_new_line
3388 l_format_context.indent
3389
3390 from
3391 l_in_classes.start
3392 until
3393 l_in_classes.after
3394 loop
3395 l_cl_i := l_in_classes.item_for_iteration
3396 check compiled: l_cl_i.compiled end
3397
3398 l_assert_level := l_cl_i.assertion_level
3399 l_format_context.put_manifest_string (" - ")
3400 l_format_context.put_classi (l_cl_i)
3401 l_format_context.set_without_tabs
3402 l_format_context.process_symbol_text (ti_colon)
3403 if l_assert_level.check_all then
3404 l_format_context.put_space
3405 l_format_context.set_without_tabs
3406 l_format_context.process_keyword_text (ti_All_keyword, Void)
3407 elseif l_assert_level.level = 0 then
3408 l_format_context.put_space
3409 l_format_context.process_comment_text (once "None", Void)
3410 else
3411 if l_assert_level.check_precond then
3412 l_format_context.put_space
3413 l_format_context.set_without_tabs
3414 l_format_context.process_keyword_text (ti_Require_keyword, Void)
3415 end
3416 if l_assert_level.check_postcond then
3417 l_format_context.put_space
3418 l_format_context.set_without_tabs
3419 l_format_context.process_keyword_text (ti_Ensure_keyword, Void)
3420 end
3421 if l_assert_level.check_check then
3422 l_format_context.put_space
3423 l_format_context.set_without_tabs
3424 l_format_context.process_keyword_text (ti_Check_keyword, Void)
3425 end
3426 if l_assert_level.check_loop then
3427 l_format_context.put_space
3428 l_format_context.set_without_tabs
3429 l_format_context.process_keyword_text (ti_Loop_keyword, Void)
3430 end
3431 if l_assert_level.check_invariant then
3432 l_format_context.put_space
3433 l_format_context.set_without_tabs
3434 l_format_context.process_keyword_text (ti_Invariant_keyword, Void)
3435 end
3436 end
3437 l_format_context.put_new_line
3438 l_in_classes.forth
3439 end
3440 l_format_context.exdent
3441 end
3442 l_in_classes := Void
3443
3444 if l_out_classes.count > 0 then
3445 l_format_context.put_new_line
3446 l_format_context.process_indexing_tag_text (l_out_classes.count.out + " class(es) not in system")
3447 l_format_context.set_without_tabs
3448 l_format_context.process_symbol_text (ti_colon)
3449 l_format_context.put_new_line
3450 l_format_context.indent
3451 from
3452 l_out_classes.start
3453 until
3454 l_out_classes.after
3455 loop
3456 l_cl_i := l_out_classes.item_for_iteration
3457 check not_in_system: not l_cl_i.compiled end
3458 l_format_context.put_manifest_string (" - ")
3459 l_format_context.put_classi (l_cl_i)
3460 l_format_context.put_new_line
3461 l_out_classes.forth
3462 end
3463 l_format_context.exdent
3464 end
3465 l_out_classes := Void
3466
3467 if
3468 l_over_classes.count > 0 and then
3469 a_cluster.overriders /= Void and then not a_cluster.overriders.is_empty
3470 then
3471 l_format_context.put_new_line
3472 l_format_context.process_indexing_tag_text ("Overriden")
3473 l_format_context.set_without_tabs
3474 l_format_context.process_symbol_text (ti_colon)
3475 l_format_context.put_new_line
3476 l_format_context.indent
3477 from
3478 l_over_classes.start
3479 until
3480 l_over_classes.after
3481 loop
3482 l_cl_i := l_over_classes.item_for_iteration
3483 check is_overriden_class: l_cl_i.config_class.is_overriden end
3484
3485 l_format_context.put_manifest_string (" - ")
3486 l_format_context.put_classi (l_cl_i)
3487 l_format_context.process_comment_text (" overriden by", Void)
3488 l_format_context.process_symbol_text (ti_colon)
3489 l_format_context.put_space
3490
3491 l_overridden_class ?= l_cl_i.config_class.overriden_by
3492 if l_overridden_class /= Void then
3493 l_format_context.put_classi (l_overridden_class)
3494 l_format_context.put_manifest_string (" in ")
3495 l_format_context.add_group (l_cl_i.config_class.overriden_by.group, l_cl_i.config_class.overriden_by.group.name)
3496 l_format_context.put_new_line
3497 end
3498 l_over_classes.forth
3499 end
3500 l_format_context.exdent
3501 l_format_context.put_new_line
3502 end
3503 l_over_classes := Void
3504 end
3505
3506 l_format_context.exdent
3507 l_format_context.put_new_line
3508 editor_tool.text_area.handle_after_processing
3509 end
3510
3511 scroll_to_feature (feat_as: E_FEATURE; displayed_class: CLASS_I) is
3512 -- highlight the feature correspnding to `feat_as' in the class represented by `displayed_class'
3513 require
3514 class_is_not_void: displayed_class /= Void
3515 feat_as_is_not_void: feat_as /= Void
3516 local
3517 begin_index, offset: INTEGER
3518 tmp_text: STRING
3519 do
3520 if not feat_as.is_il_external then
3521 if not managed_main_formatters.first.selected then
3522 if feat_as.ast /= Void then
3523 editor_tool.text_area.find_feature_named (feat_as.name)
3524 end
3525 else
3526 if feat_as.ast /= Void then
3527 begin_index := feat_as.ast.start_position
3528 tmp_text := displayed_class.text.substring (1, begin_index)
3529 offset := tmp_text.occurrences('%R')
3530 editor_tool.text_area.scroll_to_when_ready (begin_index.item - offset)
3531 end
3532 end
3533 else
3534 if not managed_main_formatters.first.selected then
3535 managed_main_formatters.first.execute
3536 end
3537 -- FIXME NC: Doesn't work properly for .NET features
3538 -- .NET formatted feature.
3539 begin_index := feature_positions.item (feat_as)
3540 if platform_constants.is_windows then
3541 tmp_text := displayed_class.text.substring (1, begin_index)
3542 offset := tmp_text.occurrences('%N')
3543 end
3544 editor_tool.text_area.scroll_to_when_ready (begin_index // 2) -- - offset)
3545 end
3546 end
3547
3548 check_passed: BOOLEAN
3549
3550 save_canceled: BOOLEAN
3551 -- did user cancel save ?
3552
3553 save_only: BOOLEAN
3554 -- skip parse and update after save ?
3555
3556 text_saved: BOOLEAN
3557 -- has the user chosen to save the file
3558
3559 is_destroying: BOOLEAN
3560 -- Is `current' being currently destroyed?
3561
3562 feature_stone_already_processed: BOOLEAN
3563 -- Is the processed stone a feature stone and has it
3564 -- been already processed by the editor ?
3565
3566 feature {NONE} -- Implementation
3567
3568 update_save_symbol is
3569 do
3570 Precursor {EB_FILEABLE}
3571 if changed then
3572 save_cmd.enable_sensitive
3573 address_manager.disable_formatters
3574 else
3575 save_cmd.disable_sensitive
3576 update_formatters
3577 end
3578 if is_empty then
3579 print_cmd.disable_sensitive
3580 save_as_cmd.disable_sensitive
3581 else
3582 print_cmd.enable_sensitive
3583 save_as_cmd.enable_sensitive
3584 end
3585 end
3586
3587 is_stone_external: BOOLEAN
3588 -- Does 'stone' contain a .NET consumed type?
3589
3590 update_formatters is
3591 -- Give a correct sensitivity to formatters.
3592 local
3593 cist: CLASSI_STONE
3594 cst: CLASSC_STONE
3595 type_changed: BOOLEAN
3596 do
3597 cst ?= stone
3598 cist ?= stone
3599 -- Check to if formatting context has changed.
3600 if cst /= Void then
3601 type_changed := (cst.e_class.is_true_external and not is_stone_external) or
3602 (not cst.e_class.is_true_external and is_stone_external)
3603 elseif cist /= Void then
3604 type_changed := (cist.class_i.is_external_class and not is_stone_external) or
3605 (not cist.class_i.is_external_class and is_stone_external)
3606 end
3607
3608 if type_changed then
3609 -- Toggle stone flag.
3610 is_stone_external := not is_stone_external
3611 end
3612
3613 if cst /= Void then
3614 address_manager.enable_formatters
3615 if is_stone_external then
3616 -- Change formatters to .NET sensitivity (from normal).
3617 enable_dotnet_formatters
3618 if type_changed then
3619 managed_main_formatters.i_th (4).enable_select
3620 end
3621 else
3622 if changed then
3623 address_manager.disable_formatters
3624 else
3625 --managed_main_formatters.first.disable_sensitive
3626 end
3627 end
3628 elseif cist /= Void and is_stone_external then
3629 -- Change formatters to .NET sensitivity (from normal).
3630 enable_dotnet_formatters
3631 if type_changed then
3632 managed_main_formatters.i_th (4).enable_select
3633 end
3634 else
3635 address_manager.disable_formatters
3636 if cist /= stone then
3637 managed_main_formatters.first.execute
3638 end
3639 end
3640 end
3641
3642 enable_dotnet_formatters is
3643 -- Enable only the .NET class text formatters.
3644 local
3645 l_formatters: like managed_main_formatters
3646 do
3647 l_formatters := managed_main_formatters.twin
3648 from
3649 l_formatters.start
3650 until
3651 l_formatters.after
3652 loop
3653 if l_formatters.item.is_dotnet_formatter then
3654 l_formatters.item.enable_sensitive
3655 else
3656 l_formatters.item.disable_sensitive
3657 end
3658 l_formatters.forth
3659 end
3660 end
3661
3662 on_text_reset is
3663 -- The main editor has just been wiped out
3664 -- before loading a new file.
3665 local
3666 str: STRING
3667 do
3668 str := title.twin
3669 if str @ 1 = '*' then
3670 str.keep_tail (str.count - 2)
3671 set_title (str)
3672 end
3673 address_manager.disable_formatters
3674 status_bar.reset
3675 status_bar.remove_cursor_position
3676 text_edited := False
3677 end
3678
3679 on_cursor_moved is
3680 -- The cursor has moved, reflect the change in the status bar.
3681 -- And reflect location editing in the text in features tool and address bar.
3682 do
3683 refresh_cursor_position
3684 if context_refreshing_timer = Void then
3685 create context_refreshing_timer.make_with_interval (100)
3686 context_refreshing_timer.actions.extend (agent refresh_context_info)
3687 end
3688 if feature_locating then
3689 context_refreshing_timer.set_interval (0)
3690 else
3691 context_refreshing_timer.set_interval (100)
3692 end
3693
3694 end
3695
3696 on_text_fully_loaded is
3697 -- The main editor has just been reloaded.
3698 do
3699 update_paste_cmd
3700 update_formatters
3701 if editor_tool.text_area.syntax_is_correct then
3702 status_bar.reset
3703 else
3704 status_bar.display_message (Interface_names.L_syntax_error)
3705 end
3706 refresh_cursor_position
3707 text_edited := False
3708 end
3709
3710 on_text_back_to_its_last_saved_state is
3711 local
3712 str: STRING
3713 do
3714 str := title.twin
3715 if str @ 1 = '*' then
3716 str.keep_tail (str.count - 2)
3717 set_title (str)
3718 end
3719 update_formatters
3720 text_edited := False
3721 end
3722
3723 text_edited: BOOLEAN
3724 -- Do we know that the text was edited?
3725 -- If so, no need to update the display each time it is edited.
3726
3727 on_text_edited (unused: BOOLEAN) is
3728 -- The text in the editor is modified, add the '*' in the title.
3729 -- Gray out the formatters.
3730 local
3731 str: STRING
3732 cst: CLASSI_STONE
3733 do
3734 if not text_edited then
3735 str := title.twin
3736 if str @ 1 /= '*' then
3737 str.prepend ("* ")
3738 set_title (str)
3739 end
3740 address_manager.disable_formatters
3741 cst ?= stone
3742 if cst /= Void then
3743 Eiffel_project.Manager.class_is_edited (cst.class_i)
3744 end
3745 text_edited := True
3746 end
3747 if not status_bar.message.is_equal (interface_names.e_c_compilation_running) then
3748 -- We don't want the "Background C compilation in progress" message flash every time
3749 -- user presses a key.
3750 status_bar.display_message ("")
3751 end
3752 end
3753
3754 on_back is
3755 -- User pressed Alt+left.
3756 -- Go back in the history (or the context history).
3757 do
3758 if context_tool_has_focus then
3759 if context_tool.history_manager.is_back_possible then
3760 context_tool.history_manager.back_command.execute
3761 end
3762 elseif history_manager.is_back_possible then
3763 history_manager.back_command.execute
3764 end
3765 end
3766
3767 on_forth is
3768 -- User pressed Alt+right.
3769 -- Go forth in the history (or the context history).
3770 do
3771 if context_tool_has_focus then
3772 if context_tool.history_manager.is_forth_possible then
3773 context_tool.history_manager.forth_command.execute
3774 end
3775 elseif history_manager.is_forth_possible then
3776 history_manager.forth_command.execute
3777 end
3778 end
3779
3780 context_tool_has_focus: BOOLEAN is
3781 -- Does the context tool or one of its children has the focus?
3782 local
3783 fw: EV_WIDGET
3784 cont: EV_CONTAINER
3785 wid: EV_WIDGET
3786 do
3787 fw := (create {EV_ENVIRONMENT}).application.focused_widget
3788 wid := context_tool.explorer_bar_item.widget
3789 if wid = fw then
3790 Result := True
3791 elseif fw = Void then
3792 Result := False
3793 else
3794 from
3795 cont := fw.parent
3796 until
3797 cont = wid or cont = Void
3798 loop
3799 cont := cont.parent
3800 end
3801 if cont = wid then
3802 Result := True
3803 end
3804 end
3805 end
3806
3807 saved_cursor: CURSOR
3808 -- Saved cursor position for displaying the stack.
3809
3810 can_drop (st: ANY): BOOLEAN is
3811 -- Can the user drop the stone `st'?
3812 local
3813 conv_ace: ACE_SYNTAX_STONE
3814 do
3815 conv_ace ?= st
3816 Result := conv_ace = Void
3817 end
3818
3819 send_stone_to_context is
3820 -- Send current stone to the context tool.
3821 -- Used by `send_stone_to_context_cmd'.
3822 do
3823 if stone /= Void then
3824 context_tool.set_stone (stone)
3825 end
3826 end
3827
3828 destroy is
3829 -- check if current text has been saved and destroy
3830 local
3831 dialog_w: EV_WARNING_DIALOG
3832 do
3833 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
3834 process_manager.confirm_external_command_termination (agent terminate_external_command_and_destroy, agent do_nothing, window)
3835 else
3836 if editor_tool /= Void and then editor_tool.text_area /= Void and then changed and then not confirmed then
3837 if Window_manager.development_windows_count > 1 then
3838 create dialog_w.make_with_text (Warning_messages.w_save_before_closing)
3839 dialog_w.set_buttons_and_actions (<<"Yes", "No", "Cancel">>, <<agent save_and_destroy, agent force_destroy, agent do_nothing>>)
3840 dialog_w.set_default_push_button (dialog_w.button("Yes"))
3841 dialog_w.set_default_cancel_button (dialog_w.button("Cancel"))
3842 dialog_w.show_modal_to_window (window)
3843 else
3844 -- We let the window manager handle the saving, along with other windows
3845 -- (not development windows)
3846 force_destroy
3847 end
3848 else
3849 Precursor {EB_TOOL_MANAGER}
3850 if context_refreshing_timer /= Void then
3851 context_refreshing_timer.destroy
3852 context_refreshing_timer := Void
3853 end
3854 end
3855 end
3856 end
3857
3858 terminate_external_command_and_destroy is
3859 -- Terminate running external command and destroy.
3860 do
3861 process_manager.terminate_external_command
3862 destroy
3863 ensure
3864 external_command_not_running: not process_manager.is_external_command_running
3865 end
3866
3867 save_and_destroy is
3868 do
3869 save_text
3870 destroy
3871 end
3872
3873 force_destroy is
3874 -- Destroy without asking.
3875 do
3876 confirmed := True
3877 destroy
3878 confirmed := False
3879 end
3880
3881 confirmed: BOOLEAN
3882 -- Did the user say he wanted to exit?
3883
3884 show_dynamic_library_dialog is
3885 -- Create a new dynamic library window and display it.
3886 do
3887 Window_manager.create_dynamic_lib_window
3888 end
3889
3890 context_refreshing_timer: EV_TIMEOUT
3891
3892 feature -- Recycle
3893
3894 recycle is
3895 -- Call the precursors.
3896 do
3897 recycle_command
3898 recycle_formatters
3899 recycle_menu
3900 Precursor {EB_TOOL_MANAGER}
3901 save_as_cmd.recycle
3902 open_cmd.recycle
3903 save_cmd.recycle
3904 save_as_cmd := Void
3905 open_cmd := Void
3906 save_cmd := Void
3907 command_controller.recycle
3908 if refactoring_manager /= Void then
3909 refactoring_manager.destroy
3910 end
3911 editor_tool := Void
3912 favorites_tool := Void
3913 history_manager := Void
3914 features_tool := Void
3915 breakpoints_tool := Void
3916 favorites_manager := Void
3917 cluster_manager := Void
3918 search_tool := Void
3919 editors.wipe_out
3920 end
3921
3922 recycle_command is
3923 -- Recycle command
3924 local
3925 os_cmd: EB_ON_SELECTION_COMMAND
3926 do
3927 c_finalized_compilation_cmd.recycle
3928 c_workbench_compilation_cmd.recycle
3929 editor_paste_cmd.recycle
3930 new_class_cmd.recycle
3931 new_cluster_cmd.recycle
3932 new_feature_cmd.recycle
3933 shell_cmd.recycle
3934 toggle_feature_alias_cmd.recycle
3935 toggle_feature_assigner_cmd.recycle
3936 toggle_feature_signature_cmd.recycle
3937 undo_cmd.recycle
3938 redo_cmd.recycle
3939 toggle_stone_cmd.recycle
3940 delete_class_cluster_cmd.recycle
3941 print_cmd.recycle
3942 from
3943 show_tool_commands.start
3944 until
3945 show_tool_commands.after
3946 loop
3947 show_tool_commands.item.recycle
3948 show_tool_commands.forth
3949 end
3950 show_tool_commands.wipe_out
3951 show_tool_commands := Void
3952
3953 from
3954 toolbarable_commands.start
3955 until
3956 toolbarable_commands.after
3957 loop
3958 os_cmd ?= toolbarable_commands.item
3959 if os_cmd /= Void then
3960 os_cmd.recycle
3961 end
3962 toolbarable_commands.forth
3963 end
3964
3965 c_finalized_compilation_cmd := Void
3966 c_finalized_compilation_cmd := Void
3967 new_class_cmd := Void
3968 new_cluster_cmd := Void
3969 new_feature_cmd := Void
3970 shell_cmd := Void
3971 toggle_feature_alias_cmd := Void
3972 toggle_feature_assigner_cmd := Void
3973 toggle_feature_signature_cmd := Void
3974 undo_cmd := Void
3975 redo_cmd := Void
3976 toggle_stone_cmd := Void
3977 delete_class_cluster_cmd := Void
3978 print_cmd := Void
3979 end
3980
3981 recycle_formatters is
3982 -- Recycle formatters
3983 do
3984 from
3985 managed_class_formatters.start
3986 until
3987 managed_class_formatters.after
3988 loop
3989 if managed_class_formatters.item /= Void then
3990 managed_class_formatters.item.recycle
3991 end
3992 managed_class_formatters.forth
3993 end
3994
3995 from
3996 managed_feature_formatters.start
3997 until
3998 managed_feature_formatters.after
3999 loop
4000 if managed_feature_formatters.item /= Void then
4001 managed_feature_formatters.item.recycle
4002 end
4003 managed_feature_formatters.forth
4004 end
4005
4006 from
4007 managed_main_formatters.start
4008 until
4009 managed_main_formatters.after
4010 loop
4011 if managed_main_formatters.item /= Void then
4012 managed_main_formatters.item.recycle
4013 end
4014 managed_main_formatters.forth
4015 end
4016 end
4017
4018 recycle_menu is
4019 --
4020 do
4021 tools_menu.destroy
4022 window_menu.destroy
4023 metric_menu.destroy
4024 -- compile_menu.destroy
4025 debug_menu.destroy
4026 debugging_tools_menu.destroy
4027 favorites_menu.destroy
4028 view_menu.destroy
4029
4030 tools_menu := Void
4031 window_menu := Void
4032 metric_menu := Void
4033 format_menu := Void
4034 compile_menu := Void
4035 debug_menu := Void
4036 debugging_tools_menu := Void
4037 favorites_menu := Void
4038 view_menu := Void
4039 end
4040
4041
4042 feature {NONE} -- Implementation: Editor commands
4043
4044 refresh_cursor_position is
4045 -- Display the current cursor position in the status bar.
4046 require
4047 text_loaded: not is_empty
4048 local
4049 l, c, v: INTEGER
4050 do
4051 l := editor_tool.text_area.cursor_y_position
4052 c := editor_tool.text_area.cursor_x_position
4053 v := editor_tool.text_area.cursor_visible_x_position
4054 status_bar.set_cursor_position (l, c, v)
4055 end
4056
4057 refresh_context_info is
4058 -- Refresh address bar and features tool to relect
4059 -- where in the code the cursor is located.
4060 local
4061 l_feature: FEATURE_AS
4062 l_classc_stone: CLASSC_STONE
4063 do
4064 context_refreshing_timer.set_interval (0)
4065 l_classc_stone ?= stone
4066 if l_classc_stone /= Void then
4067 l_feature := editor_tool.text_area.text_displayed.current_feature_containing
4068 if l_feature /= Void then
4069 set_editing_location_by_feature (l_feature)
4070 else
4071 set_editing_location_by_feature (Void)
4072 end
4073 end
4074 end
4075
4076 set_editing_location_by_feature (a_feature: FEATURE_AS) is
4077 -- Set editing location, feature tool and combo box changes according to `a_feature'.
4078 local
4079 l_efeature: E_FEATURE
4080 l_class_i: CLASS_I
4081 l_classc: CLASS_C
4082 do
4083 if a_feature /= Void then
4084 address_manager.set_feature_text_simply (a_feature.feature_names.first.internal_name)
4085 l_class_i := eiffel_universe.class_named (class_name, group)
4086 if l_class_i /= Void and then l_class_i.is_compiled then
4087 l_classc := l_class_i.compiled_class
4088 if l_classc.has_feature_table then
4089 l_efeature := l_classc.feature_with_name (a_feature.feature_names.first.internal_name)
4090 if l_efeature /= Void and then l_efeature.written_in /= l_classc.class_id then
4091 l_efeature := Void
4092 end
4093 end
4094 end
4095 if l_efeature /= Void then
4096 seek_item_in_feature_tool (l_efeature)
4097 else
4098 features_tool.seek_ast_item_in_feature_tool (a_feature.feature_names.first.internal_name)
4099 end
4100 else
4101 address_manager.set_feature_text_simply (once "")
4102 seek_item_in_feature_tool (Void)
4103 end
4104 end
4105
4106 seek_item_in_feature_tool (a_feature: E_FEATURE) is
4107 -- Seek and select item contains data of `a_feature' in features tool.
4108 -- If `a_feature' is void, deselect item in features tool.
4109 do
4110 features_tool.seek_item_in_feature_tool (a_feature)
4111 end
4112
4113 select_all is
4114 -- Select the whole text in the focused editor.
4115 do
4116 current_editor.select_all
4117 end
4118
4119 search is
4120 -- Search some text in the focused editor.
4121 local
4122 cv_ced: EB_CLICKABLE_EDITOR
4123 do
4124 cv_ced ?= current_editor
4125 if cv_ced /= Void then
4126 cv_ced.search
4127 end
4128 end
4129
4130 goto is
4131 -- Display a dialog to select a line to go to in the editor.
4132 local
4133 ed: EB_EDITOR
4134 do
4135 ed ?= current_editor
4136 if ed /= Void then
4137 create goto_dialog.make (ed)
4138 goto_dialog.show_modal_to_window (Current.window)
4139 end
4140 end
4141
4142 toggle_line_number_display is
4143 -- Toggle line number display on/off in editor
4144 do
4145 preferences.editor_data.show_line_numbers_preference.set_value (not preferences.editor_data.show_line_numbers)
4146 end
4147
4148 find_next is
4149 -- Find the next occurrence of the search text.
4150 local
4151 cv_ced: EB_CLICKABLE_EDITOR
4152 do
4153 if search_tool.currently_searched /= Void then
4154 cv_ced ?= current_editor
4155 if cv_ced /= Void then
4156 cv_ced.find_next
4157 end
4158 else
4159 search_tool.show_and_set_focus
4160 end
4161 end
4162
4163 find_previous is
4164 -- Find the previous occurrence of the search text.
4165 local
4166 cv_ced: EB_CLICKABLE_EDITOR
4167 do
4168 if search_tool.currently_searched /= Void then
4169 cv_ced ?= current_editor
4170 if cv_ced /= Void then
4171 cv_ced.find_previous
4172 end
4173 else
4174 search_tool.show_and_set_focus
4175 end
4176 end
4177
4178 find_selection is
4179 -- Find the next occurrence of the selection.
4180 local
4181 cv_ced: EB_CLICKABLE_EDITOR
4182 do
4183 cv_ced ?= current_editor
4184 if cv_ced /= Void then
4185 cv_ced.find_selection
4186 end
4187 end
4188
4189 cut_selection is
4190 -- Cut the selection in the current editor.
4191 do
4192 current_editor.cut_selection
4193 end
4194
4195 copy_selection is
4196 -- Cut the selection in the current editor.
4197 do
4198 current_editor.copy_selection
4199 end
4200
4201 toggle_formatting_marks is
4202 -- Show/Hide formatting marks in the editor and update related menu item.
4203 do
4204 current_editor.toggle_view_invisible_symbols
4205 if current_editor.view_invisible_symbols then
4206 formatting_marks_command_menu_item.set_text (Interface_names.m_hide_formatting_marks)
4207 else
4208 formatting_marks_command_menu_item.set_text(Interface_names.m_show_formatting_marks)
4209 end
4210 end
4211
4212 feature {NONE} -- Implementation / Menus
4213
4214 number_of_displayed_external_commands: INTEGER
4215 -- Number of external commands in the tools menu.
4216
4217 old_cur: EV_CURSOR
4218 -- Cursor saved while displaying the hourglass cursor.
4219
4220 cur_wid: EV_WIDGET
4221 -- Widget on which the hourglass cursor was set.
4222
4223 project_menu: EV_MENU
4224 -- Menu for entries relative to the Project.
4225
4226 recent_projects_menu: EB_RECENT_PROJECTS_MANAGER_MENU
4227 -- SubMenu for recent projects.
4228
4229 during_synchronization: BOOLEAN
4230 -- Are we during a resynchronization?
4231
4232 formatting_marks_command_menu_item: EB_COMMAND_MENU_ITEM
4233 -- Menu item used to shw/hide formatting marks.
4234
4235 undo_accelerator: EV_ACCELERATOR
4236 -- Accelerator for Ctrl+Z
4237
4238 redo_accelerator: EV_ACCELERATOR
4239 -- Accelerator for Ctrl+Y
4240
4241 feature {EB_TOOL} -- Implementation / Commands
4242
4243 shell_cmd: EB_OPEN_SHELL_COMMAND
4244 -- Command to use an external editor.
4245
4246 undo_cmd: EB_UNDO_COMMAND
4247 -- Command to undo in the editor.
4248
4249 redo_cmd: EB_REDO_COMMAND
4250 -- Command to redo in the editor.
4251
4252 editor_paste_cmd: EB_EDITOR_PASTE_COMMAND
4253 -- Command to paste text in the editor.
4254
4255 melt_cmd: EB_MELT_PROJECT_COMMAND
4256 -- Command to start compilation.
4257
4258 feature{EB_TOOL, EB_C_COMPILER_LAUNCHER}
4259
4260 c_workbench_compilation_cmd: EB_C_COMPILATION_COMMAND
4261 -- Command to compile the workbench C code.
4262
4263 c_finalized_compilation_cmd: EB_C_COMPILATION_COMMAND
4264 -- Command to compile the finalized C code.
4265
4266 feature{EB_TOOL}
4267
4268 new_cluster_cmd: EB_NEW_CLUSTER_COMMAND
4269 -- Command to create a new cluster.
4270
4271 new_class_cmd: EB_NEW_CLASS_COMMAND
4272 -- Command to create a new class.
4273
4274 new_feature_cmd: EB_NEW_FEATURE_COMMAND
4275 -- Command to execute the feature wizard.
4276
4277 toggle_feature_alias_cmd: EB_TOGGLE_FEATURE_ALIAS_COMMAND
4278 -- Show/Hide alias name of feature node in eb_feature_tool
4279
4280 toggle_feature_signature_cmd: EB_TOGGLE_FEATURE_SIGNATURE_COMMAND
4281 -- Show/Hide signature of feature node in eb_feature_tool
4282
4283 toggle_feature_assigner_cmd: EB_TOGGLE_FEATURE_ASSIGNER_COMMAND
4284 -- Show/Hide assigner name of feature node in eb_feature_tool
4285
4286 toggle_stone_cmd: EB_UNIFY_STONE_CMD
4287 -- Command to toggle between the stone management modes.
4288
4289 delete_class_cluster_cmd: EB_DELETE_CLASS_CLUSTER_COMMAND
4290 -- Command to remove a class or a cluster from the system
4291 -- (permanent deletion).
4292
4293 show_profiler: EB_SHOW_PROFILE_TOOL
4294 -- What allows us to display the profiler window.
4295
4296 toolbarable_commands: ARRAYED_LIST [EB_TOOLBARABLE_COMMAND]
4297 -- All commands that can be put in a toolbar.
4298
4299 command_controller: EB_EDITOR_COMMAND_CONTROLLER
4300 -- Object that takes care of updating the sensitivity of all editor commands.
4301
4302 save_as_cmd: EB_SAVE_FILE_AS_COMMAND
4303 -- Command to save a class with a different file name.
4304
4305 feature{EB_TOOL, EB_EXTERNAL_OUTPUT_TOOL}
4306
4307 Edit_external_commands_cmd: EB_EXTERNAL_COMMANDS_EDITOR is
4308 -- Command that lets the user add new external commands to the tools menu.
4309 once
4310 create Result.make
4311 Result.enable_sensitive
4312 end
4313
4314 feature{EB_TOOL}
4315
4316 system_info_cmd: EB_STANDARD_CMD is
4317 -- Command to display information about the system (root class,...)
4318 do
4319 Result := Eb_debugger_manager.system_info_cmd
4320 end
4321
4322 display_error_help_cmd: EB_ERROR_INFORMATION_CMD is
4323 -- Command to pop up a dialog giving help on compilation errors.
4324 do
4325 Result := Eb_debugger_manager.display_error_help_cmd
4326 end
4327
4328 send_stone_to_context_cmd: EB_STANDARD_CMD
4329 -- Command to send the current stone to the context tool.
4330
4331 print_cmd: EB_PRINT_COMMAND
4332 -- Command to print the content of editor with focus
4333
4334 eac_browser_cmd: EB_OPEN_EAC_BROWSER_CMD is
4335 -- Command to display the eac browser
4336 do
4337 Result := Eb_debugger_manager.eac_browser_cmd
4338 end
4339
4340 show_favorites_menu_item: EV_MENU_ITEM
4341 -- Show/Hide favorites menu item.
4342
4343 update_show_favorites_menu_item is
4344 -- Update `show_favorites_menu_item' menu label.
4345 do
4346 if favorites_tool.shown then
4347 show_favorites_menu_item.set_text (Interface_names.m_hide_favorites)
4348 else
4349 show_favorites_menu_item.set_text (Interface_names.m_show_favorites)
4350 end
4351 end
4352
4353 execute_show_favorites is
4354 -- Show `favorites_tool' if it is closed, close
4355 -- it in the opposite case.
4356 do
4357 update_show_favorites_menu_item
4358 if favorites_tool.shown then
4359 favorites_tool.close
4360 else
4361 favorites_tool.show
4362 end
4363 end
4364
4365 feature {EB_TOOL_WINDOW, EB_EXPLORER_BAR, EB_DEBUGGER_MANAGER} -- Floating tool handling
4366
4367 all_tool_windows: ARRAYED_LIST [EB_TOOL_WINDOW]
4368 -- All tool windows under the control of `Current'.
4369
4370 add_tool_window (a_tool_window: EB_TOOL_WINDOW) is
4371 -- Add `a_tool_window' to `all_tool_windows', ensuring it is
4372 -- then under the control of `Current'.
4373 require
4374 a_tool_window_not_void: a_tool_window /= Void
4375 do
4376 if all_tool_windows = Void then
4377 create all_tool_windows.make (2)
4378 end
4379 all_tool_windows.extend (a_tool_window)
4380 ensure
4381 extended: all_tool_windows.has (a_tool_window)
4382 end
4383
4384 remove_tool_window (a_widget: EV_WIDGET) is
4385 -- Remove tool window associate with `a_widget'.
4386 require
4387 a_widget_not_void: a_widget /= Void
4388 do
4389 if all_tool_windows /= Void then
4390 from
4391 all_tool_windows.start
4392 until
4393 all_tool_windows.off
4394 loop
4395 if all_tool_windows.item.tool = a_widget then
4396 all_tool_windows.remove
4397 all_tool_windows.finish
4398 end
4399 all_tool_windows.forth
4400 end
4401 end
4402 end
4403
4404 remove_all_tool_windows is
4405 -- Ensure `all_tool_windows' is empty if non Void.
4406 do
4407 if all_tool_windows /= Void then
4408 all_tool_windows.wipe_out
4409 end
4410 ensure
4411 tool_windows_empty: all_tool_windows /= Void implies all_tool_windows.is_empty
4412 end
4413
4414 window_moved (x_pos, y_pos: INTEGER) is
4415 -- `Current' has been moved, so move all associated tool windows within `all_tool_windows'.
4416 local
4417 tool_window: EB_TOOL_WINDOW
4418 do
4419 if all_tool_windows /= Void then
4420 from
4421 all_tool_windows.start
4422 until
4423 all_tool_windows.off
4424 loop
4425 tool_window := all_tool_windows.item
4426 check
4427 not_destroyed: not tool_window.window.is_destroyed
4428 end
4429 if preferences.development_window_data.dock_tracking then
4430 tool_window.window.move_actions.block
4431 tool_window.window.set_x_position (x_pos + tool_window.x_position)
4432 tool_window.window.set_y_position (y_pos + tool_window.y_position)
4433 tool_window.window.move_actions.resume
4434 else
4435 -- If we are not performing dock tracking, we must update the relative position
4436 -- of the tool window, so that if dock tracking is enabled, the relative
4437 -- positions are correct.
4438 tool_window.set_x_position ( tool_window.window.screen_x - x_pos)
4439 tool_window.set_y_position ( tool_window.window.screen_y - y_pos)
4440 end
4441 all_tool_windows.forth
4442 end
4443 end
4444 end
4445
4446 feature {NONE} -- Execution
4447
4448 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
4449 -- Action called when the user right-click in the toolbar.
4450 -- Display a popup menu to show/hide toolbars and customize the general toolbar.
4451 local
4452 popup_menu: EV_MENU
4453 do
4454 if a_button = 3 then
4455 popup_menu := build_toolbar_menu
4456 popup_menu.show
4457 end
4458 end
4459
4460 enable_commands_on_project_created is
4461 -- Enable commands when a new project has been created (not yet compiled)
4462 do
4463 system_info_cmd.enable_sensitive
4464 if
4465 stone /= Void and then
4466 not unified_stone
4467 then
4468 send_stone_to_context_cmd.enable_sensitive
4469 end
4470 end
4471
4472 enable_commands_on_project_loaded is
4473 -- Enable commands when a new project has been created and compiled
4474 do
4475 if has_profiler then
4476 show_profiler.enable_sensitive
4477 end
4478 if has_dll_generation then
4479 show_dynamic_lib_tool.enable_sensitive
4480 end
4481 open_cmd.enable_sensitive
4482 new_class_cmd.enable_sensitive
4483 new_cluster_cmd.enable_sensitive
4484 system_info_cmd.enable_sensitive
4485 if unified_stone then
4486 send_stone_to_context_cmd.disable_sensitive
4487 elseif stone /= Void then
4488 send_stone_to_context_cmd.enable_sensitive
4489 end
4490 new_class_cmd.enable_sensitive
4491 new_cluster_cmd.enable_sensitive
4492 delete_class_cluster_cmd.enable_sensitive
4493 c_workbench_compilation_cmd.enable_sensitive
4494 c_finalized_compilation_cmd.enable_sensitive
4495 refactoring_manager.enable_sensitive
4496 end
4497
4498 disable_commands_on_project_unloaded is
4499 -- Enable commands when a project has been closed.
4500 do
4501 if has_dll_generation then
4502 show_dynamic_lib_tool.disable_sensitive
4503 end
4504 if has_profiler then
4505 show_profiler.disable_sensitive
4506 end
4507 open_cmd.disable_sensitive
4508 new_class_cmd.disable_sensitive
4509 new_cluster_cmd.disable_sensitive
4510 if not project_manager.is_created then
4511 system_info_cmd.disable_sensitive
4512 send_stone_to_context_cmd.disable_sensitive
4513 end
4514 delete_class_cluster_cmd.disable_sensitive
4515 c_workbench_compilation_cmd.disable_sensitive
4516 c_finalized_compilation_cmd.disable_sensitive
4517 refactoring_manager.disable_sensitive
4518 refactoring_manager.forget_undo_redo
4519 end
4520
4521 feature {NONE} -- Access
4522
4523 development_window_data: EB_DEVELOPMENT_WINDOW_DATA is
4524 -- Meta data describing `Current'.
4525 do
4526 if internal_development_window_data /= Void then
4527 Result := internal_development_window_data
4528 else
4529 Result := preferences.development_window_data
4530 end
4531 end
4532
4533 internal_development_window_data: EB_DEVELOPMENT_WINDOW_SESSION_DATA;
4534 -- Internal custom meta data for `Current'.
4535
4536 feature {NONE} -- Implementation
4537
4538 is_string_started_by (s1, s2: STRING_GENERAL): BOOLEAN is
4539 -- Is `s1' starting by `s2' characters
4540 require
4541 s2_not_void: s2 /= Void
4542 local
4543 i: INTEGER
4544 do
4545 if s1 /= Void and then s1.count >= s2.count then
4546 from
4547 i := 1
4548 Result := True
4549 until
4550 i > s2.count or not Result
4551 loop
4552 Result := s1.code (i) = s2.code (i)
4553 i := i + 1
4554 end
4555 end
4556 end
4557
4558 indexing
4559 copyright: "Copyright (c) 1984-2006, Eiffel Software"
4560 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
4561 licensing_options: "http://www.eiffel.com/licensing"
4562 copying: "[
4563 This file is part of Eiffel Software's Eiffel Development Environment.
4564
4565 Eiffel Software's Eiffel Development Environment is free
4566 software; you can redistribute it and/or modify it under
4567 the terms of the GNU General Public License as published
4568 by the Free Software Foundation, version 2 of the License
4569 (available at the URL listed under "license" above).
4570
4571 Eiffel Software's Eiffel Development Environment is
4572 distributed in the hope that it will be useful, but
4573 WITHOUT ANY WARRANTY; without even the implied warranty
4574 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4575 See the GNU General Public License for more details.
4576
4577 You should have received a copy of the GNU General Public
4578 License along with Eiffel Software's Eiffel Development
4579 Environment; if not, write to the Free Software Foundation,
4580 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
4581 ]"
4582 source: "[
4583 Eiffel Software
4584 356 Storke Road, Goleta, CA 93117 USA
4585 Telephone 805-685-1006, Fax 805-685-6869
4586 Website http://www.eiffel.com
4587 Customer support http://support.eiffel.com
4588 ]"
4589
4590 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