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

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_exit_application_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: 6271 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description : "Command to exit the application"
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_EXIT_APPLICATION_COMMAND
10
11 inherit
12 EB_MENUABLE_COMMAND
13
14 PROJECT_CONTEXT
15 export {NONE} all end
16
17 EB_SHARED_DEBUG_TOOLS
18 export {NONE} all end
19
20 EB_SHARED_MANAGERS
21 export {NONE} all end
22
23 EB_CONSTANTS
24 export {NONE} all end
25
26 SHARED_WORKBENCH
27 export {NONE} all end
28
29 SHARED_ERROR_HANDLER
30 export {NONE} all end
31
32 EV_SHARED_APPLICATION
33 export {NONE} all end
34
35 EB_SHARED_PREFERENCES
36 export {NONE} all end
37
38 feature -- Basic operations
39
40 execute is
41 -- Exit application. Ask the user to save unsaved files and ask for
42 -- confirmation on exit.
43 local
44 wd: EV_WARNING_DIALOG
45 do
46 already_confirmed := False
47 if Workbench.is_compiling then
48 already_confirmed := True
49 create wd.make_with_text (Warning_messages.w_Exiting_stops_compilation)
50 wd.show_modal_to_window (window_manager.last_focused_window.window)
51 else
52 if process_manager.is_process_running then
53 process_manager.confirm_process_termination_for_quiting (agent confirm_stop_debug, agent do_nothing, window_manager.last_focused_window.window)
54 else
55 confirm_stop_debug
56 end
57 end
58 end
59
60 feature -- Status setting
61
62 set_already_confirmed (b: BOOLEAN) is
63 -- Set a flag saying a confirmation dialog was already displayed => do not ask again.
64 do
65 already_confirmed := b
66 end
67
68 feature {EB_WINDOW_MANAGER} -- Exit methods.
69
70 ask_confirmation is
71 -- Display a confirmation dialog box
72 local
73 exit_confirmation_dialog: STANDARD_DISCARDABLE_CONFIRMATION_DIALOG
74 do
75 if not already_confirmed then
76 already_confirmed := True
77 create exit_confirmation_dialog.make_initialized (
78 2, preferences.dialog_data.confirm_on_exit_string,
79 Interface_names.l_Exit_application, Interface_names.l_Dont_ask_me_again,
80 preferences.preferences
81 )
82 exit_confirmation_dialog.set_ok_action (agent exit_application)
83 exit_confirmation_dialog.show_modal_to_window (window_manager.last_focused_window.window)
84 else
85 exit_application
86 end
87 end
88
89 feature {NONE} -- Callbacks
90
91 exit_application is
92 -- Exit the application
93 do
94 -- If an application was being debugged, kill it.
95 if Eb_debugger_manager.application_is_executing then
96 Eb_debugger_manager.application.kill
97 end
98 -- If we are going to kill the application, we'd better warn project observers that the project will
99 -- soon be unloaded before EiffelStudio is destroyed.
100 if Workbench.Eiffel_project.initialized then
101 Workbench.Eiffel_project.manager.on_project_close;
102 end
103 -- We will save all the preferences for next time we are opened
104 preferences.preferences.save_preferences
105
106 window_manager.a_development_window.save_tools_docking_layout
107
108 -- Destroy all development windows.
109 window_manager.close_all
110
111 -- Destroy the application.
112 ev_application.destroy
113 end
114
115 confirm_stop_debug is
116 -- Exit application. Ask the user to kill the debugger if it is running
117 local
118 cd: EV_CONFIRMATION_DIALOG
119 do
120 if process_manager.is_process_running then
121 process_manager.terminate_process
122 end
123 if Eb_debugger_manager.application_is_executing then
124 already_confirmed := True
125 create cd.make_with_text (Warning_messages.w_Exiting_stops_debugger)
126 cd.button ("OK").select_actions.extend (agent confirm_and_exit)
127 cd.show_modal_to_window (window_manager.last_focused_window.window)
128 else
129 confirm_and_exit
130 end
131 end
132
133 confirm_and_exit is
134 -- Ask to save files, to confirm if necessary and exit.
135 local
136 qd: EV_QUESTION_DIALOG
137 do
138 if window_manager.has_modified_windows then
139 already_confirmed := True
140 create qd.make_with_text (Interface_names.l_Exit_warning)
141 qd.button ("Yes").select_actions.extend (agent save_and_exit)
142 qd.button ("No").select_actions.extend (agent ask_confirmation)
143 qd.show_modal_to_window (window_manager.last_focused_development_window.window)
144 else
145 ask_confirmation
146 end
147 end
148
149 save_and_exit is
150 -- Save all windows and exit.
151 local
152 wd: EV_WARNING_DIALOG
153 do
154 window_manager.save_all
155 if not Window_manager.has_modified_windows then
156 ask_confirmation
157 else
158 create wd.make_with_text (Warning_messages.W_could_not_save_all)
159 wd.show_modal_to_window (Window_manager.last_focused_window.window)
160 end
161 end
162
163 stop_compilation_and_exit is
164 -- Interrupt the current compilation.
165 require
166 Workbench.is_compiling
167 do
168 Workbench.Eiffel_project.stop_and_exit (agent ask_confirmation)
169 end
170
171 feature {NONE} -- Attributes
172
173 menu_name: STRING is
174 -- Name used in menu entry
175 do
176 Result := Interface_names.m_Exit_project
177 end
178
179 pixmap: EV_PIXMAP
180 -- Pixmap
181
182 already_confirmed: BOOLEAN;
183 -- Has the user already said he DID want to exit?
184 --| We shouldn't ask again then.
185
186 indexing
187 copyright: "Copyright (c) 1984-2006, Eiffel Software"
188 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
189 licensing_options: "http://www.eiffel.com/licensing"
190 copying: "[
191 This file is part of Eiffel Software's Eiffel Development Environment.
192
193 Eiffel Software's Eiffel Development Environment is free
194 software; you can redistribute it and/or modify it under
195 the terms of the GNU General Public License as published
196 by the Free Software Foundation, version 2 of the License
197 (available at the URL listed under "license" above).
198
199 Eiffel Software's Eiffel Development Environment is
200 distributed in the hope that it will be useful, but
201 WITHOUT ANY WARRANTY; without even the implied warranty
202 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
203 See the GNU General Public License for more details.
204
205 You should have received a copy of the GNU General Public
206 License along with Eiffel Software's Eiffel Development
207 Environment; if not, write to the Free Software Foundation,
208 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
209 ]"
210 source: "[
211 Eiffel Software
212 356 Storke Road, Goleta, CA 93117 USA
213 Telephone 805-685-1006, Fax 805-685-6869
214 Website http://www.eiffel.com
215 Customer support http://support.eiffel.com
216 ]"
217
218 end -- class EB_EXIT_APPLICATION_CMD

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23