/[eiffelstudio]/branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_melt_project_command.e
ViewVC logotype

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_melt_project_command.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62171 - (show annotations)
Tue Aug 1 01:27:17 2006 UTC (13 years, 4 months ago) by larryl
File size: 12339 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description : "Command to update the Eiffel project."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date : "$Date$"
6 revision : "$Revision$"
7
8 class
9 EB_MELT_PROJECT_COMMAND
10
11 inherit
12 EB_TOOLBARABLE_AND_MENUABLE_COMMAND
13 redefine
14 tooltext,
15 is_tooltext_important
16 end
17
18 EB_SHARED_GRAPHICAL_COMMANDS
19 export
20 {NONE} all
21 end
22
23 SHARED_EIFFEL_PROJECT
24 export
25 {NONE} all
26 end
27
28 PROJECT_CONTEXT
29 export
30 {NONE} all
31 end
32
33 SHARED_RESCUE_STATUS
34 export
35 {NONE} all
36 end
37
38 SHARED_CONFIGURE_RESOURCES
39 export
40 {NONE} all
41 end
42
43 SHARED_WORKBENCH
44 export
45 {NONE} all
46 end
47
48 EXCEPTIONS
49 export
50 {NONE} all
51 end
52
53 EB_SHARED_INTERFACE_TOOLS
54 export
55 {NONE} all
56 end
57
58 EB_SHARED_FORMAT_TABLES
59 export
60 {NONE} all
61 end
62
63 SHARED_FLAGS
64
65 EV_SHARED_APPLICATION
66 export
67 {NONE} all
68 end
69
70 create
71 make
72
73 feature {NONE} -- Initialization
74
75 make is
76 -- Initialize default values.
77 do
78 create accelerator.make_with_key_combination (
79 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_f7),
80 False, False, False)
81 accelerator.actions.extend (agent execute)
82 end
83
84 feature -- Properties
85
86 is_precompiling: BOOLEAN is
87 -- Is this compilation a precompilation?
88 do
89 -- False for a standard compilation
90 end
91
92 feature -- Status Setting
93
94 set_run_after_melt (b: BOOLEAN) is
95 -- Request for the system to be executed after a
96 -- successful melt compilation or not.
97 -- Assign `b' to `run_after_melt'.
98 do
99 run_after_melt2 := b
100 end
101
102 feature {NONE} -- Compilation implementation
103
104 reset_debugger is
105 -- Kill the application, if it is running.
106 do
107 Eb_debugger_manager.on_compile_start
108 end
109
110 compile is
111 -- Compile, in the one way or the other.
112 do
113 if not Eiffel_project.is_compiling then
114 reset_debugger
115 Window_manager.on_compile
116 perform_compilation
117 display_eiffel_compilation_status
118 if Eiffel_project.successful then
119 -- If a freezing already occurred (due to a new external
120 -- or new derivation of SPECIAL), no need to freeze again.
121 if Eiffel_project.save_error then
122 output_manager.add_string ("Could not write to ")
123 output_manager.add_string (project_location.location)
124 output_manager.add_new_line
125 output_manager.add_string ("Please check permissions / disk space")
126 output_manager.add_new_line
127 output_manager.add_string ("and retry")
128 output_manager.add_new_line
129 else
130 if not finalization_error then
131 launch_c_compilation
132 end
133 end
134 end
135 Degree_output.finish_degree_output
136 tool_resynchronization
137 output_manager.end_processing
138 end
139 end
140
141 display_eiffel_compilation_status is
142 -- Display status of eiffel compilation.
143 do
144 if Workbench.successful then
145 output_manager.add_string (Interface_names.E_compilation_succeeded)
146 output_manager.add_new_line
147 else
148 output_manager.add_string (Interface_names.e_compilation_failed)
149 output_manager.add_new_line
150 end
151 end
152
153 tool_resynchronization is
154 -- Resynchronize class, feature and system tools.
155 -- Clear the format_context buffers.
156 do
157 -- Clear the format_context buffers.
158 clear_format_tables
159 window_manager.display_message_and_percentage (Interface_names.d_Resynchronizing_tools, 0)
160 window_manager.synchronize_all
161 if Workbench.successful then
162 if not process_manager.is_c_compilation_running then
163 window_manager.display_message (Interface_names.E_compilation_succeeded)
164 end
165 else
166 window_manager.display_message (Interface_names.E_compilation_failed)
167 end
168 -- This is commented because if the tools are never displayed,
169 -- the viewport of the editor never get correct width and height value.
170 -- Precondition in the editor will fail.
171 -- output_manager.scroll_to_end
172 Eb_debugger_manager.on_compile_stop
173
174 if dynamic_lib_window_is_valid and then dynamic_lib_window.is_visible then
175 dynamic_lib_window.refresh
176 end
177 end
178
179 launch_c_compilation is
180 -- Launch the C compilation.
181 do
182 if start_c_compilation and then Eiffel_project.freezing_occurred then
183 if Eiffel_project.freezing_occurred then
184 output_manager.add_string ("System had to be frozen to include new or modified externals.")
185 output_manager.add_new_line
186 end
187 output_manager.add_string ("Eiffel system recompiled")
188 output_manager.add_new_line
189
190 Eiffel_project.call_finish_freezing (True)
191 end
192 end
193
194 perform_compilation is
195 -- The real compilation. (This is melting.)
196 do
197 Eiffel_project.quick_melt
198 end
199
200 feature {NONE} -- Attributes
201
202 not_saved: BOOLEAN is
203 -- Has the text of some tool been edited and not saved?
204 do
205 Result := window_manager.has_modified_windows
206 end
207
208 finalization_error: BOOLEAN is
209 -- Has a validity error been detected during the
210 -- finalization? This happens with DLE dealing
211 -- with statically bound feature calls
212 do
213 end
214
215 start_c_compilation: BOOLEAN
216 -- Do we have to start the C compilation after C Code generation?
217
218 run_after_melt: BOOLEAN
219 -- Should we execute the system after sucessful melt?
220
221 run_after_melt2: BOOLEAN
222 -- Should we execute the system after sucessful melt?
223 -- This boolean value is only reliable at the beginning
224 -- of the execution of this command. After a warning or
225 -- confirmation panel has been popped up, this value
226 -- can be cleared by the caller. To prevent that, we
227 -- keep track of that value in `run_after_melt' at the
228 -- beginning of the execution, so that we can still
229 -- rely on it after a confirmation when we resume
230 -- (i.e. re-execute) the command
231
232 retried: BOOLEAN
233 -- Is this already tried?
234
235 c_code_directory: STRING is
236 -- Directory where the C code is stored.
237 do
238 Result := project_location.workbench_path
239 end
240
241 feature -- Execution
242
243 execute is
244 -- Recompile the project, start C compilation if necessarry.
245 do
246 if is_sensitive then
247 if process_manager.is_c_compilation_running then
248 process_manager.confirm_process_termination (agent go_on_compile, Void, window_manager.last_focused_development_window.window)
249 else
250 window_manager.last_focused_development_window.tools.output_tool.content.set_focus
251 go_on_compile
252 end
253 end
254 end
255
256 execute_and_wait is
257 -- Execute current command and wait for it to finish.
258 do
259 execute
260 from
261 until
262 not process_manager.is_c_compilation_running
263 loop
264 process_events_and_idle
265 end
266 end
267
268 go_on_compile is
269 -- Go on running Eiffel compilation.
270 do
271 output_manager.clear
272 execute_with_c_compilation_flag (True)
273 window_manager.last_focused_development_window.tools.output_tool.update_pixmap
274 end
275
276 give_up_comiple is
277 -- Give up Eiffel compilation.
278 do
279 end
280
281 execute_without_c_compilation is
282 -- Recompile the project, but do not start C compilation.
283 do
284 execute_with_c_compilation_flag (False)
285 end
286
287 feature {NONE} -- Execution
288
289 execute_with_c_compilation_flag (c_compilation_enabled: BOOLEAN) is
290 -- Recompile the project and start C compilation if `c_compilation_enabled'
291 -- is True.
292 local
293 wd: EV_WARNING_DIALOG
294 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
295 do
296 start_c_compilation := c_compilation_enabled
297 if c_compilation_enabled then
298 -- Should we execute the system after sucessful melt?
299 -- (See header comment of `run_after_melt2'.)
300 run_after_melt := run_after_melt2
301 else
302 run_after_melt := false
303 end
304 if Eiffel_project.is_read_only then
305 create wd.make_with_text (Warning_messages.w_Cannot_compile)
306 wd.show_modal_to_window (window_manager.last_focused_window.window)
307 elseif Eiffel_project.initialized then
308 if not_saved then
309 create cd.make_initialized (
310 3, preferences.dialog_data.confirm_save_before_compile_string,
311 Warning_messages.w_Files_not_saved_before_compiling,
312 Interface_names.l_Discard_save_before_compile_dialog,
313 preferences.preferences
314 )
315 cd.set_ok_action (agent save_and_compile)
316 cd.set_no_action (agent compile_no_save)
317 cd.show_modal_to_window (window_manager.last_focused_window.window)
318 else
319 compile_no_save
320 end
321 end
322 end
323
324 save_and_compile is
325 -- Save all files, then launch compilation
326 do
327 window_manager.save_all_before_compiling
328 compile_no_save
329 end
330
331 compile_no_save is
332 -- Launch compilation.
333 do
334 window_manager.last_focused_development_window.window.set_focus
335 confirm_and_compile
336 end
337
338 confirm_and_compile is
339 -- Ask for confirmations and options, then compile.
340 --| Can be redefined in descendants!
341 do
342 confirm_execution_halt
343 end
344
345 confirm_execution_halt is
346 -- If the application is running, prompt
347 -- user so and ask for a confirmation.
348 -- If confirmation successful then compile.
349 local
350 cd: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
351 do
352 if
353 not Debugger_manager.application_is_executing
354 then
355 compile_and_run
356 else
357 create cd.make_initialized (2, preferences.dialog_data.stop_execution_when_compiling_string, "Recompiling project will end current run.", Interface_names.L_do_not_show_again, preferences.preferences)
358 cd.set_ok_action (agent compile_and_run)
359 cd.show_modal_to_window (window_manager.last_focused_development_window.window)
360 end
361 end
362
363 compile_and_run is
364 -- Compile, then run application, according
365 -- to run ability and `run_after_melt' flag.
366 do
367 compile
368 if
369 run_after_melt and then
370 Eiffel_ace.file_name /= Void and then
371 Eiffel_project.successful and
372 not Eiffel_project.freezing_occurred
373 then
374 -- The system has been successfully melted.
375 -- The system can be executed as required.
376 Run_project_cmd.execute
377 end
378 end
379
380 feature {NONE} -- Implementation
381
382 tooltext: STRING is
383 -- Text displayed in toolbar
384 do
385 Result := Interface_names.b_Compile
386 end
387
388 is_tooltext_important: BOOLEAN is
389 -- Is the tooltext important shown when view is 'Selective Text'
390 do
391 Result := tooltext.is_equal (Interface_names.b_Compile)
392 end
393
394 menu_name: STRING is
395 -- Name as it appears in the menu (with & symbol).
396 do
397 Result := Interface_names.m_Melt_new
398 end
399
400 pixmap: EV_PIXMAP is
401 -- Pixmap representing the command.
402 do
403 Result := pixmaps.icon_pixmaps.project_melt_icon
404 end
405
406 pixel_buffer: EV_PIXEL_BUFFER is
407 -- Pixel buffer representing the command.
408 do
409 Result := pixmaps.icon_pixmaps.project_melt_icon_buffer
410 end
411
412 tooltip: STRING is
413 -- Tooltip for the toolbar button.
414 do
415 Result := Interface_names.f_Melt
416 end
417
418 description: STRING is
419 -- Description for the command.
420 do
421 Result := Interface_names.f_Melt
422 end
423
424 name: STRING is
425 -- Name of the command. Used to store the command in the
426 -- preferences.
427 do
428 Result := "Melt_project"
429 end
430
431 stop_execution: ANY is
432 -- Argument used when files needs to be saved before compiling.
433 once
434 create Result
435 end
436
437 number_of_compilations: INTEGER;
438 -- Number of compilations done in a certain mode so far.
439
440 indexing
441 copyright: "Copyright (c) 1984-2006, Eiffel Software"
442 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
443 licensing_options: "http://www.eiffel.com/licensing"
444 copying: "[
445 This file is part of Eiffel Software's Eiffel Development Environment.
446
447 Eiffel Software's Eiffel Development Environment is free
448 software; you can redistribute it and/or modify it under
449 the terms of the GNU General Public License as published
450 by the Free Software Foundation, version 2 of the License
451 (available at the URL listed under "license" above).
452
453 Eiffel Software's Eiffel Development Environment is
454 distributed in the hope that it will be useful, but
455 WITHOUT ANY WARRANTY; without even the implied warranty
456 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
457 See the GNU General Public License for more details.
458
459 You should have received a copy of the GNU General Public
460 License along with Eiffel Software's Eiffel Development
461 Environment; if not, write to the Free Software Foundation,
462 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
463 ]"
464 source: "[
465 Eiffel Software
466 356 Storke Road, Goleta, CA 93117 USA
467 Telephone 805-685-1006, Fax 805-685-6869
468 Website http://www.eiffel.com
469 Customer support http://support.eiffel.com
470 ]"
471
472 end -- class EB_MELT_PROJECT_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23