/[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 59332 - (show annotations)
Thu Jun 1 13:55:38 2006 UTC (13 years, 8 months ago) by jfiat
Original Path: trunk/Src/Eiffel/interface/new_graphical/windows/eb_development_window.e
File size: 136621 byte(s)
Improved the output for the cluster stone.
Now display the count of compiled classes, classes not in the system, and overriden classes.
now if you click on a subfolder of a "recursive cluster" show only the classes contained in this subfolder (and recursively)


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