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

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