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