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

Contents of /branches/Eiffel_57_docking/Src/Eiffel/interface/new_graphical/commands/eb_save_all_file_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: 5271 byte(s)
First commit docking tabbed Eiffel Studio.
1 indexing
2 description : "Command to save all files."
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_SAVE_ALL_FILE_COMMAND
10
11 inherit
12 EB_FILEABLE_COMMAND
13 redefine
14 make
15 end
16
17 TEXT_OBSERVER
18 redefine
19 on_text_reset, on_text_edited,
20 on_text_back_to_its_last_saved_state
21 end
22
23 EB_TOOLBARABLE_AND_MENUABLE_COMMAND
24 redefine
25 tooltext
26 end
27
28 EB_SHARED_WINDOW_MANAGER
29 export
30 {NONE} all
31 end
32
33 SHARED_WORKBENCH
34
35
36 EB_SHARED_PREFERENCES
37 export
38 {NONE} all
39 end
40
41 create
42 make
43
44 feature -- Initialization
45
46 make (a_manager: like target) is
47 -- Create a formatter associated with `a_manager'.
48 do
49 Precursor (a_manager)
50 create accelerator.make_with_key_combination (
51 create {EV_KEY}.make_with_code ({EV_KEY_CONSTANTS}.Key_s),
52 True, False, True)
53 accelerator.actions.extend (agent execute)
54 disable_sensitive
55 end
56
57 feature -- Execution
58
59 execute is
60 -- Save a file with the chosen name.
61 local
62 l_dev_win: EB_DEVELOPMENT_WINDOW
63 l_editors: ARRAYED_LIST [EB_SMART_EDITOR]
64 l_editor: EB_SMART_EDITOR
65 l_editors_manager: EB_EDITORS_MANAGER
66 cst: CLASSC_STONE
67 do
68 l_dev_win ?= target
69 l_dev_win.lock_update
70 if l_dev_win /= Void then
71 l_editors_manager := l_dev_win.editors_manager
72 l_editor := l_editors_manager.current_editor
73 l_editors := l_editors_manager.unsaved_editors
74 from
75 l_editors.start
76 until
77 l_editors.after
78 loop
79 l_editors_manager.select_editor (l_editors.item)
80 -- Save file
81 l_dev_win.save_cmd.execute
82
83 -- Set changed in project
84 cst ?= l_editors.item.stone
85 if cst /= Void then
86 l_dev_win.set_classi_changed (cst.class_i)
87 end
88 l_editors.forth
89 end
90 if l_editor /= Void then
91 l_editors_manager.select_editor (l_editor)
92 end
93 end
94 l_dev_win.unlock_update
95 end
96
97 feature {NONE} -- Status
98
99 has_unsaved_file: BOOLEAN is
100 -- Has unsaved file?
101 local
102 l_dev: EB_DEVELOPMENT_WINDOW
103 do
104 l_dev ?= target
105 Result := l_dev.any_editor_changed
106 end
107
108 feature {NONE} -- Implementation
109
110 menu_name: STRING is
111 -- Name as it appears in the menu (with & symbol).
112 do
113 Result := Interface_names.m_save_all
114 end
115
116 pixmap: EV_PIXMAP is
117 -- Pixmaps representing the command.
118 do
119 Result := pixmaps.icon_pixmaps.general_save_all_icon
120 end
121
122 pixel_buffer: EV_PIXEL_BUFFER is
123 -- Pixel buffer representing the command.
124 do
125 Result := pixmaps.icon_pixmaps.general_save_all_icon_buffer
126 end
127
128 tooltip: STRING is
129 -- Tooltip for the toolbar button.
130 do
131 Result := Interface_names.f_save_all
132 end
133
134 tooltext: STRING is
135 -- Text for the toolbar button.
136 do
137 Result := Interface_names.b_save_all
138 end
139
140 description: STRING is
141 -- Tooltip for the toolbar button.
142 do
143 Result := Interface_names.f_save_all
144 end
145
146 name: STRING is "Save_all_file"
147 -- Name of the command. Used to store the command in the
148 -- preferences.
149
150 on_text_edited (directly_edited: BOOLEAN) is
151 -- make the command sensitive
152 do
153 enable_sensitive
154 end
155
156 on_text_reset is
157 -- make the command insensitive
158 do
159 if not has_unsaved_file then
160 disable_sensitive
161 end
162 end
163
164 on_text_back_to_its_last_saved_state is
165 -- make the command insensitive
166 do
167 if not has_unsaved_file then
168 disable_sensitive
169 end
170 end
171
172 feature {NONE} -- Implementation
173
174 enable_toolbar_items is
175 -- make toolbar items sensitive
176 do
177 from
178 managed_toolbar_items.start
179 until
180 managed_toolbar_items.exhausted
181 loop
182 managed_toolbar_items.item.enable_sensitive
183 managed_toolbar_items.forth
184 end
185 end
186
187 disable_toolbar_items is
188 -- make toolbar items insensitive
189 do
190 from
191 managed_toolbar_items.start
192 until
193 managed_toolbar_items.exhausted
194 loop
195 managed_toolbar_items.item.disable_sensitive
196 managed_toolbar_items.forth
197 end
198 end
199
200 indexing
201 copyright: "Copyright (c) 1984-2006, Eiffel Software"
202 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
203 licensing_options: "http://www.eiffel.com/licensing"
204 copying: "[
205 This file is part of Eiffel Software's Eiffel Development Environment.
206
207 Eiffel Software's Eiffel Development Environment is free
208 software; you can redistribute it and/or modify it under
209 the terms of the GNU General Public License as published
210 by the Free Software Foundation, version 2 of the License
211 (available at the URL listed under "license" above).
212
213 Eiffel Software's Eiffel Development Environment is
214 distributed in the hope that it will be useful, but
215 WITHOUT ANY WARRANTY; without even the implied warranty
216 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
217 See the GNU General Public License for more details.
218
219 You should have received a copy of the GNU General Public
220 License along with Eiffel Software's Eiffel Development
221 Environment; if not, write to the Free Software Foundation,
222 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
223 ]"
224 source: "[
225 Eiffel Software
226 356 Storke Road, Goleta, CA 93117 USA
227 Telephone 805-685-1006, Fax 805-685-6869
228 Website http://www.eiffel.com
229 Customer support http://support.eiffel.com
230 ]"
231
232 end -- class EB_SAVE_FILE_COMMAND

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23