author | Claus Gittinger <cg@exept.de> |
Tue, 26 Nov 2002 10:13:10 +0100 | |
changeset 4313 | a8553b7a090e |
parent 4284 | 1fd90359b703 |
child 4358 | b0023a5ca3b8 |
permissions | -rw-r--r-- |
3154 | 1 |
"{ Package: 'stx:libtool' }" |
2 |
||
3 |
ToolApplicationModel subclass:#WorkspaceApplication |
|
3667 | 4 |
instanceVariableNames:'workspaces tabList selectedWorkspaceIndexHolder workspaceHolder |
5 |
autoDefineWorkspaceVariables' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
6 |
classVariableNames:'LastFilterBlockString LastProcessingBlockString' |
3222 | 7 |
poolDictionaries:'' |
8 |
category:'Interface-Smalltalk' |
|
3154 | 9 |
! |
10 |
||
3191 | 11 |
!WorkspaceApplication class methodsFor:'documentation'! |
12 |
||
13 |
documentation |
|
14 |
" |
|
15 |
A simple wrapper around a WorkSpace-View, adding a pullDown menu. |
|
16 |
||
17 |
[author:] |
|
18 |
Claus Gittinger |
|
19 |
" |
|
20 |
! ! |
|
3154 | 21 |
|
22 |
!WorkspaceApplication class methodsFor:'interface specs'! |
|
23 |
||
24 |
windowSpec |
|
25 |
"This resource specification was automatically generated |
|
26 |
by the UIPainter of ST/X." |
|
27 |
||
28 |
"Do not manually edit this!! If it is corrupted, |
|
29 |
the UIPainter may not be able to read the specification." |
|
30 |
||
31 |
" |
|
32 |
UIPainter new openOnClass:WorkspaceApplication andSelector:#windowSpec |
|
33 |
WorkspaceApplication new openInterface:#windowSpec |
|
34 |
WorkspaceApplication open |
|
35 |
" |
|
36 |
||
37 |
<resource: #canvas> |
|
38 |
||
39 |
^ |
|
40 |
#(#FullSpec |
|
41 |
#name: #windowSpec |
|
42 |
#window: |
|
43 |
#(#WindowSpec |
|
44 |
#label: 'Workspace' |
|
45 |
#name: 'Workspace' |
|
46 |
#min: #(#Point 10 10) |
|
3845 | 47 |
#bounds: #(#Rectangle 13 23 445 264) |
3154 | 48 |
#menu: #mainMenu |
49 |
) |
|
50 |
#component: |
|
51 |
#(#SpecCollection |
|
52 |
#collection: #( |
|
3193 | 53 |
#(#NoteBookViewSpec |
54 |
#name: 'NoteBook1' |
|
55 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
56 |
#model: #selectedWorkspaceIndexHolder |
|
57 |
#menu: #tabList |
|
58 |
#useIndex: true |
|
59 |
#accessTabMenuAction: #tabMenuAt: |
|
60 |
#canvas: #workspaceHolder |
|
61 |
#canvasInset: 0 |
|
62 |
#canvasFrameLevel: 0 |
|
63 |
#keepCanvasAlive: true |
|
64 |
#tabLevel: 2 |
|
65 |
) |
|
3154 | 66 |
) |
67 |
||
68 |
) |
|
69 |
) |
|
70 |
! ! |
|
71 |
||
72 |
!WorkspaceApplication class methodsFor:'menu specs'! |
|
73 |
||
74 |
mainMenu |
|
75 |
"This resource specification was automatically generated |
|
76 |
by the MenuEditor of ST/X." |
|
77 |
||
78 |
"Do not manually edit this!! If it is corrupted, |
|
79 |
the MenuEditor may not be able to read the specification." |
|
80 |
||
81 |
" |
|
82 |
MenuEditor new openOnClass:WorkspaceApplication andSelector:#mainMenu |
|
83 |
(Menu new fromLiteralArrayEncoding:(WorkspaceApplication mainMenu)) startUp |
|
84 |
" |
|
85 |
||
86 |
<resource: #menu> |
|
87 |
||
88 |
^ |
|
89 |
#(#Menu |
|
90 |
#( |
|
91 |
#(#MenuItem |
|
92 |
#label: 'File' |
|
93 |
#translateLabel: true |
|
94 |
#submenu: |
|
95 |
#(#Menu |
|
96 |
#( |
|
97 |
#(#MenuItem |
|
3651 | 98 |
#label: 'New Workspace' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
99 |
#itemValue: #newWorkspace |
3154 | 100 |
#translateLabel: true |
3651 | 101 |
) |
102 |
#(#MenuItem |
|
103 |
#label: 'New SystemWorkspace' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
104 |
#itemValue: #newSystemWorkspace |
3651 | 105 |
#translateLabel: true |
3154 | 106 |
) |
107 |
#(#MenuItem |
|
108 |
#label: '-' |
|
109 |
) |
|
110 |
#(#MenuItem |
|
111 |
#label: 'Load File...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
112 |
#itemValue: #menuLoad |
3154 | 113 |
#translateLabel: true |
114 |
) |
|
115 |
#(#MenuItem |
|
116 |
#label: '-' |
|
117 |
) |
|
118 |
#(#MenuItem |
|
119 |
#label: 'Save As...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
120 |
#itemValue: #menuSaveAs |
3154 | 121 |
#translateLabel: true |
122 |
) |
|
123 |
#(#MenuItem |
|
4267 | 124 |
#label: 'Save all As...' |
125 |
#itemValue: #menuSaveAllAs |
|
126 |
#enabled: #hasMultipleBuffersHolder |
|
127 |
#translateLabel: true |
|
128 |
) |
|
129 |
#(#MenuItem |
|
3154 | 130 |
#label: '-' |
131 |
) |
|
132 |
#(#MenuItem |
|
133 |
#label: 'Exit' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
134 |
#itemValue: #closeRequest |
3154 | 135 |
#translateLabel: true |
136 |
) |
|
137 |
) |
|
138 |
nil |
|
139 |
nil |
|
140 |
) |
|
141 |
) |
|
142 |
#(#MenuItem |
|
3736 | 143 |
#label: 'Buffers' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
144 |
#nameKey: #Buffer |
3193 | 145 |
#translateLabel: true |
146 |
#submenu: |
|
147 |
#(#Menu |
|
148 |
#( |
|
149 |
#(#MenuItem |
|
3222 | 150 |
#label: 'Add Buffer' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
151 |
#itemValue: #addWorkspace |
3193 | 152 |
#translateLabel: true |
153 |
) |
|
154 |
#(#MenuItem |
|
4098 | 155 |
#enabled: #anyWorkspaceVariableIsDefined |
156 |
#label: 'Add Buffer on Workspace Variables' |
|
157 |
#itemValue: #addWorkspaceVariableInspector |
|
158 |
#translateLabel: true |
|
159 |
) |
|
160 |
#(#MenuItem |
|
4099 | 161 |
#label: 'Add Buffer on Global Variables' |
162 |
#itemValue: #addGlobalVariableInspector |
|
163 |
#translateLabel: true |
|
164 |
) |
|
165 |
#(#MenuItem |
|
3193 | 166 |
#label: 'Rename...' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
167 |
#itemValue: #renameWorkspace |
3193 | 168 |
#translateLabel: true |
169 |
) |
|
170 |
#(#MenuItem |
|
171 |
#label: '-' |
|
172 |
) |
|
173 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
174 |
#enabled: #canRemoveWorkspace |
3222 | 175 |
#label: 'Remove Buffer' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
176 |
#itemValue: #removeWorkspace |
3193 | 177 |
#translateLabel: true |
178 |
) |
|
179 |
) |
|
180 |
nil |
|
181 |
nil |
|
182 |
) |
|
183 |
) |
|
184 |
#(#MenuItem |
|
3154 | 185 |
#label: 'Edit' |
186 |
#translateLabel: true |
|
187 |
#submenu: |
|
188 |
#(#Menu |
|
189 |
#( |
|
190 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
191 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 192 |
#label: 'Copy' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
193 |
#itemValue: #copySelection |
3154 | 194 |
#translateLabel: true |
195 |
) |
|
196 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
197 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 198 |
#label: 'Cut' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
199 |
#itemValue: #cutSelection |
3154 | 200 |
#translateLabel: true |
201 |
) |
|
202 |
#(#MenuItem |
|
203 |
#label: 'Paste' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
204 |
#itemValue: #paste |
3154 | 205 |
#translateLabel: true |
206 |
) |
|
3752 | 207 |
#(#MenuItem |
208 |
#label: '-' |
|
209 |
) |
|
210 |
#(#MenuItem |
|
211 |
#label: 'Filter Text...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
212 |
#itemValue: #filterText |
3752 | 213 |
#translateLabel: true |
214 |
) |
|
215 |
#(#MenuItem |
|
216 |
#label: 'Process Text...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
217 |
#itemValue: #processText |
3752 | 218 |
#translateLabel: true |
219 |
) |
|
4136 | 220 |
#(#MenuItem |
221 |
#label: '-' |
|
222 |
) |
|
223 |
#(#MenuItem |
|
224 |
#enabled: #hasHistory |
|
225 |
#label: 'Redo Last' |
|
226 |
#itemValue: #redoLastDoIt |
|
227 |
#translateLabel: true |
|
4267 | 228 |
#submenuChannel: #redoRecentDoItMenu |
229 |
) |
|
230 |
#(#MenuItem |
|
231 |
#enabled: #hasHistory |
|
232 |
#label: 'Paste Last' |
|
233 |
#itemValue: #pasteLastDoIt |
|
234 |
#translateLabel: true |
|
235 |
#submenuChannel: #pasteRecentDoItMenu |
|
4136 | 236 |
) |
3154 | 237 |
) |
238 |
nil |
|
239 |
nil |
|
240 |
) |
|
241 |
) |
|
242 |
#(#MenuItem |
|
3722 | 243 |
#label: 'Workspace' |
244 |
#translateLabel: true |
|
245 |
#submenu: |
|
246 |
#(#Menu |
|
247 |
#( |
|
248 |
#(#MenuItem |
|
249 |
#label: 'Add Workspace Variable...' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
250 |
#itemValue: #addWorkspaceVariable |
3722 | 251 |
#translateLabel: true |
252 |
) |
|
253 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
254 |
#enabled: #anyWorkspaceVariableIsDefined |
3722 | 255 |
#label: 'Remove Workspace Variable...' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
256 |
#itemValue: #removeWorkspaceVariable |
3722 | 257 |
#translateLabel: true |
258 |
) |
|
259 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
260 |
#enabled: #anyWorkspaceVariableIsDefined |
4267 | 261 |
#label: 'Remove all Workspace Variables...' |
262 |
#itemValue: #removeAllWorkspaceVariables |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
263 |
#translateLabel: true |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
264 |
) |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
265 |
#(#MenuItem |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
266 |
#label: '-' |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
267 |
) |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
268 |
#(#MenuItem |
3812 | 269 |
#enabled: #anyWorkspaceVariableIsDefined |
4267 | 270 |
#label: 'Inspect Workspace Variables' |
271 |
#itemValue: #inspectWorkspaceVariables |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
272 |
#translateLabel: true |
3722 | 273 |
) |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
274 |
#(#MenuItem |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
275 |
#label: '-' |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
276 |
) |
3722 | 277 |
#(#MenuItem |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
278 |
#label: 'Settings' |
3722 | 279 |
#translateLabel: true |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
280 |
#submenu: |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
281 |
#(#Menu |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
282 |
#( |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
283 |
#(#MenuItem |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
284 |
#label: 'Autodefine Workspace Variables' |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
285 |
#translateLabel: true |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
286 |
#hideMenuOnActivated: false |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
287 |
#indication: #autoDefineWorkspaceVariables |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
288 |
) |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
289 |
) |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
290 |
nil |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
291 |
nil |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
292 |
) |
3722 | 293 |
) |
294 |
) |
|
295 |
nil |
|
296 |
nil |
|
297 |
) |
|
298 |
) |
|
299 |
#(#MenuItem |
|
3154 | 300 |
#label: 'Smalltalk' |
301 |
#translateLabel: true |
|
302 |
#submenu: |
|
303 |
#(#Menu |
|
304 |
#( |
|
305 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
306 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 307 |
#label: 'DoIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
308 |
#itemValue: #doIt |
3154 | 309 |
#translateLabel: true |
310 |
) |
|
311 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
312 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 313 |
#label: 'PrintIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
314 |
#itemValue: #printIt |
3154 | 315 |
#translateLabel: true |
316 |
) |
|
317 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
318 |
#enabled: #hasSelectionInActiveWorkspace |
3154 | 319 |
#label: 'InspectIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
320 |
#itemValue: #inspectIt |
3154 | 321 |
#translateLabel: true |
322 |
) |
|
323 |
#(#MenuItem |
|
324 |
#label: '-' |
|
325 |
) |
|
326 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
327 |
#enabled: #hasSelectionInActiveWorkspace |
3384 | 328 |
#label: 'TimeIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
329 |
#itemValue: #timeIt |
3384 | 330 |
#translateLabel: true |
331 |
) |
|
332 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
333 |
#enabled: #hasSelectionInActiveWorkspace |
3384 | 334 |
#label: 'SpyOnIt' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
335 |
#itemValue: #spyOnIt |
3384 | 336 |
#translateLabel: true |
337 |
) |
|
338 |
#(#MenuItem |
|
339 |
#label: '-' |
|
340 |
) |
|
341 |
#(#MenuItem |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
342 |
#enabled: #hasSelectionInActiveWorkspace |
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
343 |
#label: 'Browse Class' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
344 |
#itemValue: #browseIt |
3154 | 345 |
#translateLabel: true |
346 |
) |
|
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
347 |
#(#MenuItem |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
348 |
#enabled: #hasSelectionInActiveWorkspace |
3710 | 349 |
#label: 'Browse Implementors of It' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
350 |
#itemValue: #browseImplementorsOfIt |
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
351 |
#translateLabel: true |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
352 |
) |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
353 |
#(#MenuItem |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
354 |
#enabled: #hasSelectionInActiveWorkspace |
3710 | 355 |
#label: 'Browse References to It' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
356 |
#itemValue: #browseReferencesToIt |
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
357 |
#translateLabel: true |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
358 |
) |
4154 | 359 |
#(#MenuItem |
360 |
#label: '-' |
|
361 |
) |
|
362 |
#(#MenuItem |
|
363 |
#label: 'Add Global Variable...' |
|
4284 | 364 |
#itemValue: #addGlobalVariable |
365 |
#translateLabel: true |
|
366 |
) |
|
367 |
#(#MenuItem |
|
368 |
#label: 'Remove Global Variable...' |
|
369 |
#itemValue: #removeGlobalVariable |
|
4154 | 370 |
#translateLabel: true |
371 |
) |
|
3154 | 372 |
) |
373 |
nil |
|
374 |
nil |
|
375 |
) |
|
376 |
) |
|
377 |
#(#MenuItem |
|
378 |
#label: 'Help' |
|
379 |
#translateLabel: true |
|
380 |
#startGroup: #right |
|
381 |
#submenu: |
|
382 |
#(#Menu |
|
383 |
#( |
|
384 |
#(#MenuItem |
|
385 |
#label: 'Documentation' |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
386 |
#itemValue: #openDocumentation |
3154 | 387 |
#translateLabel: true |
388 |
) |
|
389 |
#(#MenuItem |
|
390 |
#label: '-' |
|
391 |
) |
|
392 |
#(#MenuItem |
|
3282 | 393 |
#label: 'About this Application...' |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
394 |
#itemValue: #openAboutThisApplication |
3154 | 395 |
#translateLabel: true |
396 |
) |
|
397 |
) |
|
398 |
nil |
|
399 |
nil |
|
400 |
) |
|
401 |
) |
|
402 |
) |
|
403 |
nil |
|
404 |
nil |
|
405 |
) |
|
3193 | 406 |
! |
407 |
||
408 |
tabMenu |
|
409 |
"This resource specification was automatically generated |
|
410 |
by the MenuEditor of ST/X." |
|
411 |
||
412 |
"Do not manually edit this!! If it is corrupted, |
|
413 |
the MenuEditor may not be able to read the specification." |
|
414 |
||
415 |
" |
|
416 |
MenuEditor new openOnClass:WorkspaceApplication andSelector:#tabMenu |
|
417 |
(Menu new fromLiteralArrayEncoding:(WorkspaceApplication tabMenu)) startUp |
|
418 |
" |
|
419 |
||
420 |
<resource: #menu> |
|
421 |
||
422 |
^ |
|
423 |
#(#Menu |
|
424 |
#( |
|
425 |
#(#MenuItem |
|
3222 | 426 |
#label: 'Add Buffer' |
3193 | 427 |
#translateLabel: true |
3651 | 428 |
"/ #triggerOnDown: true |
3193 | 429 |
#value: #addWorkspace |
430 |
) |
|
431 |
#(#MenuItem |
|
432 |
#label: 'Rename...' |
|
433 |
#translateLabel: true |
|
3651 | 434 |
"/ #triggerOnDown: true |
3193 | 435 |
#value: #renameWorkspace: |
436 |
) |
|
437 |
#(#MenuItem |
|
438 |
#label: '-' |
|
439 |
) |
|
440 |
#(#MenuItem |
|
3222 | 441 |
#label: 'Remove Buffer' |
3193 | 442 |
#translateLabel: true |
3651 | 443 |
"/ #triggerOnDown: true |
3193 | 444 |
#value: #removeWorkspace: |
445 |
#enabled: #canRemoveWorkspace: |
|
446 |
) |
|
447 |
) |
|
448 |
nil |
|
449 |
nil |
|
450 |
) |
|
3154 | 451 |
! ! |
452 |
||
3332 | 453 |
!WorkspaceApplication class methodsFor:'special startup'! |
454 |
||
455 |
openSystemWorkspace |
|
3345 | 456 |
|wsApp licenceView path needRemove| |
457 |
||
458 |
needRemove := true. |
|
3332 | 459 |
|
460 |
wsApp := self new. |
|
461 |
wsApp allButOpen. |
|
3337 | 462 |
wsApp window extent:640@400. |
3332 | 463 |
|
3345 | 464 |
path := (Smalltalk getSystemFileName:'README') ? '../../README'. |
3532
e38c9dd404a2
care for missing workspace files
Claus Gittinger <cg@exept.de>
parents:
3507
diff
changeset
|
465 |
(path notNil and:[path asFilename exists]) ifTrue:[ |
3345 | 466 |
wsApp addWindow:(HVScrollableView for:Workspace) named:'README' asFirst:false. |
467 |
wsApp loadFile:path. |
|
468 |
wsApp removeWorkspace:1. "/ the original Workspace |
|
4183 | 469 |
wsApp renameWorkspace:1 to:'LICENCE README'. |
3345 | 470 |
needRemove := false. |
471 |
]. |
|
3334 | 472 |
|
3346 | 473 |
"/ path := (Smalltalk getSystemFileName:'doc/online/english/LICENCE_STX.html') ? '../../doc/online/english/LICENCE_STX.html'. |
474 |
"/ path asFilename exists ifTrue:[ |
|
475 |
"/ wsApp addWindow:(licenceView := HVScrollableView for:HTMLDocumentView) named:'License' asFirst:false. |
|
476 |
"/ licenceView homeDocument:'../../doc/online/english/LICENCE_STX.html'. |
|
477 |
"/ licenceView updateLabelFlag:false. |
|
478 |
"/ needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
479 |
"/ needRemove := false. |
|
480 |
"/ ]. |
|
3332 | 481 |
|
3347 | 482 |
path := (Smalltalk getSystemFileName:'Keyboard.wsp'). |
3532
e38c9dd404a2
care for missing workspace files
Claus Gittinger <cg@exept.de>
parents:
3507
diff
changeset
|
483 |
(path notNil and:[path asFilename exists]) ifTrue:[ |
3345 | 484 |
wsApp addWindow:(HVScrollableView for:Workspace) named:'Keyboard' asFirst:false. |
485 |
wsApp loadFile:path. |
|
486 |
needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
487 |
needRemove := false. |
|
488 |
]. |
|
3332 | 489 |
|
4183 | 490 |
path := (Smalltalk getSystemFileName:'Setup.wsp'). |
491 |
(path notNil and:[path asFilename exists]) ifTrue:[ |
|
492 |
wsApp addWindow:(HVScrollableView for:Workspace) named:'Setup' asFirst:false. |
|
493 |
wsApp loadFile:path. |
|
494 |
needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
495 |
needRemove := false. |
|
496 |
]. |
|
497 |
||
3347 | 498 |
path := (Smalltalk getSystemFileName:'Hello.wsp'). |
3532
e38c9dd404a2
care for missing workspace files
Claus Gittinger <cg@exept.de>
parents:
3507
diff
changeset
|
499 |
(path notNil and:[path asFilename exists]) ifTrue:[ |
3345 | 500 |
wsApp addWindow:(HVScrollableView for:Workspace) named:'Welcome' asFirst:false. |
501 |
wsApp loadFile:path. |
|
502 |
needRemove ifTrue:[wsApp removeWorkspace:1]. "/ the original Workspace |
|
503 |
needRemove := false. |
|
504 |
]. |
|
3332 | 505 |
|
506 |
wsApp openWindow |
|
507 |
||
508 |
" |
|
509 |
self openSystemWorkspace |
|
510 |
" |
|
511 |
! ! |
|
512 |
||
3154 | 513 |
!WorkspaceApplication methodsFor:'accessing'! |
514 |
||
3193 | 515 |
selectedWorkspace |
516 |
|wsIndex| |
|
517 |
||
518 |
workspaces isNil ifTrue:[ |
|
519 |
workspaces := OrderedCollection new. |
|
520 |
]. |
|
521 |
wsIndex := self selectedWorkspaceIndexHolder value. |
|
522 |
wsIndex == 0 ifTrue:[ |
|
523 |
^ nil |
|
524 |
]. |
|
525 |
||
526 |
workspaces size < wsIndex ifTrue:[ |
|
527 |
workspaces grow:wsIndex. |
|
528 |
workspaces at:wsIndex put:(HVScrollableView for:Workspace). |
|
529 |
]. |
|
530 |
^ workspaces at:wsIndex |
|
531 |
! |
|
532 |
||
533 |
tabMenuAt:index |
|
3196 | 534 |
|m i ws| |
3193 | 535 |
|
536 |
m := self class tabMenu. |
|
537 |
m := m decodeAsLiteralArray. |
|
538 |
i := m detectItem:[:item | item value == #removeWorkspace:] ifNone:nil. |
|
539 |
i notNil ifTrue:[ |
|
540 |
i argument:index. |
|
541 |
index ~~ self selectedWorkspaceIndexHolder value ifTrue:[ |
|
542 |
"/ for now: if that buffer is modified, |
|
543 |
"/ do not allow removing. |
|
544 |
"/ (must be brought to front, in order for check-for-modification to work) |
|
3196 | 545 |
ws := workspaces at:index. |
546 |
(ws isKindOf:ScrollableView) ifTrue:[ |
|
547 |
ws := ws scrolledView |
|
548 |
]. |
|
549 |
((ws isKindOf:TextView) not |
|
550 |
or:[ ws modified ]) |
|
551 |
ifTrue:[ |
|
3193 | 552 |
i disable |
553 |
]. |
|
554 |
]. |
|
555 |
]. |
|
556 |
i := m detectItem:[:item | item value == #renameWorkspace:] ifNone:nil. |
|
557 |
i notNil ifTrue:[ |
|
558 |
i argument:index. |
|
559 |
]. |
|
560 |
||
561 |
m findGuiResourcesIn:self. |
|
562 |
^ m |
|
563 |
! |
|
564 |
||
565 |
workspaceHolder |
|
566 |
workspaceHolder isNil ifTrue:[ |
|
3207 | 567 |
workspaceHolder := ValueHolder with:(self selectedWorkspace). |
3193 | 568 |
]. |
569 |
^ workspaceHolder |
|
570 |
! ! |
|
571 |
||
572 |
!WorkspaceApplication methodsFor:'aspects'! |
|
573 |
||
3667 | 574 |
autoDefineWorkspaceVariables |
575 |
"does not work yet - needs more interaction with parser" |
|
576 |
||
577 |
autoDefineWorkspaceVariables isNil ifTrue:[ |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
578 |
autoDefineWorkspaceVariables := UserPreferences current autoDefineWorkspaceVariables asValue. |
3667 | 579 |
autoDefineWorkspaceVariables onChangeSend:#autoDefineWorkspaceVariablesChanged to:self. |
580 |
]. |
|
581 |
^ autoDefineWorkspaceVariables. |
|
582 |
! |
|
583 |
||
4136 | 584 |
hasHistory |
585 |
^ Workspace doItHistory size > 0. |
|
586 |
! |
|
587 |
||
3193 | 588 |
selectedWorkspaceIndexHolder |
589 |
selectedWorkspaceIndexHolder isNil ifTrue:[ |
|
590 |
selectedWorkspaceIndexHolder := 1 asValue. |
|
591 |
selectedWorkspaceIndexHolder onChangeSend:#workspaceSelectionChanged to:self. |
|
592 |
]. |
|
593 |
^ selectedWorkspaceIndexHolder. |
|
594 |
! |
|
595 |
||
596 |
tabList |
|
597 |
tabList isNil ifTrue:[ |
|
598 |
tabList := List new. |
|
599 |
]. |
|
600 |
^ tabList. |
|
601 |
! ! |
|
602 |
||
603 |
!WorkspaceApplication methodsFor:'aspects - queries'! |
|
604 |
||
3812 | 605 |
anyWorkspaceVariableIsDefined |
606 |
^ Workspace workspaceVariables size > 0 |
|
607 |
! |
|
608 |
||
3193 | 609 |
canRemoveWorkspace |
3214 | 610 |
^ self canRemoveWorkspace:(self selectedWorkspaceIndexHolder value) |
611 |
! |
|
612 |
||
613 |
canRemoveWorkspace:idx |
|
3193 | 614 |
^ self tabList size > 1 |
3214 | 615 |
"/ and:[ (self workspacesTextViewAt:(self selectedWorkspaceIndexHolder value)) |
3391
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
616 |
! |
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
617 |
|
4267 | 618 |
hasMultipleBuffersHolder |
619 |
^ [ workspaces size > 1 ] |
|
620 |
! |
|
621 |
||
3391
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
622 |
hasSelectionInActiveWorkspace |
09fd110d1ea4
disable menu items; check for nothing selected
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
623 |
^ self selectedWorkspacesTextView selectionAsString size > 0 |
3154 | 624 |
! ! |
625 |
||
626 |
!WorkspaceApplication methodsFor:'initialization & release'! |
|
627 |
||
628 |
closeRequest |
|
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
629 |
(self askIfAnyModified:'Text was not saved. Close anyway ?' yesButton:'Close') ifFalse:[ |
3154 | 630 |
^ self |
631 |
]. |
|
632 |
||
633 |
^ super closeRequest |
|
634 |
! ! |
|
635 |
||
636 |
!WorkspaceApplication methodsFor:'menu actions'! |
|
637 |
||
4154 | 638 |
addGlobalVariable |
639 |
|name nameKey selection| |
|
640 |
||
641 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
642 |
||
643 |
name := Dialog |
|
644 |
request:'Name of new Global Variable:' |
|
645 |
initialAnswer:(selection asString string) |
|
646 |
okLabel:'Add' |
|
647 |
title:'Enter Variable Name'. |
|
648 |
name size == 0 ifTrue:[ |
|
649 |
^ self |
|
650 |
]. |
|
651 |
nameKey := name asSymbol. |
|
652 |
||
4284 | 653 |
(Smalltalk includesKey:nameKey) ifTrue:[ |
4154 | 654 |
self warn:'Global named ''' , name , ''' already exists.'. |
655 |
^ self. |
|
656 |
]. |
|
657 |
Smalltalk at:nameKey put:nil. |
|
658 |
! |
|
659 |
||
4099 | 660 |
addGlobalVariableInspector |
661 |
|v| |
|
662 |
||
663 |
v := self addInspectorOn:(Smalltalk) basic:false suppressPseudoSlots:true. |
|
664 |
v fieldListLabel:'Name'. |
|
4208 | 665 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) to:'Globals (Smalltalk)'. |
4099 | 666 |
! |
667 |
||
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
668 |
addInspectorOn:aValue basic:isBasicInspector suppressPseudoSlots:suppressPseudoSlots |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
669 |
|view cls resultString| |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
670 |
|
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
671 |
isBasicInspector ifFalse:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
672 |
cls := aValue inspectorClass. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
673 |
]. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
674 |
cls isNil ifTrue:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
675 |
cls := InspectorView |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
676 |
]. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
677 |
view := cls new. |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
678 |
view suppressPseudoSlots:suppressPseudoSlots. |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
679 |
view inspect:aValue. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
680 |
"/ v allowFollow:true. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
681 |
aValue isBehavior ifTrue:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
682 |
resultString := aValue name |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
683 |
] ifFalse:[ |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
684 |
resultString := aValue classNameWithArticle |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
685 |
]. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
686 |
self addWindow:view named:('Inspecting: ' , resultString). |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
687 |
^ view |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
688 |
! |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
689 |
|
3196 | 690 |
addWindow:aWindow named:name |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
691 |
^ self addWindow:aWindow named:name asFirst:false |
3334 | 692 |
! |
693 |
||
694 |
addWindow:aWindow named:name asFirst:asFirst |
|
695 |
|tabList wsIndex newSelectedIndex| |
|
3193 | 696 |
|
697 |
tabList := self tabList. |
|
698 |
wsIndex := tabList size + 1. |
|
699 |
wsIndex == 1 ifTrue:[ |
|
700 |
"/ first - add a name for the first tab |
|
701 |
tabList add:(self window label). "/ 'Workspace'. |
|
702 |
wsIndex := wsIndex + 1. |
|
703 |
]. |
|
704 |
||
705 |
workspaces grow:wsIndex. |
|
3334 | 706 |
asFirst ifTrue:[ |
707 |
tabList addFirst:(name bindWith:wsIndex). |
|
708 |
workspaces replaceFrom:2 to:wsIndex with:workspaces startingAt:1. |
|
709 |
newSelectedIndex := 1. |
|
710 |
] ifFalse:[ |
|
711 |
tabList addLast:(name bindWith:wsIndex). |
|
712 |
newSelectedIndex := wsIndex. |
|
713 |
]. |
|
714 |
workspaces at:newSelectedIndex put:aWindow. |
|
715 |
self selectedWorkspaceIndexHolder value:newSelectedIndex. |
|
716 |
"/ workspaceHolder value:aWindow. |
|
3193 | 717 |
! |
718 |
||
3196 | 719 |
addWorkspace |
720 |
self addWindow:(HVScrollableView for:Workspace) named:'Workspace%1' |
|
721 |
! |
|
722 |
||
3722 | 723 |
addWorkspaceVariable |
724 |
|name selection| |
|
725 |
||
726 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
727 |
||
728 |
name := Dialog |
|
729 |
request:'Name of new Workspace Variable:' |
|
730 |
initialAnswer:(selection asString string) |
|
731 |
okLabel:'Add' |
|
732 |
title:'Enter Variable Name'. |
|
733 |
name size == 0 ifTrue:[ |
|
734 |
^ self |
|
735 |
]. |
|
736 |
Workspace addWorkspaceVariable:name. |
|
737 |
! |
|
738 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
739 |
addWorkspaceVariableInspector |
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
740 |
|v| |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
741 |
|
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
742 |
v := self addInspectorOn:(Workspace workspaceVariables) basic:false suppressPseudoSlots:true. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
743 |
v dereferenceValueHolders:true. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
744 |
v fieldListLabel:'Name'. |
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
745 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) to:'Variables'. |
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
746 |
! |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
747 |
|
3752 | 748 |
askForFilterBlock:message template:template rememberIn:nameOfClassVar |
749 |
|filterBlockString filterBlock dialog textHolder classVarValue| |
|
750 |
||
751 |
classVarValue := self class classVarAt:nameOfClassVar ifAbsent:nil. |
|
752 |
classVarValue isNil ifTrue:[ |
|
753 |
self class classVarAt:nameOfClassVar put:template. |
|
754 |
classVarValue := template. |
|
755 |
]. |
|
756 |
||
757 |
textHolder := ValueHolder new. |
|
758 |
dialog := Dialog |
|
759 |
forRequestText:(resources string:message) |
|
760 |
lines:25 |
|
761 |
columns:70 |
|
762 |
initialAnswer:classVarValue |
|
763 |
model:textHolder. |
|
764 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
765 |
dialog open. |
|
766 |
dialog accepted ifFalse:[^ nil]. |
|
767 |
||
768 |
filterBlockString := textHolder value. |
|
769 |
self class classVarAt:nameOfClassVar put:filterBlockString. |
|
770 |
||
771 |
filterBlock := Parser evaluate:filterBlockString. |
|
772 |
filterBlock isBlock ifFalse:[ |
|
773 |
self halt:'oops - bad input'. |
|
774 |
^ nil |
|
775 |
]. |
|
776 |
||
777 |
^ filterBlock |
|
778 |
! |
|
779 |
||
3667 | 780 |
autoDefineWorkspaceVariablesChanged |
781 |
"does not work yet - needs more interaction with parser" |
|
782 |
||
783 |
|doAutoDefine| |
|
784 |
||
785 |
doAutoDefine := autoDefineWorkspaceVariables value. |
|
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
786 |
UserPreferences current autoDefineWorkspaceVariables:doAutoDefine. |
3667 | 787 |
workspaces do:[:each | |
788 |
each autoDefineWorkspaceVariables:doAutoDefine |
|
789 |
]. |
|
790 |
! |
|
791 |
||
3198 | 792 |
basicInspectIt |
793 |
self inspectIt:true |
|
794 |
! |
|
795 |
||
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
796 |
browseImplementorsOfIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
797 |
self selectedWorkspacesTextView browseImplementorsOfIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
798 |
! |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
799 |
|
3154 | 800 |
browseIt |
3198 | 801 |
self selectedWorkspacesTextView browseIt |
3154 | 802 |
! |
803 |
||
3383
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
804 |
browseReferencesToIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
805 |
self selectedWorkspacesTextView browseReferencesToIt |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
806 |
! |
fb3b6909bd1a
+ browseReferencesToIt & browserImplementorsOfIt
Claus Gittinger <cg@exept.de>
parents:
3347
diff
changeset
|
807 |
|
4136 | 808 |
clearHistory |
809 |
Workspace clearDoItHistory |
|
810 |
! |
|
811 |
||
3154 | 812 |
copySelection |
3198 | 813 |
self selectedWorkspacesTextView copySelection |
3154 | 814 |
! |
815 |
||
816 |
cutSelection |
|
3198 | 817 |
self selectedWorkspacesTextView cutSelection |
3154 | 818 |
! |
819 |
||
820 |
doIt |
|
3198 | 821 |
self selectedWorkspacesTextView doIt |
3154 | 822 |
! |
823 |
||
3752 | 824 |
filterText |
825 |
|template filterBlock newList oldList answer nDeleted deletedLines| |
|
826 |
||
827 |
template := |
|
828 |
'"/ general text filter; |
|
829 |
"/ the following block should evaluate to true for all lines |
|
830 |
"/ you want to keep - lines for which the block returns false will be removed. |
|
831 |
"/ Beginner warning: Smalltalk know-how is useful here. |
|
832 |
||
833 |
[:line | |
|
834 |
"/ any condition on line. |
|
835 |
"/ Notice, that line might be a Text object (i.e. non-string), |
|
836 |
"/ so you may want to use line string. |
|
837 |
"/ |
|
838 |
"/ Useful queries on the line are: |
|
839 |
"/ - size the length of the line |
|
840 |
"/ - hasChangeOfEmphasis any bold, italic etc. |
|
841 |
"/ - startsWith:someString |
|
842 |
"/ - endsWith:someString |
|
843 |
||
844 |
"/ example filter (removes all empty lines) |
|
845 |
"/ |
|
846 |
"/ line size > 0 |
|
847 |
||
848 |
"/ example filter (removes all lines which do not end with some suffix) |
|
849 |
"/ |
|
850 |
"/ (line asLowercase endsWith:''foo'') not |
|
851 |
||
852 |
"/ dummy filter (keeps all lines) |
|
853 |
"/ |
|
854 |
true |
|
855 |
] |
|
856 |
'. |
|
857 |
||
858 |
filterBlock := self askForFilterBlock:'Filter block:' |
|
859 |
template:template |
|
860 |
rememberIn:#LastFilterBlockString. |
|
861 |
filterBlock isNil ifTrue:[^ self]. |
|
862 |
||
863 |
oldList := self selectedWorkspacesTextView list. |
|
864 |
oldList := oldList collect:[:lineOrNil | lineOrNil ? '']. |
|
865 |
newList := oldList select:filterBlock. |
|
866 |
newList := newList collect:[:line | (line isString and:[line size == 0]) ifTrue:[nil] ifFalse:[line]]. |
|
867 |
nDeleted := oldList size - newList size. |
|
868 |
nDeleted == 0 ifTrue:[ |
|
869 |
self information:'No lines were deleted.'. |
|
870 |
^ self |
|
871 |
]. |
|
872 |
||
873 |
answer := Dialog confirmWithCancel:(resources |
|
874 |
string:'%1 lines remain (%2 deleted). Change text ?' |
|
875 |
with:newList size |
|
876 |
with:nDeleted) |
|
877 |
labels:#( 'Cancel' 'No, Show Deleted' 'Yes'). |
|
878 |
answer isNil ifTrue:[^ self]. |
|
879 |
answer ifFalse:[ |
|
880 |
deletedLines := oldList reject:filterBlock. |
|
881 |
TextBox openOn:(deletedLines asStringCollection) title:'Filtered lines'. |
|
882 |
^ self. |
|
883 |
]. |
|
884 |
||
885 |
self selectedWorkspacesTextView list:newList. |
|
886 |
! |
|
887 |
||
3154 | 888 |
inspectIt |
3198 | 889 |
self inspectIt:false |
890 |
! |
|
891 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
892 |
inspectIt:isBasicInspector |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
893 |
|ws| |
3196 | 894 |
|
3198 | 895 |
ws := self selectedWorkspacesTextView. |
3196 | 896 |
ws |
897 |
do:(ws selection) |
|
898 |
withValueDo:[:result | |
|
4096
1c393b3edbcd
Workspace-Variable inspector
Claus Gittinger <cg@exept.de>
parents:
4086
diff
changeset
|
899 |
self addInspectorOn:result basic:isBasicInspector suppressPseudoSlots:false |
3196 | 900 |
] |
901 |
||
902 |
"/ self selectedWorkspace inspectIt |
|
3154 | 903 |
! |
904 |
||
3812 | 905 |
inspectWorkspaceVariables |
906 |
|wsvars| |
|
907 |
||
908 |
wsvars := Workspace workspaceVariables. |
|
909 |
wsvars size == 0 ifTrue:[ |
|
910 |
Dialog information:'No Workspace Variables are defined'. |
|
911 |
^ self |
|
912 |
]. |
|
913 |
wsvars inspect |
|
914 |
! |
|
915 |
||
3332 | 916 |
loadFile:aFileName |
917 |
|file ws lbl| |
|
918 |
||
919 |
file := aFileName asFilename. |
|
3507 | 920 |
(ws := self selectedWorkspacesTextView) contents:file contents. |
3332 | 921 |
ws modified:false. |
922 |
||
923 |
lbl := file withoutSuffix baseName. |
|
924 |
tabList size <= 1 ifTrue:[ |
|
925 |
self window label:lbl. |
|
926 |
] ifFalse:[ |
|
927 |
tabList at:self selectedWorkspaceIndexHolder value put:lbl |
|
928 |
] |
|
929 |
! |
|
930 |
||
3154 | 931 |
menuLoad |
3332 | 932 |
|file| |
3154 | 933 |
|
3193 | 934 |
(self askIfModified:'Text was modified. Load anyway ?' yesButton:'Load') ifFalse:[ ^ self]. |
935 |
||
3469 | 936 |
file := Dialog requestFileName:'Load file:' default:'file.wsp' pattern:'*.wsp'. |
3154 | 937 |
file size > 0 ifTrue:[ |
3332 | 938 |
self loadFile:file |
3154 | 939 |
] |
940 |
! |
|
941 |
||
4267 | 942 |
menuSaveAllAs |
943 |
self |
|
944 |
askForFile:'Save all Buffers into:' |
|
945 |
thenDo:[:file :doAppend | |
|
946 |
|ws append| |
|
3473
1120657c3d2e
added Append-option to saveAs
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
947 |
|
4267 | 948 |
append := doAppend. |
949 |
workspaces do:[:subView | |
|
950 |
|ws| |
|
3154 | 951 |
|
4267 | 952 |
ws := self workspaceViewOfView:subView. |
953 |
ws notNil ifTrue:[ |
|
954 |
ws saveAs:file doAppend:append. |
|
955 |
ws modified:false. |
|
956 |
]. |
|
957 |
append := true. |
|
958 |
]. |
|
959 |
] |
|
960 |
! |
|
3473
1120657c3d2e
added Append-option to saveAs
Claus Gittinger <cg@exept.de>
parents:
3469
diff
changeset
|
961 |
|
4267 | 962 |
menuSaveAs |
963 |
self |
|
964 |
askForFile:'Save Buffer into:' |
|
965 |
thenDo:[:file :doAppend | |
|
966 |
|ws| |
|
967 |
||
968 |
ws := self selectedWorkspacesTextView. |
|
969 |
ws saveAs:file doAppend:doAppend. |
|
970 |
ws modified:false. |
|
971 |
] |
|
3154 | 972 |
! |
973 |
||
3334 | 974 |
newSystemWorkspace |
975 |
self class openSystemWorkspace |
|
976 |
! |
|
977 |
||
3651 | 978 |
newWorkspace |
979 |
self class open |
|
980 |
! |
|
981 |
||
3154 | 982 |
openDocumentation |
983 |
"opens the documentation file" |
|
984 |
||
985 |
self openHTMLDocument: 'tools/misc/TOP.html#WORKSPACE' |
|
986 |
! |
|
987 |
||
988 |
paste |
|
3198 | 989 |
self selectedWorkspacesTextView paste |
3154 | 990 |
! |
991 |
||
4267 | 992 |
paste:aString |
4136 | 993 |
self selectedWorkspacesTextView paste:aString. |
4267 | 994 |
! |
995 |
||
996 |
pasteAndExecute:aString |
|
997 |
self paste:aString. |
|
4136 | 998 |
self printIt |
999 |
! |
|
1000 |
||
4267 | 1001 |
pasteLastDoIt |
1002 |
|s| |
|
1003 |
||
1004 |
s := self lastDoItsString. |
|
1005 |
s notNil ifTrue:[ |
|
1006 |
self paste:s |
|
1007 |
] |
|
1008 |
! |
|
1009 |
||
3154 | 1010 |
printIt |
3198 | 1011 |
self selectedWorkspacesTextView printIt |
3193 | 1012 |
! |
1013 |
||
3752 | 1014 |
processText |
1015 |
|template filterBlock newList oldList answer nChanged changedLines flags| |
|
1016 |
||
1017 |
template := |
|
1018 |
'"/ general text processor; |
|
1019 |
"/ the following block should evaluate to a new line, |
|
1020 |
"/ given the original line as argument. |
|
1021 |
"/ Beginner warning: Smalltalk know-how is useful here. |
|
1022 |
||
1023 |
[:line | |
|
1024 |
"/ any processing on line. |
|
1025 |
"/ Notice, that line might be a Text object (i.e. non-string), |
|
1026 |
"/ |
|
1027 |
"/ Useful operations on the line are: |
|
1028 |
"/ - '' .... '' , concatenation of any prefix/suffix |
|
1029 |
"/ - leftPaddedTo:size padding |
|
1030 |
"/ - rightPaddedTo:size padding |
|
1031 |
"/ - copyTo:(size min:N) |
|
1032 |
"/ - asUppercase |
|
1033 |
"/ - asLowercase |
|
4141 | 1034 |
"/ - withoutSeparators remove whiteSpace |
1035 |
"/ - asCollectionOfWords words |
|
3752 | 1036 |
|
1037 |
"/ makes everything bold |
|
1038 |
"/ |
|
1039 |
"/ line allBold |
|
1040 |
||
4141 | 1041 |
"/ first word only |
1042 |
"/ |
|
1043 |
"/ line withoutSeparators asCollectionOfWords first |
|
1044 |
||
3752 | 1045 |
"/ dummy filter (keeps all lines as-is) |
1046 |
"/ |
|
1047 |
line |
|
1048 |
] |
|
1049 |
'. |
|
1050 |
filterBlock := self askForFilterBlock:'Processing block:' |
|
1051 |
template:template |
|
1052 |
rememberIn:#LastProcessingBlockString. |
|
1053 |
filterBlock isNil ifTrue:[^ self]. |
|
1054 |
||
1055 |
oldList := self selectedWorkspacesTextView list. |
|
1056 |
oldList := oldList collect:[:lineOrNil | lineOrNil ? '']. |
|
4141 | 1057 |
newList := oldList collect:[:line | |newLine| |
1058 |
newLine := line. |
|
1059 |
Error handle:[:ex | |
|
1060 |
] do:[ |
|
1061 |
newLine := filterBlock value:line |
|
1062 |
]. |
|
1063 |
newLine |
|
1064 |
]. |
|
3752 | 1065 |
newList := newList collect:[:line | (line isString and:[line size == 0]) ifTrue:[nil] ifFalse:[line]]. |
1066 |
||
1067 |
flags := (1 to:oldList size) collect:[:i | (oldList at:i) ~= (newList at:i)]. |
|
1068 |
flags := flags select:[:flag | flag]. |
|
1069 |
nChanged := flags size. |
|
1070 |
nChanged == 0 ifTrue:[ |
|
1071 |
self information:'No lines were changed.'. |
|
1072 |
^ self |
|
1073 |
]. |
|
1074 |
||
1075 |
answer := Dialog confirmWithCancel:(resources |
|
1076 |
string:'%1 lines changed. Change text ?' |
|
1077 |
with:nChanged) |
|
1078 |
labels:#( 'Cancel' 'No, Show Changed' 'Yes'). |
|
1079 |
answer isNil ifTrue:[^ self]. |
|
1080 |
answer ifFalse:[ |
|
1081 |
changedLines := (1 to:oldList size) select:[:i | (oldList at:i) ~= (newList at:i)]. |
|
1082 |
changedLines := changedLines collect:[:i | (newList at:i)]. |
|
1083 |
TextBox openOn:(changedLines asStringCollection) title:'Changed lines'. |
|
1084 |
^ self. |
|
1085 |
]. |
|
1086 |
||
1087 |
self selectedWorkspacesTextView list:newList. |
|
1088 |
! |
|
1089 |
||
4136 | 1090 |
redoLastDoIt |
4267 | 1091 |
|s| |
4136 | 1092 |
|
4267 | 1093 |
s := self lastDoItsString. |
1094 |
s notNil ifTrue:[ |
|
1095 |
self pasteAndExecute:s |
|
1096 |
] |
|
4136 | 1097 |
! |
1098 |
||
3722 | 1099 |
removeAllWorkspaceVariables |
1100 |
(Dialog confirm:'Do you really want to remove all Workspace Variables ?') |
|
1101 |
ifTrue:[ |
|
1102 |
Workspace removeAllWorkspaceVariables |
|
1103 |
]. |
|
1104 |
! |
|
1105 |
||
4284 | 1106 |
removeGlobalVariable |
1107 |
|name nameKey selection value| |
|
1108 |
||
1109 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
1110 |
||
1111 |
name := Dialog |
|
1112 |
request:'Remove Global Variable:' |
|
1113 |
initialAnswer:(selection asString string) |
|
1114 |
okLabel:'Remove' |
|
1115 |
title:'Remove Global'. |
|
1116 |
||
1117 |
name size == 0 ifTrue:[^ self]. |
|
1118 |
nameKey := name asSymbolIfInterned. |
|
1119 |
nameKey isNil ifTrue:[^ self]. |
|
1120 |
||
1121 |
(Smalltalk includesKey:nameKey) ifFalse:[ |
|
1122 |
self warn:('No such Global Binding: ''%1''.' bindWith:name). |
|
1123 |
^ self. |
|
1124 |
]. |
|
1125 |
||
1126 |
value := Smalltalk at:nameKey. |
|
1127 |
value notNil ifTrue:[ |
|
1128 |
(self confirm:('Global ''%1'' is currently bound to %2\\Remove Binding ?' bindWith:name with:value) withCRs) |
|
1129 |
ifFalse:[ |
|
1130 |
^ self. |
|
1131 |
]. |
|
1132 |
]. |
|
1133 |
Smalltalk at:nameKey put:nil. |
|
1134 |
Smalltalk removeKey:nameKey |
|
1135 |
! |
|
1136 |
||
3193 | 1137 |
removeWorkspace |
1138 |
self removeWorkspace:(self selectedWorkspaceIndexHolder value) |
|
1139 |
! |
|
1140 |
||
1141 |
removeWorkspace:wsIndex |
|
1142 |
|tabList newWsIndex| |
|
1143 |
||
1144 |
wsIndex == self selectedWorkspaceIndexHolder value ifTrue:[ |
|
1145 |
(self askIfModified:'Text was modified. Remove anyway ?' yesButton:'Remove') ifFalse:[ |
|
1146 |
^ self |
|
1147 |
]. |
|
1148 |
]. |
|
1149 |
||
1150 |
tabList := self tabList. |
|
1151 |
||
1152 |
wsIndex == tabList size ifTrue:[ |
|
1153 |
newWsIndex := wsIndex - 1. |
|
1154 |
] ifFalse:[ |
|
1155 |
newWsIndex := wsIndex. |
|
1156 |
]. |
|
1157 |
||
1158 |
tabList removeIndex:wsIndex. |
|
1159 |
(workspaces at:wsIndex) destroy. |
|
1160 |
workspaces removeIndex:wsIndex. |
|
1161 |
||
1162 |
tabList size == 1 ifTrue:[ |
|
1163 |
self window label:(tabList at:1). |
|
1164 |
tabList removeIndex:1 |
|
1165 |
]. |
|
1166 |
||
3334 | 1167 |
workspaceHolder value:(workspaces at:newWsIndex). |
3193 | 1168 |
self selectedWorkspaceIndexHolder value:newWsIndex. |
1169 |
"/ to force change (update workspaceHolder - even if same index) |
|
1170 |
self selectedWorkspaceIndexHolder changed:#value. |
|
1171 |
! |
|
1172 |
||
3722 | 1173 |
removeWorkspaceVariable |
3812 | 1174 |
|name selection wsvars| |
1175 |
||
1176 |
wsvars := Workspace workspaceVariables. |
|
1177 |
wsvars size == 0 ifTrue:[ |
|
1178 |
Dialog information:'No Workspace Variables are defined'. |
|
1179 |
^ self |
|
1180 |
]. |
|
3722 | 1181 |
|
1182 |
selection := self selectedWorkspacesTextView selection ? ''. |
|
1183 |
||
1184 |
name := Dialog |
|
1185 |
request:'Variable to remove:' |
|
1186 |
initialAnswer:(selection asString string) |
|
1187 |
okLabel:'Remove' |
|
1188 |
title:'Enter Variable Name' |
|
3812 | 1189 |
list:(wsvars keys asOrderedCollection sort). |
3722 | 1190 |
name size == 0 ifTrue:[ |
1191 |
^ self |
|
1192 |
]. |
|
1193 |
Workspace removeWorkspaceVariable:name. |
|
1194 |
! |
|
1195 |
||
3193 | 1196 |
renameWorkspace |
1197 |
self renameWorkspace:(self selectedWorkspaceIndexHolder value) |
|
1198 |
! |
|
1199 |
||
1200 |
renameWorkspace:wsIndex |
|
1201 |
|tabList oldName newName| |
|
1202 |
||
1203 |
tabList := self tabList. |
|
1204 |
tabList isEmpty ifTrue:[ |
|
1205 |
oldName := self window label |
|
1206 |
] ifFalse:[ |
|
1207 |
oldName := tabList at:wsIndex. |
|
1208 |
]. |
|
1209 |
newName := Dialog request:(resources string:'New Name for %1:' with:oldName) initialAnswer:oldName. |
|
1210 |
newName size == 0 ifTrue:[ ^ self]. |
|
1211 |
||
4086
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1212 |
self renameWorkspace:wsIndex to:newName. |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1213 |
! |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1214 |
|
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1215 |
renameWorkspace:wsIndex to:newName |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1216 |
|tabList| |
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1217 |
|
9f685ed7ad3f
autodefine workspace variables
Claus Gittinger <cg@exept.de>
parents:
4031
diff
changeset
|
1218 |
tabList := self tabList. |
3193 | 1219 |
tabList notEmpty ifTrue:[ |
1220 |
tabList at:wsIndex put:newName. |
|
1221 |
]. |
|
1222 |
wsIndex == self selectedWorkspaceIndexHolder value ifTrue:[ |
|
1223 |
self window label:newName. |
|
1224 |
]. |
|
3384 | 1225 |
! |
1226 |
||
1227 |
spyOnIt |
|
1228 |
self selectedWorkspacesTextView spyOnIt |
|
1229 |
! |
|
1230 |
||
1231 |
timeIt |
|
1232 |
self selectedWorkspacesTextView timeIt |
|
3154 | 1233 |
! ! |
1234 |
||
4136 | 1235 |
!WorkspaceApplication methodsFor:'menu-dynamic'! |
1236 |
||
4267 | 1237 |
pasteRecentDoItMenu |
1238 |
<resource: #programMenu > |
|
1239 |
||
1240 |
^ self recentDoItsMenuFor:#'paste:' |
|
1241 |
! |
|
1242 |
||
1243 |
recentDoItsMenuFor:aSelector |
|
4136 | 1244 |
<resource: #programMenu > |
1245 |
||
1246 |
^ [ |
|
1247 |
|doIts m classHistory currentClass| |
|
1248 |
||
1249 |
doIts := Workspace doItHistory. |
|
1250 |
doIts size > 0 ifTrue:[ |
|
1251 |
m := Menu new. |
|
1252 |
doIts do:[:doItEntry | |
|
1253 |
|lines label item| |
|
1254 |
||
1255 |
label := doItEntry withoutLeadingSeparators asStringCollection first. |
|
1256 |
(label size > 20) ifTrue:[ |
|
1257 |
label := (label contractTo:20) |
|
1258 |
] ifFalse:[ |
|
1259 |
(lines size > 1) ifTrue:[ |
|
1260 |
label := label , '...' |
|
1261 |
]. |
|
1262 |
]. |
|
1263 |
label := '''' , label , ''''. |
|
1264 |
||
1265 |
item := MenuItem label:label. |
|
1266 |
m addItem:item. |
|
4267 | 1267 |
item value:aSelector. |
4136 | 1268 |
item argument:doItEntry. |
1269 |
]. |
|
1270 |
m addItem: (MenuItem new label:'-'). |
|
1271 |
m addItem: (MenuItem new |
|
1272 |
label: 'Clear History'; |
|
1273 |
value: #clearHistory; |
|
1274 |
activeHelpKey: #historyEmptyMenu; |
|
1275 |
translateLabel:true). |
|
1276 |
]. |
|
1277 |
m |
|
1278 |
]. |
|
4267 | 1279 |
! |
1280 |
||
1281 |
redoRecentDoItMenu |
|
1282 |
<resource: #programMenu > |
|
1283 |
||
1284 |
^ self recentDoItsMenuFor:#'pasteAndExecute:' |
|
4136 | 1285 |
! ! |
1286 |
||
3154 | 1287 |
!WorkspaceApplication methodsFor:'private'! |
1288 |
||
4267 | 1289 |
askForFile:question thenDo:aBlock |
1290 |
|file doAppend| |
|
1291 |
||
1292 |
doAppend := false. |
|
1293 |
Dialog aboutToOpenBoxNotificationSignal handle:[:n | |
|
1294 |
|box| |
|
1295 |
||
1296 |
box := n parameter. |
|
1297 |
box addButton:(Button label:'Append' |
|
1298 |
action:[doAppend := true. box okPressed]). |
|
1299 |
n proceed. |
|
1300 |
] do:[ |
|
1301 |
file := Dialog requestFileName:question default:'file.wsp'. |
|
1302 |
]. |
|
1303 |
file isEmptyOrNil ifFalse:[ |
|
1304 |
aBlock value:file value:doAppend |
|
1305 |
]. |
|
1306 |
! |
|
1307 |
||
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1308 |
askIfAnyModified:question yesButton:yesButtonText |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1309 |
(workspaces contains:[:aView | self isModifiedWorkspace:aView]) ifFalse:[^ true]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1310 |
|
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1311 |
(Dialog |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1312 |
confirm:(resources string:question) withCRs |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1313 |
yesLabel:(resources at:yesButtonText) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1314 |
noLabel:(resources at:'Cancel')) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1315 |
ifTrue:[ |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1316 |
"/ reset modified flag so question is asked only once |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1317 |
(workspaces select:[:aView | (self isModifiedWorkspace:aView)]) |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1318 |
do:[:eachModifiedTextView | |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1319 |
eachModifiedTextView modified:false. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1320 |
]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1321 |
^ true |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1322 |
]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1323 |
^ false |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1324 |
! |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1325 |
|
3154 | 1326 |
askIfModified:question yesButton:yesButtonText |
1327 |
"tell user, that code has been modified - let her confirm" |
|
1328 |
||
1329 |
|textView| |
|
1330 |
||
3193 | 1331 |
textView := self selectedWorkspace. |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1332 |
(self isModifiedWorkspace:textView) ifFalse:[^ true]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1333 |
|
3154 | 1334 |
(Dialog |
1335 |
confirm:(resources string:question) withCRs |
|
1336 |
yesLabel:(resources at:yesButtonText) |
|
1337 |
noLabel:(resources at:'Cancel')) |
|
1338 |
ifTrue:[ |
|
1339 |
"/ reset modified flag so question is asked only once |
|
1340 |
textView modified:false. |
|
1341 |
^ true |
|
1342 |
]. |
|
1343 |
^ false |
|
1344 |
||
1345 |
"Modified: 2.10.1997 / 14:23:47 / stefan" |
|
3193 | 1346 |
! |
1347 |
||
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1348 |
isModifiedWorkspace:aView |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1349 |
|view| |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1350 |
|
4267 | 1351 |
view := self workspaceViewOfView:aView. |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1352 |
|
4313 | 1353 |
(view isNil |
1354 |
or:[view modified not |
|
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1355 |
or:[view contentsWasSaved |
4313 | 1356 |
or:[view contents withoutSeparators isEmpty]]]) ifTrue:[ |
4031
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1357 |
^ false |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1358 |
]. |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1359 |
^ true |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1360 |
! |
4ace4ff5fbbd
look for unsaved text in ANY workspace
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
1361 |
|
4267 | 1362 |
lastDoItsString |
1363 |
|history| |
|
3198 | 1364 |
|
4267 | 1365 |
history := Workspace doItHistory. |
1366 |
history size > 0 ifFalse:[ |
|
1367 |
self selectedWorkspacesTextView flash. |
|
1368 |
^ nil |
|
3198 | 1369 |
]. |
4267 | 1370 |
^ history first |
1371 |
! |
|
1372 |
||
1373 |
selectedWorkspacesTextView |
|
1374 |
^ self workspaceViewOfView:(self selectedWorkspace) |
|
3198 | 1375 |
! |
1376 |
||
3193 | 1377 |
workspaceSelectionChanged |
3334 | 1378 |
|wsIndex windowLabel v| |
3193 | 1379 |
|
1380 |
"/ self selected |
|
3334 | 1381 |
self workspaceHolder value:(v := self selectedWorkspace). |
3193 | 1382 |
wsIndex := self selectedWorkspaceIndexHolder value. |
1383 |
||
1384 |
wsIndex ~~ 0 ifTrue:[ |
|
1385 |
windowLabel := tabList at:wsIndex ifAbsent:nil. |
|
1386 |
windowLabel notNil ifTrue:[self window label:windowLabel]. |
|
1387 |
]. |
|
4267 | 1388 |
! |
1389 |
||
1390 |
workspaceViewOfView:aView |
|
1391 |
|view| |
|
1392 |
||
1393 |
view := aView. |
|
1394 |
(view isScrollWrapper) ifTrue:[ |
|
4313 | 1395 |
view := view scrolledView. |
1396 |
view isNil ifTrue:[^ nil]. |
|
4267 | 1397 |
]. |
1398 |
(view isTextView) ifFalse:[ |
|
1399 |
(view isKindOf:InspectorView) ifFalse:[ |
|
4313 | 1400 |
^ nil |
4267 | 1401 |
]. |
1402 |
view := view workspace. |
|
1403 |
(view isScrollWrapper) ifTrue:[ |
|
1404 |
view := view scrolledView |
|
1405 |
]. |
|
1406 |
]. |
|
1407 |
^ view |
|
3154 | 1408 |
! ! |
1409 |
||
1410 |
!WorkspaceApplication class methodsFor:'documentation'! |
|
1411 |
||
1412 |
version |
|
4313 | 1413 |
^ '$Header: /cvs/stx/stx/libtool/WorkspaceApplication.st,v 1.49 2002-11-26 09:13:10 cg Exp $' |
3154 | 1414 |
! ! |