1025
|
1 |
ApplicationModel subclass:#ProjectBrowser
|
|
2 |
instanceVariableNames:'knownProjects'
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'Interface-Smalltalk'
|
|
6 |
!
|
|
7 |
|
|
8 |
TreeItem subclass:#ProjectTreeItem
|
|
9 |
instanceVariableNames:'action'
|
|
10 |
classVariableNames:''
|
|
11 |
poolDictionaries:''
|
|
12 |
privateIn:ProjectBrowser
|
|
13 |
!
|
|
14 |
|
|
15 |
|
|
16 |
!ProjectBrowser class methodsFor:'interface specs'!
|
|
17 |
|
|
18 |
emptyRightCanvasSpec
|
|
19 |
"This resource specification was automatically generated
|
|
20 |
by the UIPainter of ST/X."
|
|
21 |
|
|
22 |
"Do not manually edit this!! If it is corrupted,
|
|
23 |
the UIPainter may not be able to read the specification."
|
|
24 |
|
|
25 |
"
|
|
26 |
UIPainter new openOnClass:ProjectBrowser andSelector:#emptyRightCanvasSpec
|
|
27 |
ProjectBrowser new openInterface:#emptyRightCanvasSpec
|
|
28 |
"
|
|
29 |
|
|
30 |
<resource: #canvas>
|
|
31 |
|
|
32 |
^
|
|
33 |
|
|
34 |
#(#FullSpec
|
|
35 |
#window:
|
|
36 |
#(#WindowSpec
|
|
37 |
#name: 'NewApplication'
|
|
38 |
#layout: #(#LayoutFrame 216 0 173 0 515 0 472 0)
|
|
39 |
#label: 'NewApplication'
|
|
40 |
#min: #(#Point 10 10)
|
|
41 |
#max: #(#Point 1280 1024)
|
|
42 |
#bounds: #(#Rectangle 216 173 516 473)
|
|
43 |
#usePreferredExtent: false
|
|
44 |
)
|
|
45 |
#component:
|
|
46 |
#(#SpecCollection
|
|
47 |
#collection:
|
|
48 |
#(
|
|
49 |
#(#TextEditorSpec
|
|
50 |
#name: 'TextEditor1'
|
|
51 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
52 |
#model: #rightCanvasTextHolder
|
|
53 |
#hasHorizontalScrollBar: true
|
|
54 |
#hasVerticalScrollBar: true
|
|
55 |
#miniScrollerHorizontal: true
|
|
56 |
#isReadOnly: true
|
|
57 |
)
|
|
58 |
)
|
|
59 |
)
|
|
60 |
)
|
|
61 |
!
|
|
62 |
|
|
63 |
windowSpec
|
|
64 |
"This resource specification was automatically generated
|
|
65 |
by the UIPainter of ST/X."
|
|
66 |
|
|
67 |
"Do not manually edit this!! If it is corrupted,
|
|
68 |
the UIPainter may not be able to read the specification."
|
|
69 |
|
|
70 |
"
|
|
71 |
UIPainter new openOnClass:ProjectBrowser andSelector:#windowSpec
|
|
72 |
ProjectBrowser new openInterface:#windowSpec
|
|
73 |
ProjectBrowser open
|
|
74 |
"
|
|
75 |
|
|
76 |
<resource: #canvas>
|
|
77 |
|
|
78 |
^
|
|
79 |
|
|
80 |
#(#FullSpec
|
|
81 |
#window:
|
|
82 |
#(#WindowSpec
|
|
83 |
#name: 'ProjectBrowser'
|
|
84 |
#layout: #(#LayoutFrame 16 0 31 0 579 0 353 0)
|
|
85 |
#label: 'ProjectBrowser'
|
|
86 |
#min: #(#Point 10 10)
|
|
87 |
#max: #(#Point 1024 768)
|
|
88 |
#bounds: #(#Rectangle 16 31 580 354)
|
|
89 |
#menu: #mainMenu
|
|
90 |
#usePreferredExtent: false
|
|
91 |
)
|
|
92 |
#component:
|
|
93 |
#(#SpecCollection
|
|
94 |
#collection:
|
|
95 |
#(
|
|
96 |
#(#MenuPanelSpec
|
|
97 |
#name: 'ToolBar1'
|
|
98 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0)
|
|
99 |
#menu: #menu
|
|
100 |
#textDefault: true
|
|
101 |
)
|
|
102 |
#(#VariableHorizontalPanelSpec
|
|
103 |
#name: 'VariableHorizontalPanel1'
|
|
104 |
#layout: #(#LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
|
|
105 |
#component:
|
|
106 |
#(#SpecCollection
|
|
107 |
#collection:
|
|
108 |
#(
|
|
109 |
#(#SelectionInTreeViewSpec
|
|
110 |
#name: 'TreeList1'
|
|
111 |
#model: #selectedTreeNode
|
|
112 |
#hasHorizontalScrollBar: true
|
|
113 |
#hasVerticalScrollBar: true
|
|
114 |
#miniScrollerHorizontal: true
|
|
115 |
#showRoot: false
|
|
116 |
#showDirectoryIndicatorForRoot: false
|
|
117 |
#showDirectoryIndicator: true
|
|
118 |
#valueChangeSelector: #itemSelected:
|
|
119 |
#hierarchicalList: #projectTreeHolder
|
|
120 |
#highlightMode: #label
|
|
121 |
)
|
|
122 |
#(#SubCanvasSpec
|
|
123 |
#name: 'SubCanvas1'
|
|
124 |
#hasHorizontalScrollBar: false
|
|
125 |
#hasVerticalScrollBar: false
|
|
126 |
#specHolder: #currentCanvasHolder
|
|
127 |
)
|
|
128 |
)
|
|
129 |
)
|
|
130 |
#handles: #(#Any 0.274823 1.0)
|
|
131 |
)
|
|
132 |
)
|
|
133 |
)
|
|
134 |
)
|
|
135 |
! !
|
|
136 |
|
|
137 |
!ProjectBrowser class methodsFor:'menu specs'!
|
|
138 |
|
|
139 |
mainMenu
|
|
140 |
"This resource specification was automatically generated
|
|
141 |
by the MenuEditor of ST/X."
|
|
142 |
|
|
143 |
"Do not manually edit this!! If it is corrupted,
|
|
144 |
the MenuEditor may not be able to read the specification."
|
|
145 |
|
|
146 |
"
|
|
147 |
MenuEditor new openOnClass:ProjectBrowser andSelector:#mainMenu
|
|
148 |
(Menu new fromLiteralArrayEncoding:(ProjectBrowser mainMenu)) startUp
|
|
149 |
"
|
|
150 |
|
|
151 |
<resource: #menu>
|
|
152 |
|
|
153 |
^
|
|
154 |
|
|
155 |
#(#Menu
|
|
156 |
|
|
157 |
#(
|
|
158 |
#(#MenuItem
|
|
159 |
#label: 'File'
|
|
160 |
#translateLabel: true
|
|
161 |
#submenu:
|
|
162 |
#(#Menu
|
|
163 |
|
|
164 |
#(
|
|
165 |
#(#MenuItem
|
|
166 |
#label: 'New'
|
|
167 |
#translateLabel: true
|
|
168 |
#value: #newProject
|
|
169 |
)
|
|
170 |
#(#MenuItem
|
|
171 |
#label: '-'
|
|
172 |
)
|
|
173 |
#(#MenuItem
|
|
174 |
#label: 'Open...'
|
|
175 |
#translateLabel: true
|
|
176 |
#value: #openProject
|
|
177 |
)
|
|
178 |
#(#MenuItem
|
|
179 |
#label: '-'
|
|
180 |
)
|
|
181 |
#(#MenuItem
|
|
182 |
#label: 'Save'
|
|
183 |
#translateLabel: true
|
|
184 |
#value: #saveProject
|
|
185 |
)
|
|
186 |
#(#MenuItem
|
|
187 |
#label: 'Save As...'
|
|
188 |
#translateLabel: true
|
|
189 |
#value: #saveProjectAs
|
|
190 |
)
|
|
191 |
#(#MenuItem
|
|
192 |
#label: '-'
|
|
193 |
)
|
|
194 |
#(#MenuItem
|
|
195 |
#label: 'Exit'
|
|
196 |
#translateLabel: true
|
|
197 |
#value: #closeRequest
|
|
198 |
)
|
|
199 |
) nil
|
|
200 |
nil
|
|
201 |
)
|
|
202 |
)
|
|
203 |
#(#MenuItem
|
|
204 |
#label: 'Help'
|
|
205 |
#translateLabel: true
|
|
206 |
#startGroup: #right
|
|
207 |
#submenu:
|
|
208 |
#(#Menu
|
|
209 |
|
|
210 |
#(
|
|
211 |
#(#MenuItem
|
|
212 |
#label: 'Documentation'
|
|
213 |
#translateLabel: true
|
|
214 |
#value: #openDocumentation
|
|
215 |
)
|
|
216 |
#(#MenuItem
|
|
217 |
#label: '-'
|
|
218 |
)
|
|
219 |
#(#MenuItem
|
|
220 |
#label: 'About this Application'
|
|
221 |
#translateLabel: true
|
|
222 |
#value: #openAboutThisApplication
|
|
223 |
)
|
|
224 |
) nil
|
|
225 |
nil
|
|
226 |
)
|
|
227 |
)
|
|
228 |
) nil
|
|
229 |
nil
|
|
230 |
)
|
|
231 |
!
|
|
232 |
|
|
233 |
menu
|
|
234 |
"This resource specification was automatically generated
|
|
235 |
by the MenuEditor of ST/X."
|
|
236 |
|
|
237 |
"Do not manually edit this!! If it is corrupted,
|
|
238 |
the MenuEditor may not be able to read the specification."
|
|
239 |
|
|
240 |
"
|
|
241 |
MenuEditor new openOnClass:ProjectBrowser andSelector:#menu
|
|
242 |
(Menu new fromLiteralArrayEncoding:(ProjectBrowser menu)) startUp
|
|
243 |
"
|
|
244 |
|
|
245 |
<resource: #menu>
|
|
246 |
|
|
247 |
^
|
|
248 |
|
|
249 |
#(#Menu
|
|
250 |
|
|
251 |
#(
|
|
252 |
#(#MenuItem
|
|
253 |
#label: 'New...'
|
|
254 |
#translateLabel: true
|
|
255 |
#isButton: true
|
|
256 |
#value: #newProject
|
|
257 |
#labelImage: #(#ResourceRetriever #Icon #newIcon)
|
|
258 |
)
|
|
259 |
#(#MenuItem
|
|
260 |
#label: 'Open...'
|
|
261 |
#translateLabel: true
|
|
262 |
#isButton: true
|
|
263 |
#value: #openProject
|
|
264 |
#labelImage: #(#ResourceRetriever #Icon #loadIcon)
|
|
265 |
)
|
|
266 |
#(#MenuItem
|
|
267 |
#label: 'SaveAs...'
|
|
268 |
#translateLabel: true
|
|
269 |
#isButton: true
|
|
270 |
#value: #saveProject
|
|
271 |
#labelImage: #(#ResourceRetriever #Icon #saveIcon)
|
|
272 |
)
|
|
273 |
) nil
|
|
274 |
nil
|
|
275 |
)
|
|
276 |
! !
|
|
277 |
|
|
278 |
!ProjectBrowser methodsFor:'aspects'!
|
|
279 |
|
|
280 |
currentCanvasHolder
|
|
281 |
"automatically generated by UIPainter ..."
|
|
282 |
|
|
283 |
"*** the code below creates a default model when invoked."
|
|
284 |
"*** (which may not be the one you wanted)"
|
|
285 |
"*** Please change as required and accept in the browser."
|
|
286 |
|
|
287 |
|holder|
|
|
288 |
|
|
289 |
(holder := builder bindingAt:#currentCanvasHolder) isNil ifTrue:[
|
|
290 |
builder aspectAt:#currentCanvasHolder put:(holder := ValueHolder new).
|
|
291 |
].
|
|
292 |
^ holder.
|
|
293 |
!
|
|
294 |
|
|
295 |
projectTreeHolder
|
|
296 |
"automatically generated by UIPainter ..."
|
|
297 |
|
|
298 |
"*** the code below creates a default model when invoked."
|
|
299 |
"*** (which may not be the one you wanted)"
|
|
300 |
"*** Please change as required and accept in the browser."
|
|
301 |
|
|
302 |
|holder|
|
|
303 |
|
|
304 |
(holder := builder bindingAt:#projectTree) isNil ifTrue:[
|
|
305 |
builder aspectAt:#projectTree put:(holder := SelectionInTree new).
|
|
306 |
holder root:self projectTree.
|
|
307 |
].
|
|
308 |
^ holder.
|
|
309 |
!
|
|
310 |
|
|
311 |
rightCanvasTextHolder
|
|
312 |
"automatically generated by UIPainter ..."
|
|
313 |
|
|
314 |
"*** the code below creates a default model when invoked."
|
|
315 |
"*** (which may not be the one you wanted)"
|
|
316 |
"*** Please change as required and accept in the browser."
|
|
317 |
|
|
318 |
|holder|
|
|
319 |
|
|
320 |
(holder := builder bindingAt:#rightCanvasTextHolder) isNil ifTrue:[
|
|
321 |
builder aspectAt:#rightCanvasTextHolder put:(holder := ValueHolder new).
|
|
322 |
].
|
|
323 |
^ holder.
|
|
324 |
!
|
|
325 |
|
|
326 |
selectedTreeNode
|
|
327 |
"automatically generated by UIPainter ..."
|
|
328 |
|
|
329 |
"*** the code below creates a default model when invoked."
|
|
330 |
"*** (which may not be the one you wanted)"
|
|
331 |
"*** Please change as required and accept in the browser."
|
|
332 |
|
|
333 |
|holder|
|
|
334 |
|
|
335 |
(holder := builder bindingAt:#selectedTreeNode) isNil ifTrue:[
|
|
336 |
builder aspectAt:#selectedTreeNode put:(holder := ValueHolder new).
|
|
337 |
].
|
|
338 |
^ holder.
|
|
339 |
! !
|
|
340 |
|
|
341 |
!ProjectBrowser methodsFor:'initialization'!
|
|
342 |
|
|
343 |
postBuildWith:aBuiler
|
|
344 |
self setupCanvasForNoSelection
|
|
345 |
!
|
|
346 |
|
|
347 |
setupCanvasForNoSelection
|
|
348 |
self currentCanvasHolder value:(self class emptyRightCanvasSpec).
|
|
349 |
self rightCanvasTextHolder value:'Please select an existing,
|
|
350 |
or create a new project.'.
|
|
351 |
! !
|
|
352 |
|
|
353 |
!ProjectBrowser methodsFor:'private'!
|
|
354 |
|
|
355 |
nodeFor:aProject
|
|
356 |
|projectName pNode
|
|
357 |
propertiesNode docNode classesNode subprojectsNode filesNode
|
|
358 |
commentNode|
|
|
359 |
|
|
360 |
projectName := aProject name.
|
|
361 |
pNode := ProjectTreeItem name:projectName.
|
|
362 |
pNode contents:aProject.
|
|
363 |
|
|
364 |
pNode add:(commentNode := ProjectTreeItem name:'Comment').
|
|
365 |
pNode add:(docNode := ProjectTreeItem name:'Documentation').
|
|
366 |
pNode add:(propertiesNode := ProjectTreeItem name:'Properties').
|
|
367 |
pNode add:(classesNode := ProjectTreeItem name:'Classes').
|
|
368 |
pNode add:(subprojectsNode := ProjectTreeItem name:'SubProjects').
|
|
369 |
pNode add:(filesNode := ProjectTreeItem name:'Files').
|
|
370 |
|
|
371 |
aProject subProjects do:[:aSubProject |
|
|
372 |
subprojectsNode add:(self nodeFor:aSubProject)
|
|
373 |
].
|
|
374 |
|
|
375 |
commentNode action:[:item | self showCommentOf:item].
|
|
376 |
docNode contents:nil.
|
|
377 |
propertiesNode contents:nil.
|
|
378 |
classesNode contents:nil.
|
|
379 |
subprojectsNode contents:nil.
|
|
380 |
filesNode contents:nil.
|
|
381 |
|
|
382 |
^ pNode
|
|
383 |
!
|
|
384 |
|
|
385 |
projectTree
|
|
386 |
|tree root|
|
|
387 |
|
|
388 |
tree := SelectionInTree new.
|
|
389 |
tree root:(root := TreeItem name:'invisibleRoot').
|
|
390 |
|
|
391 |
Project knownProjects do:[:aProject |
|
|
392 |
root add:(self nodeFor:aProject).
|
|
393 |
].
|
|
394 |
|
|
395 |
^ root
|
|
396 |
!
|
|
397 |
|
|
398 |
updateRightCanvas
|
|
399 |
|selectedNode nodeContents|
|
|
400 |
|
|
401 |
selectedNode := self selectedTreeNode value.
|
|
402 |
selectedNode isNil ifTrue:[
|
|
403 |
self setupCanvasForNoSelection.
|
|
404 |
^ self
|
|
405 |
].
|
|
406 |
nodeContents := selectedNode contents.
|
|
407 |
(nodeContents isMemberOf:Project) ifTrue:[
|
|
408 |
self currentCanvasHolder value:(self class emptyRightCanvasSpec).
|
|
409 |
self rightCanvasTextHolder value:nodeContents comment.
|
|
410 |
^ self.
|
|
411 |
].
|
|
412 |
|
|
413 |
self currentCanvasHolder value:(self class emptyRightCanvasSpec).
|
|
414 |
self rightCanvasTextHolder value:''.
|
|
415 |
|
|
416 |
! !
|
|
417 |
|
|
418 |
!ProjectBrowser methodsFor:'user actions'!
|
|
419 |
|
|
420 |
itemSelected:index
|
|
421 |
|item action|
|
|
422 |
|
|
423 |
self updateRightCanvas.
|
|
424 |
|
|
425 |
item := self projectTreeHolder value at:index.
|
|
426 |
action := item action.
|
|
427 |
action notNil ifTrue:[
|
|
428 |
action value:item.
|
|
429 |
].
|
|
430 |
!
|
|
431 |
|
|
432 |
showCommentOf:anItem
|
|
433 |
|project|
|
|
434 |
|
|
435 |
project := anItem parent contents.
|
|
436 |
|
|
437 |
self currentCanvasHolder value:(self class emptyRightCanvasSpec).
|
|
438 |
self rightCanvasTextHolder value:project comment.
|
|
439 |
|
|
440 |
!
|
|
441 |
|
|
442 |
showTreeItem:anItem
|
|
443 |
anItem contents == #comment ifTrue:[
|
|
444 |
self showCommentOf:anItem.
|
|
445 |
^ self
|
|
446 |
].
|
|
447 |
! !
|
|
448 |
|
|
449 |
!ProjectBrowser::ProjectTreeItem methodsFor:'accessing'!
|
|
450 |
|
|
451 |
action
|
|
452 |
"return the value of the instance variable 'action' (automatically generated)"
|
|
453 |
|
|
454 |
^ action!
|
|
455 |
|
|
456 |
action:something
|
|
457 |
"set the value of the instance variable 'action' (automatically generated)"
|
|
458 |
|
|
459 |
action := something.! !
|
|
460 |
|
|
461 |
!ProjectBrowser class methodsFor:'documentation'!
|
|
462 |
|
|
463 |
version
|
|
464 |
^ '$Header$'
|
|
465 |
! !
|