7006
|
1 |
"{ Package: 'stx:libtool' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Tools }"
|
|
4 |
|
|
5 |
ApplicationModel subclass:#StoreProjectBrowser
|
7010
|
6 |
instanceVariableNames:'dbInfo connection commentTextHolder packagesList
|
|
7 |
selectedVersionHolder versionsList selectedPackageHolder
|
|
8 |
packagesFilterHolder infoLabelHolder selectedBundleOrPackage
|
|
9 |
selectedVersion'
|
7006
|
10 |
classVariableNames:''
|
|
11 |
poolDictionaries:''
|
|
12 |
category:'System-SourceCodeManagement'
|
|
13 |
!
|
|
14 |
|
7008
|
15 |
Object subclass:#Pundle
|
|
16 |
instanceVariableNames:'name'
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
privateIn:StoreProjectBrowser
|
|
20 |
!
|
|
21 |
|
|
22 |
StoreProjectBrowser::Pundle subclass:#Package
|
|
23 |
instanceVariableNames:''
|
|
24 |
classVariableNames:''
|
|
25 |
poolDictionaries:''
|
|
26 |
privateIn:StoreProjectBrowser
|
|
27 |
!
|
|
28 |
|
|
29 |
StoreProjectBrowser::Pundle subclass:#Bundle
|
|
30 |
instanceVariableNames:''
|
|
31 |
classVariableNames:''
|
|
32 |
poolDictionaries:''
|
|
33 |
privateIn:StoreProjectBrowser
|
|
34 |
!
|
|
35 |
|
|
36 |
Object subclass:#PundleVersion
|
7010
|
37 |
instanceVariableNames:'id pundle version user timestamp comment timestampInt commentId
|
|
38 |
isBundle'
|
7008
|
39 |
classVariableNames:''
|
|
40 |
poolDictionaries:''
|
|
41 |
privateIn:StoreProjectBrowser
|
|
42 |
!
|
|
43 |
|
7006
|
44 |
!StoreProjectBrowser class methodsFor:'documentation'!
|
|
45 |
|
|
46 |
documentation
|
|
47 |
"
|
7011
|
48 |
An experimental first attempt to access a Store database.
|
|
49 |
As I dont have (and dont want) access to a VW implementation for reference,
|
|
50 |
the layout and contents of the tables has been guessed.
|
|
51 |
The goal is to be able to read public domain code from a store DB.
|
7006
|
52 |
"
|
|
53 |
!
|
|
54 |
|
|
55 |
examples
|
|
56 |
"
|
|
57 |
Starting the application:
|
|
58 |
[exBegin]
|
|
59 |
Tools::StoreProjectBrowser open
|
|
60 |
|
|
61 |
[exEnd]
|
|
62 |
|
|
63 |
more examples to be added:
|
|
64 |
[exBegin]
|
|
65 |
... add code fragment for
|
|
66 |
... executable example here ...
|
|
67 |
[exEnd]
|
|
68 |
"
|
|
69 |
! !
|
|
70 |
|
|
71 |
!StoreProjectBrowser class methodsFor:'interface specs'!
|
|
72 |
|
|
73 |
windowSpec
|
|
74 |
"This resource specification was automatically generated
|
|
75 |
by the UIPainter of ST/X."
|
|
76 |
|
|
77 |
"Do not manually edit this!! If it is corrupted,
|
|
78 |
the UIPainter may not be able to read the specification."
|
|
79 |
|
|
80 |
"
|
|
81 |
UIPainter new openOnClass:Tools::StoreProjectBrowser andSelector:#windowSpec
|
|
82 |
Tools::StoreProjectBrowser new openInterface:#windowSpec
|
|
83 |
Tools::StoreProjectBrowser open
|
|
84 |
"
|
|
85 |
|
|
86 |
<resource: #canvas>
|
|
87 |
|
|
88 |
^
|
|
89 |
#(FullSpec
|
|
90 |
name: windowSpec
|
|
91 |
window:
|
|
92 |
(WindowSpec
|
|
93 |
label: 'Tools::StoreProjectBrowser'
|
|
94 |
name: 'Tools::StoreProjectBrowser'
|
|
95 |
min: (Point 10 10)
|
|
96 |
max: (Point 1024 768)
|
|
97 |
bounds: (Rectangle 0 0 527 369)
|
|
98 |
menu: mainMenu
|
|
99 |
)
|
|
100 |
component:
|
|
101 |
(SpecCollection
|
|
102 |
collection: (
|
|
103 |
(VariableHorizontalPanelSpec
|
|
104 |
name: 'VariableHorizontalPanel1'
|
|
105 |
layout: (LayoutFrame 0 0 0 0 0 1 -30 1)
|
|
106 |
snapMode: both
|
|
107 |
handlePosition: right
|
|
108 |
component:
|
|
109 |
(SpecCollection
|
|
110 |
collection: (
|
|
111 |
(ViewSpec
|
|
112 |
name: 'Box1'
|
|
113 |
component:
|
|
114 |
(SpecCollection
|
|
115 |
collection: (
|
|
116 |
(LabelSpec
|
|
117 |
label: 'Bundles and Packages:'
|
|
118 |
name: 'Label1'
|
|
119 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0)
|
|
120 |
translateLabel: true
|
|
121 |
adjust: left
|
|
122 |
)
|
|
123 |
(InputFieldSpec
|
7008
|
124 |
name: 'PackageFilterEntryField'
|
7006
|
125 |
layout: (LayoutFrame 2 0 30 0 -2 1 58 0)
|
|
126 |
model: packagesFilterHolder
|
|
127 |
immediateAccept: true
|
|
128 |
acceptOnReturn: true
|
|
129 |
acceptOnTab: true
|
|
130 |
acceptOnLostFocus: true
|
|
131 |
acceptOnPointerLeave: false
|
|
132 |
)
|
|
133 |
(SequenceViewSpec
|
7008
|
134 |
name: 'PackageList'
|
7006
|
135 |
layout: (LayoutFrame 0 0 60 0 0 1 0 1)
|
|
136 |
model: selectedPackageHolder
|
7028
|
137 |
menu: packageListMenu
|
7006
|
138 |
hasHorizontalScrollBar: true
|
|
139 |
hasVerticalScrollBar: true
|
7008
|
140 |
valueChangeSelector: packageSelectionChanged
|
7006
|
141 |
useIndex: true
|
|
142 |
sequenceList: packagesList
|
|
143 |
)
|
|
144 |
)
|
|
145 |
|
|
146 |
)
|
|
147 |
)
|
|
148 |
(ViewSpec
|
|
149 |
name: 'Box3'
|
|
150 |
component:
|
|
151 |
(SpecCollection
|
|
152 |
collection: (
|
|
153 |
(LabelSpec
|
|
154 |
label: 'Versions:'
|
|
155 |
name: 'Label2'
|
|
156 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0)
|
|
157 |
translateLabel: true
|
|
158 |
adjust: left
|
|
159 |
)
|
|
160 |
(VariableVerticalPanelSpec
|
|
161 |
name: 'VariableVerticalPanel1'
|
|
162 |
layout: (LayoutFrame 0 0 30 0 0 1 0 1)
|
|
163 |
component:
|
|
164 |
(SpecCollection
|
|
165 |
collection: (
|
|
166 |
(SequenceViewSpec
|
|
167 |
name: 'VersionsList'
|
|
168 |
model: selectedVersionHolder
|
7028
|
169 |
menu: versionsListMenu
|
7006
|
170 |
hasHorizontalScrollBar: true
|
|
171 |
hasVerticalScrollBar: true
|
7028
|
172 |
valueChangeSelector: versionSelectionChanged
|
7006
|
173 |
useIndex: true
|
|
174 |
sequenceList: versionsList
|
|
175 |
)
|
|
176 |
(ViewSpec
|
|
177 |
name: 'Box2'
|
|
178 |
component:
|
|
179 |
(SpecCollection
|
|
180 |
collection: (
|
|
181 |
(LabelSpec
|
|
182 |
label: 'Comment:'
|
|
183 |
name: 'Label3'
|
|
184 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0)
|
|
185 |
translateLabel: true
|
|
186 |
adjust: left
|
|
187 |
)
|
|
188 |
(TextEditorSpec
|
|
189 |
name: 'CommentTextEditor'
|
|
190 |
layout: (LayoutFrame 0 0 30 0 0 1 -1 1)
|
|
191 |
model: commentTextHolder
|
|
192 |
hasHorizontalScrollBar: true
|
|
193 |
hasVerticalScrollBar: true
|
|
194 |
)
|
|
195 |
)
|
|
196 |
|
|
197 |
)
|
|
198 |
)
|
|
199 |
)
|
|
200 |
|
|
201 |
)
|
|
202 |
handles: (Any 0.5 1.0)
|
|
203 |
)
|
|
204 |
)
|
|
205 |
|
|
206 |
)
|
|
207 |
)
|
|
208 |
)
|
|
209 |
|
|
210 |
)
|
|
211 |
handles: (Any 0.5 1.0)
|
|
212 |
)
|
|
213 |
(LabelSpec
|
|
214 |
name: 'InfoLabel'
|
|
215 |
layout: (LayoutFrame 2 0 -28 1 -1 1 -1 1)
|
|
216 |
level: -1
|
|
217 |
translateLabel: true
|
|
218 |
labelChannel: infoLabelHolder
|
|
219 |
adjust: left
|
|
220 |
)
|
|
221 |
)
|
|
222 |
|
|
223 |
)
|
|
224 |
)
|
|
225 |
! !
|
|
226 |
|
|
227 |
!StoreProjectBrowser class methodsFor:'internationalization'!
|
|
228 |
|
|
229 |
resourcePackName
|
|
230 |
^ 'StoreProjectBrowser'
|
|
231 |
! !
|
|
232 |
|
|
233 |
!StoreProjectBrowser class methodsFor:'menu specs'!
|
|
234 |
|
|
235 |
mainMenu
|
|
236 |
"This resource specification was automatically generated
|
|
237 |
by the MenuEditor of ST/X."
|
|
238 |
|
|
239 |
"Do not manually edit this!! If it is corrupted,
|
|
240 |
the MenuEditor may not be able to read the specification."
|
|
241 |
|
|
242 |
"
|
|
243 |
MenuEditor new openOnClass:Tools::StoreProjectBrowser andSelector:#mainMenu
|
|
244 |
(Menu new fromLiteralArrayEncoding:(Tools::StoreProjectBrowser mainMenu)) startUp
|
|
245 |
"
|
|
246 |
|
|
247 |
<resource: #menu>
|
|
248 |
|
|
249 |
^
|
|
250 |
#(Menu
|
|
251 |
(
|
|
252 |
(MenuItem
|
|
253 |
label: 'File'
|
|
254 |
translateLabel: true
|
|
255 |
submenu:
|
|
256 |
(Menu
|
|
257 |
(
|
|
258 |
(MenuItem
|
|
259 |
label: 'Fileout As...'
|
|
260 |
itemValue: menuFileoutAs
|
|
261 |
translateLabel: true
|
|
262 |
)
|
|
263 |
(MenuItem
|
|
264 |
label: '-'
|
|
265 |
)
|
|
266 |
(MenuItem
|
|
267 |
label: 'Update'
|
|
268 |
itemValue: menuUpdate
|
|
269 |
translateLabel: true
|
|
270 |
)
|
|
271 |
(MenuItem
|
|
272 |
label: '-'
|
|
273 |
)
|
|
274 |
(MenuItem
|
|
275 |
label: 'Exit'
|
|
276 |
itemValue: closeRequest
|
|
277 |
translateLabel: true
|
|
278 |
)
|
|
279 |
)
|
|
280 |
nil
|
|
281 |
nil
|
|
282 |
)
|
|
283 |
)
|
|
284 |
(MenuItem
|
7010
|
285 |
label: 'Connection'
|
|
286 |
translateLabel: true
|
|
287 |
submenu:
|
|
288 |
(Menu
|
|
289 |
(
|
|
290 |
(MenuItem
|
|
291 |
label: 'Connect'
|
|
292 |
itemValue: menuConnect
|
|
293 |
translateLabel: true
|
|
294 |
isVisible: notConnectedHolder
|
|
295 |
)
|
|
296 |
(MenuItem
|
|
297 |
label: 'Disconnect'
|
|
298 |
itemValue: menuDisconnect
|
|
299 |
translateLabel: true
|
|
300 |
isVisible: isConnectedHolder
|
|
301 |
)
|
|
302 |
)
|
|
303 |
nil
|
|
304 |
nil
|
|
305 |
)
|
|
306 |
)
|
|
307 |
(MenuItem
|
7006
|
308 |
label: 'Help'
|
|
309 |
translateLabel: true
|
|
310 |
startGroup: right
|
|
311 |
submenu:
|
|
312 |
(Menu
|
|
313 |
(
|
|
314 |
(MenuItem
|
|
315 |
label: 'Documentation'
|
|
316 |
itemValue: openDocumentation
|
|
317 |
translateLabel: true
|
|
318 |
)
|
|
319 |
(MenuItem
|
|
320 |
label: '-'
|
|
321 |
)
|
|
322 |
(MenuItem
|
|
323 |
label: 'About this Application...'
|
|
324 |
itemValue: openAboutThisApplication
|
|
325 |
translateLabel: true
|
|
326 |
)
|
|
327 |
)
|
|
328 |
nil
|
|
329 |
nil
|
|
330 |
)
|
|
331 |
)
|
|
332 |
)
|
|
333 |
nil
|
|
334 |
nil
|
|
335 |
)
|
7028
|
336 |
!
|
|
337 |
|
|
338 |
packageListMenu
|
|
339 |
"This resource specification was automatically generated
|
|
340 |
by the MenuEditor of ST/X."
|
|
341 |
|
|
342 |
"Do not manually edit this!! If it is corrupted,
|
|
343 |
the MenuEditor may not be able to read the specification."
|
|
344 |
|
|
345 |
"
|
|
346 |
MenuEditor new openOnClass:Tools::StoreProjectBrowser andSelector:#packageListMenu
|
|
347 |
(Menu new fromLiteralArrayEncoding:(Tools::StoreProjectBrowser packageListMenu)) startUp
|
|
348 |
"
|
|
349 |
|
|
350 |
<resource: #menu>
|
|
351 |
|
|
352 |
^
|
|
353 |
#(Menu
|
|
354 |
(
|
|
355 |
(MenuItem
|
|
356 |
label: 'Update'
|
|
357 |
itemValue: menuUpdatePackageList
|
|
358 |
translateLabel: true
|
|
359 |
)
|
|
360 |
)
|
|
361 |
nil
|
|
362 |
nil
|
|
363 |
)
|
|
364 |
!
|
|
365 |
|
|
366 |
versionsListMenu
|
|
367 |
"This resource specification was automatically generated
|
|
368 |
by the MenuEditor of ST/X."
|
|
369 |
|
|
370 |
"Do not manually edit this!! If it is corrupted,
|
|
371 |
the MenuEditor may not be able to read the specification."
|
|
372 |
|
|
373 |
"
|
|
374 |
MenuEditor new openOnClass:Tools::StoreProjectBrowser andSelector:#versionsListMenu
|
|
375 |
(Menu new fromLiteralArrayEncoding:(Tools::StoreProjectBrowser versionsListMenu)) startUp
|
|
376 |
"
|
|
377 |
|
|
378 |
<resource: #menu>
|
|
379 |
|
|
380 |
^
|
|
381 |
#(Menu
|
|
382 |
(
|
|
383 |
(MenuItem
|
|
384 |
label: 'Load'
|
|
385 |
itemValue: versionsListMenuLoad
|
|
386 |
translateLabel: true
|
|
387 |
)
|
|
388 |
(MenuItem
|
|
389 |
label: '-'
|
|
390 |
)
|
|
391 |
(MenuItem
|
|
392 |
label: 'Update'
|
|
393 |
itemValue: versionsListMenuUpdate
|
|
394 |
translateLabel: true
|
|
395 |
)
|
|
396 |
)
|
|
397 |
nil
|
|
398 |
nil
|
|
399 |
)
|
7006
|
400 |
! !
|
|
401 |
|
|
402 |
!StoreProjectBrowser class methodsFor:'startup'!
|
|
403 |
|
|
404 |
openOn:aDBInfo
|
|
405 |
|newApp|
|
|
406 |
|
|
407 |
newApp := self new.
|
|
408 |
newApp allButOpen.
|
|
409 |
newApp dbInfo:aDBInfo.
|
|
410 |
newApp open.
|
|
411 |
^ newApp
|
|
412 |
! !
|
|
413 |
|
7008
|
414 |
!StoreProjectBrowser methodsFor:'actions'!
|
|
415 |
|
|
416 |
packageSelectionChanged
|
7009
|
417 |
|newest|
|
7008
|
418 |
|
7010
|
419 |
self withReadCursorDo:[
|
|
420 |
selectedBundleOrPackage := packagesList value at:(selectedPackageHolder value).
|
|
421 |
self updateVersionsListFor:selectedBundleOrPackage.
|
7008
|
422 |
|
7028
|
423 |
versionsList value notEmptyOrNil ifTrue:[
|
7010
|
424 |
newest := versionsList value first.
|
|
425 |
self updateCommentFor:newest
|
|
426 |
]
|
7008
|
427 |
].
|
|
428 |
!
|
|
429 |
|
|
430 |
versionSelectionChanged
|
7010
|
431 |
|selIndex selectedItem|
|
7008
|
432 |
|
7010
|
433 |
selIndex := selectedVersionHolder value.
|
|
434 |
selIndex isNil ifTrue:[
|
|
435 |
self commentTextHolder value:nil
|
|
436 |
] ifFalse:[
|
|
437 |
selectedItem := versionsList value at:selIndex.
|
|
438 |
self withReadCursorDo:[
|
|
439 |
self updateBlessingCommentFor:selectedItem
|
|
440 |
].
|
|
441 |
]
|
7008
|
442 |
! !
|
|
443 |
|
7006
|
444 |
!StoreProjectBrowser methodsFor:'aspects'!
|
|
445 |
|
|
446 |
commentTextHolder
|
|
447 |
"automatically generated by UIPainter ..."
|
|
448 |
|
|
449 |
"*** the code below creates a default model when invoked."
|
|
450 |
"*** (which may not be the one you wanted)"
|
|
451 |
"*** Please change as required and accept it in the browser."
|
|
452 |
"*** (and replace this comment by something more useful ;-)"
|
|
453 |
|
|
454 |
commentTextHolder isNil ifTrue:[
|
|
455 |
commentTextHolder := '' asValue.
|
|
456 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
457 |
"/ commentTextHolder addDependent:self.
|
|
458 |
"/ commentTextHolder onChangeSend:#commentTextHolderChanged to:self.
|
|
459 |
].
|
|
460 |
^ commentTextHolder.
|
|
461 |
!
|
|
462 |
|
|
463 |
infoLabelHolder
|
|
464 |
"automatically generated by UIPainter ..."
|
|
465 |
|
|
466 |
"*** the code below creates a default model when invoked."
|
|
467 |
"*** (which may not be the one you wanted)"
|
|
468 |
"*** Please change as required and accept it in the browser."
|
|
469 |
"*** (and replace this comment by something more useful ;-)"
|
|
470 |
|
|
471 |
infoLabelHolder isNil ifTrue:[
|
|
472 |
infoLabelHolder := ValueHolder new.
|
|
473 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
474 |
"/ infoLabelHolder addDependent:self.
|
|
475 |
"/ infoLabelHolder onChangeSend:#infoLabelHolderChanged to:self.
|
|
476 |
].
|
|
477 |
^ infoLabelHolder.
|
|
478 |
!
|
|
479 |
|
7010
|
480 |
isConnected
|
|
481 |
^ connection notNil and:[ connection isConnected ].
|
|
482 |
!
|
|
483 |
|
|
484 |
isConnectedHolder
|
|
485 |
^ [ self isConnected ]
|
|
486 |
!
|
|
487 |
|
|
488 |
notConnectedHolder
|
|
489 |
^ [ self isConnected not ]
|
|
490 |
!
|
|
491 |
|
7006
|
492 |
packagesFilterHolder
|
|
493 |
"automatically generated by UIPainter ..."
|
|
494 |
|
|
495 |
"*** the code below creates a default model when invoked."
|
|
496 |
"*** (which may not be the one you wanted)"
|
|
497 |
"*** Please change as required and accept it in the browser."
|
|
498 |
"*** (and replace this comment by something more useful ;-)"
|
|
499 |
|
|
500 |
packagesFilterHolder isNil ifTrue:[
|
|
501 |
packagesFilterHolder := ValueHolder new.
|
|
502 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
503 |
"/ packagesFilterHolder addDependent:self.
|
|
504 |
"/ packagesFilterHolder onChangeSend:#packagesFilterHolderChanged to:self.
|
|
505 |
].
|
|
506 |
^ packagesFilterHolder.
|
|
507 |
!
|
|
508 |
|
|
509 |
packagesList
|
|
510 |
"automatically generated by UIPainter ..."
|
|
511 |
|
|
512 |
"*** the code below creates a default model when invoked."
|
|
513 |
"*** (which may not be the one you wanted)"
|
|
514 |
"*** Please change as required and accept it in the browser."
|
|
515 |
"*** (and replace this comment by something more useful ;-)"
|
|
516 |
|
|
517 |
packagesList isNil ifTrue:[
|
|
518 |
packagesList := ValueHolder new.
|
|
519 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
520 |
"/ packagesList addDependent:self.
|
|
521 |
"/ packagesList onChangeSend:#packagesListChanged to:self.
|
|
522 |
].
|
|
523 |
^ packagesList.
|
|
524 |
!
|
|
525 |
|
|
526 |
selectedPackageHolder
|
|
527 |
"automatically generated by UIPainter ..."
|
|
528 |
|
|
529 |
"*** the code below creates a default model when invoked."
|
|
530 |
"*** (which may not be the one you wanted)"
|
|
531 |
"*** Please change as required and accept it in the browser."
|
|
532 |
"*** (and replace this comment by something more useful ;-)"
|
|
533 |
|
|
534 |
selectedPackageHolder isNil ifTrue:[
|
|
535 |
selectedPackageHolder := ValueHolder new.
|
|
536 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
537 |
"/ selectedPackageHolder addDependent:self.
|
|
538 |
"/ selectedPackageHolder onChangeSend:#selectedPackageHolderChanged to:self.
|
|
539 |
].
|
|
540 |
^ selectedPackageHolder.
|
|
541 |
!
|
|
542 |
|
|
543 |
selectedVersionHolder
|
|
544 |
"automatically generated by UIPainter ..."
|
|
545 |
|
|
546 |
"*** the code below creates a default model when invoked."
|
|
547 |
"*** (which may not be the one you wanted)"
|
|
548 |
"*** Please change as required and accept it in the browser."
|
|
549 |
"*** (and replace this comment by something more useful ;-)"
|
|
550 |
|
|
551 |
selectedVersionHolder isNil ifTrue:[
|
|
552 |
selectedVersionHolder := ValueHolder new.
|
|
553 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
554 |
"/ selectedVersionHolder addDependent:self.
|
|
555 |
"/ selectedVersionHolder onChangeSend:#selectedVersionHolderChanged to:self.
|
|
556 |
].
|
|
557 |
^ selectedVersionHolder.
|
|
558 |
!
|
|
559 |
|
|
560 |
versionsList
|
|
561 |
"automatically generated by UIPainter ..."
|
|
562 |
|
|
563 |
"*** the code below creates a default model when invoked."
|
|
564 |
"*** (which may not be the one you wanted)"
|
|
565 |
"*** Please change as required and accept it in the browser."
|
|
566 |
"*** (and replace this comment by something more useful ;-)"
|
|
567 |
|
|
568 |
versionsList isNil ifTrue:[
|
|
569 |
versionsList := ValueHolder new.
|
|
570 |
"/ if your app needs to be notified of changes, uncomment one of the lines below:
|
|
571 |
"/ versionsList addDependent:self.
|
|
572 |
"/ versionsList onChangeSend:#versionsListChanged to:self.
|
|
573 |
].
|
|
574 |
^ versionsList.
|
|
575 |
! !
|
|
576 |
|
|
577 |
!StoreProjectBrowser methodsFor:'db access'!
|
|
578 |
|
7008
|
579 |
getBlob:id
|
|
580 |
|item cursor row blobType blobData|
|
|
581 |
|
|
582 |
item := Set new.
|
|
583 |
cursor := connection
|
|
584 |
execute:'SELECT blobtype,blobdata FROM tw_blob where primarykey = ',id printString,';'
|
|
585 |
release:false.
|
|
586 |
|
|
587 |
cursor next notNil ifTrue:[
|
|
588 |
row := cursor rowAsArray.
|
|
589 |
blobType := (row at:1).
|
|
590 |
blobData := Base64Coder decode:(row at:2).
|
|
591 |
].
|
|
592 |
cursor release.
|
|
593 |
|
|
594 |
blobType == 1 ifTrue:[
|
|
595 |
"binary"
|
|
596 |
^ blobData
|
|
597 |
].
|
|
598 |
blobType == 2 ifTrue:[
|
|
599 |
"string"
|
|
600 |
^ blobData asString
|
|
601 |
].
|
|
602 |
blobType == 3 ifTrue:[
|
|
603 |
"2-byte string"
|
|
604 |
self halt.
|
|
605 |
^ nil
|
|
606 |
].
|
|
607 |
self halt.
|
|
608 |
^ nil
|
|
609 |
!
|
|
610 |
|
|
611 |
getBundles
|
|
612 |
|items cursor row|
|
|
613 |
|
|
614 |
items := Set new.
|
|
615 |
cursor := connection
|
|
616 |
execute:'SELECT DISTINCT name FROM tw_bundle;'
|
|
617 |
release:false.
|
|
618 |
|
|
619 |
[cursor next notNil] whileTrue:[
|
|
620 |
row := cursor rowAsArray.
|
|
621 |
Transcript showCR:row.
|
|
622 |
items add:(Bundle new name:(row at:1)).
|
|
623 |
].
|
|
624 |
cursor release.
|
|
625 |
^ items asOrderedCollection sort:[:a :b| a name < b name]
|
|
626 |
!
|
|
627 |
|
7010
|
628 |
getConnection
|
|
629 |
|session|
|
|
630 |
|
7028
|
631 |
dbInfo isNil ifTrue:[
|
|
632 |
self askForDatabaseInfo
|
|
633 |
].
|
|
634 |
|
7010
|
635 |
session := SQL::ODBCSession new.
|
|
636 |
session
|
|
637 |
connectWithUsername:(dbInfo userName)
|
|
638 |
password:(dbInfo password)
|
|
639 |
dbname:(dbInfo dbName).
|
|
640 |
|
|
641 |
(session isConnected) ifFalse:[
|
|
642 |
^ nil.
|
|
643 |
].
|
|
644 |
^ session.
|
|
645 |
!
|
|
646 |
|
7008
|
647 |
getPackages
|
|
648 |
|items cursor row|
|
|
649 |
|
|
650 |
items := Set new.
|
|
651 |
cursor := connection
|
|
652 |
execute:'SELECT DISTINCT name FROM tw_package;'
|
|
653 |
release:false.
|
|
654 |
|
|
655 |
[cursor next notNil] whileTrue:[
|
|
656 |
row := cursor rowAsArray.
|
|
657 |
Transcript showCR:row.
|
|
658 |
items add:(Package new name:(row at:1)).
|
|
659 |
].
|
|
660 |
cursor release.
|
|
661 |
^ items asOrderedCollection sort:[:a :b| a name < b name]
|
|
662 |
!
|
|
663 |
|
|
664 |
getVersionsForBundle:aBundle
|
7010
|
665 |
^ self getVersionsForBundleOrPackage:aBundle isBundle:true
|
|
666 |
!
|
|
667 |
|
|
668 |
getVersionsForBundleOrPackage:aBundle isBundle:isBundle
|
|
669 |
|items cursor row table|
|
7008
|
670 |
|
7028
|
671 |
connection isNil ifTrue:[^ #() ].
|
7008
|
672 |
|
7010
|
673 |
table := isBundle ifTrue:'tw_bundle' ifFalse:'tw_package'.
|
|
674 |
|
7008
|
675 |
items := Set new.
|
|
676 |
cursor := connection
|
7009
|
677 |
execute:'SELECT version,username,timestamp,commentid,primarykey
|
7010
|
678 |
FROM ',table,' WHERE name = ''',aBundle name,''';'
|
7008
|
679 |
release:false.
|
|
680 |
|
|
681 |
[cursor next notNil] whileTrue:[
|
|
682 |
|v|
|
|
683 |
|
|
684 |
row := cursor rowAsArray.
|
|
685 |
Transcript showCR:row.
|
|
686 |
v := PundleVersion new.
|
|
687 |
v pundle:aBundle version:(row at:1) user:(row at:2).
|
|
688 |
v timestampInt:(row at:3) commentId:(row at:4).
|
7009
|
689 |
v id:(row at:5).
|
7010
|
690 |
v isBundle:isBundle.
|
7008
|
691 |
items add:v.
|
|
692 |
].
|
|
693 |
cursor release.
|
|
694 |
^ items asOrderedCollection sort:[:a :b| a isVersionAfter: b]
|
|
695 |
!
|
|
696 |
|
|
697 |
getVersionsForPackage:aPackage
|
7010
|
698 |
^ self getVersionsForBundleOrPackage:aPackage isBundle:false
|
7008
|
699 |
!
|
|
700 |
|
7009
|
701 |
updateBlessingCommentFor:aPundleVersion
|
7010
|
702 |
|versionId commentId user comment cursor row recType|
|
7009
|
703 |
|
|
704 |
versionId := aPundleVersion id.
|
7010
|
705 |
recType := aPundleVersion isBundle ifTrue:'B' ifFalse:'P'.
|
7009
|
706 |
|
|
707 |
cursor := connection
|
7010
|
708 |
execute:'SELECT username,commentid FROM tw_blessing
|
|
709 |
WHERE pkgid = ',versionId printString,' AND rectype = ''',recType,''';'
|
7009
|
710 |
release:false.
|
7010
|
711 |
cursor isNil ifTrue:[
|
|
712 |
commentId :=0
|
|
713 |
] ifFalse:[
|
|
714 |
row := cursor next rowAsArray.
|
|
715 |
cursor release.
|
7009
|
716 |
|
7010
|
717 |
user := row at:1.
|
|
718 |
commentId := row at:2.
|
|
719 |
].
|
7009
|
720 |
|
|
721 |
commentId == 0 ifTrue:[
|
|
722 |
comment := 'No comment' allItalic
|
|
723 |
] ifFalse:[
|
|
724 |
comment := self getBlob:commentId.
|
7010
|
725 |
comment := comment asCollectionOfSubCollectionsSeparatedBy:Character return.
|
|
726 |
comment := comment asStringCollection asString.
|
7009
|
727 |
].
|
|
728 |
self commentTextHolder value:comment.
|
|
729 |
!
|
|
730 |
|
7008
|
731 |
updateCommentFor:aPundleVersion
|
7009
|
732 |
|comment id|
|
7008
|
733 |
|
7009
|
734 |
id := aPundleVersion commentId.
|
|
735 |
id == 0 ifTrue:[
|
|
736 |
comment := 'No comment' allItalic
|
|
737 |
] ifFalse:[
|
|
738 |
comment := self getBlob:(aPundleVersion commentId).
|
|
739 |
].
|
7008
|
740 |
self commentTextHolder value:comment.
|
|
741 |
!
|
|
742 |
|
7006
|
743 |
updatePackagesList
|
7008
|
744 |
|bundles packages|
|
|
745 |
|
|
746 |
connection isNil ifTrue:[^ self ].
|
|
747 |
|
|
748 |
self withReadCursorDo:[
|
|
749 |
bundles := self getBundles.
|
|
750 |
packages := self getPackages.
|
|
751 |
].
|
|
752 |
packagesList value:(bundles , packages).
|
|
753 |
!
|
|
754 |
|
|
755 |
updateVersionsListFor:aBundleOrPackage
|
|
756 |
|items|
|
|
757 |
|
7010
|
758 |
aBundleOrPackage isBundle ifTrue:[
|
|
759 |
items := self getVersionsForBundle:aBundleOrPackage
|
|
760 |
] ifFalse:[
|
|
761 |
items := self getVersionsForPackage:aBundleOrPackage
|
7008
|
762 |
].
|
7010
|
763 |
self selectedVersionHolder value:nil.
|
7008
|
764 |
versionsList value:items.
|
7006
|
765 |
! !
|
|
766 |
|
|
767 |
!StoreProjectBrowser methodsFor:'help'!
|
|
768 |
|
|
769 |
aboutThisApplicationText
|
|
770 |
^ super aboutThisApplicationText ,
|
|
771 |
'\\Written by Claus Gittinger, eXept Software AG.' withCRs
|
|
772 |
! !
|
|
773 |
|
|
774 |
!StoreProjectBrowser methodsFor:'initialization & release'!
|
|
775 |
|
|
776 |
dbInfo:aDBInfo
|
|
777 |
|session|
|
|
778 |
|
7010
|
779 |
dbInfo := aDBInfo.
|
|
780 |
session := self getConnection.
|
|
781 |
(session notNil) ifFalse:[
|
7006
|
782 |
^ self.
|
|
783 |
].
|
|
784 |
connection := session.
|
7028
|
785 |
self updateInfo.
|
7006
|
786 |
^ self
|
|
787 |
!
|
|
788 |
|
7008
|
789 |
postOpenWith:aBuilder
|
8727
|
790 |
super postOpenWith:aBuilder.
|
7006
|
791 |
self updatePackagesList.
|
|
792 |
!
|
|
793 |
|
|
794 |
release
|
|
795 |
connection notNil ifTrue:[
|
|
796 |
connection disconnect.
|
|
797 |
connection := nil.
|
|
798 |
]
|
7028
|
799 |
!
|
|
800 |
|
|
801 |
updateInfo
|
|
802 |
self isConnected ifTrue:[
|
|
803 |
self window label:('Store Browser: ',dbInfo dbName).
|
|
804 |
self infoLabelHolder value:('Connected to ',dbInfo dbName).
|
|
805 |
] ifFalse:[
|
|
806 |
self window label:'Store Browser'.
|
|
807 |
self infoLabelHolder value:nil.
|
|
808 |
]
|
7006
|
809 |
! !
|
|
810 |
|
|
811 |
!StoreProjectBrowser methodsFor:'menu actions'!
|
|
812 |
|
7028
|
813 |
askForDatabaseInfo
|
|
814 |
|defaultInfo|
|
|
815 |
|
|
816 |
defaultInfo := StoreSourceCodeManager defaultDBInfo.
|
|
817 |
defaultInfo dbName isNil ifTrue:[
|
8727
|
818 |
defaultInfo := StoreSourceCodeManager repositoryInfoPerModule firstIfEmpty:nil.
|
7028
|
819 |
].
|
|
820 |
dbInfo := defaultInfo
|
|
821 |
!
|
|
822 |
|
7010
|
823 |
menuConnect
|
|
824 |
|session|
|
|
825 |
|
|
826 |
connection isNil ifTrue:[
|
|
827 |
session := self getConnection.
|
|
828 |
(session notNil) ifFalse:[
|
|
829 |
^ self.
|
|
830 |
].
|
|
831 |
connection := session.
|
7028
|
832 |
self updateInfo.
|
8727
|
833 |
self updatePackagesList.
|
7010
|
834 |
]
|
|
835 |
!
|
|
836 |
|
|
837 |
menuDisconnect
|
|
838 |
connection notNil ifTrue:[
|
|
839 |
connection disconnect.
|
|
840 |
connection := nil.
|
7028
|
841 |
self updateInfo.
|
7010
|
842 |
]
|
|
843 |
!
|
|
844 |
|
7006
|
845 |
menuFileoutAs
|
|
846 |
"automatically generated by UIPainter ..."
|
|
847 |
|
|
848 |
"*** the code below performs no action"
|
|
849 |
"*** (except for some feedback on the Transcript)"
|
|
850 |
"*** Please change as required and accept in the browser."
|
|
851 |
|
|
852 |
"action to be added ..."
|
|
853 |
|
|
854 |
Transcript showCR:self class name, ': menu action for menuFileoutAs ...'.
|
|
855 |
!
|
|
856 |
|
|
857 |
menuOpen
|
|
858 |
"This method was generated by the Browser.
|
|
859 |
It will be invoked when the menu-item 'open' is selected."
|
|
860 |
|
|
861 |
"/ change below and add any actions as required here ...
|
|
862 |
self warn:'no action for ''open'' available.'.
|
|
863 |
!
|
|
864 |
|
|
865 |
menuUpdate
|
|
866 |
self updatePackagesList
|
|
867 |
!
|
|
868 |
|
|
869 |
openDocumentation
|
|
870 |
"This method was generated by the Browser.
|
|
871 |
It will be invoked when the menu-item 'help-documentation' is selected."
|
|
872 |
|
|
873 |
"/ change below as required ...
|
|
874 |
|
|
875 |
"/ to open an HTML viewer on some document (under 'doc/online/<language>/' ):
|
|
876 |
HTMLDocumentView openFullOnDocumentationFile:'TOP.html'.
|
|
877 |
|
|
878 |
"/ add application-specific help files under the 'doc/online/<language>/help/appName'
|
|
879 |
"/ directory, and open a viewer with:
|
|
880 |
"/ HTMLDocumentView openFullOnDocumentationFile:'help/<MyApplication>/TOP.html'.
|
|
881 |
! !
|
|
882 |
|
7008
|
883 |
!StoreProjectBrowser::Pundle methodsFor:'accessing'!
|
|
884 |
|
|
885 |
name
|
|
886 |
^ name
|
|
887 |
!
|
|
888 |
|
|
889 |
name:something
|
|
890 |
name := something.
|
|
891 |
! !
|
|
892 |
|
|
893 |
!StoreProjectBrowser::Pundle methodsFor:'printing'!
|
|
894 |
|
|
895 |
displayString
|
|
896 |
^ name
|
|
897 |
! !
|
|
898 |
|
|
899 |
!StoreProjectBrowser::Pundle methodsFor:'testing'!
|
|
900 |
|
|
901 |
isBundle
|
|
902 |
^ false
|
|
903 |
!
|
|
904 |
|
|
905 |
isPackage
|
|
906 |
^ false
|
|
907 |
! !
|
|
908 |
|
|
909 |
!StoreProjectBrowser::Package methodsFor:'testing'!
|
|
910 |
|
|
911 |
isPackage
|
|
912 |
^ true
|
|
913 |
! !
|
|
914 |
|
|
915 |
!StoreProjectBrowser::Bundle methodsFor:'printing'!
|
|
916 |
|
|
917 |
displayString
|
|
918 |
^ name ,' (Bundle)'
|
|
919 |
! !
|
|
920 |
|
|
921 |
!StoreProjectBrowser::Bundle methodsFor:'testing'!
|
|
922 |
|
|
923 |
isBundle
|
|
924 |
^ true
|
|
925 |
! !
|
|
926 |
|
|
927 |
!StoreProjectBrowser::PundleVersion methodsFor:'accessing'!
|
|
928 |
|
|
929 |
commentId
|
|
930 |
^ commentId
|
|
931 |
!
|
|
932 |
|
|
933 |
id
|
|
934 |
^ id
|
|
935 |
!
|
|
936 |
|
|
937 |
id:something
|
|
938 |
id := something.
|
|
939 |
!
|
|
940 |
|
7010
|
941 |
isBundle
|
|
942 |
^ isBundle
|
|
943 |
!
|
|
944 |
|
|
945 |
isBundle:aBoolean
|
|
946 |
isBundle := aBoolean
|
|
947 |
!
|
|
948 |
|
|
949 |
isPackage
|
|
950 |
^ isBundle not
|
|
951 |
!
|
|
952 |
|
7008
|
953 |
pundle
|
|
954 |
^ pundle
|
|
955 |
!
|
|
956 |
|
|
957 |
pundle:pundleArg version:versionArg user:userArg
|
|
958 |
pundle := pundleArg.
|
|
959 |
version := versionArg.
|
|
960 |
user := userArg.
|
|
961 |
!
|
|
962 |
|
|
963 |
timestamp
|
|
964 |
|deltaSeconds|
|
|
965 |
|
|
966 |
timestamp isNil ifTrue:[
|
|
967 |
"/ to compute the timestamp, we have to do this:
|
|
968 |
"/ the timestampInt are seconds since 1993 + 10d + 19min + 47sec"
|
|
969 |
"/ can anyone explain this ????
|
|
970 |
deltaSeconds := 23*365 * 24*60*60. "/ 23 years
|
|
971 |
deltaSeconds := deltaSeconds + (233*24*60*60). "/ 10 days
|
|
972 |
deltaSeconds := deltaSeconds + (19*60). "/ 19 minutes
|
|
973 |
deltaSeconds := deltaSeconds + (47). "/ 47 seconds
|
|
974 |
|
|
975 |
timestamp := Timestamp secondsSince1970:(timestampInt + deltaSeconds).
|
|
976 |
].
|
|
977 |
^ timestamp
|
|
978 |
!
|
|
979 |
|
|
980 |
timestampInt:timestampIntArg commentId:commentIdArg
|
|
981 |
timestampInt := timestampIntArg.
|
|
982 |
commentId := commentIdArg.
|
|
983 |
!
|
|
984 |
|
|
985 |
user
|
|
986 |
^ user
|
|
987 |
!
|
|
988 |
|
|
989 |
version
|
|
990 |
^ version
|
|
991 |
! !
|
|
992 |
|
|
993 |
!StoreProjectBrowser::PundleVersion methodsFor:'comparing'!
|
|
994 |
|
|
995 |
isVersionAfter:anotherVersion
|
|
996 |
|myMajor othersMajor myMinor othersMinor|
|
|
997 |
|
|
998 |
myMajor := self majorVersion.
|
|
999 |
othersMajor := anotherVersion majorVersion.
|
|
1000 |
|
|
1001 |
myMajor > othersMajor ifTrue:[^ true].
|
|
1002 |
myMajor < othersMajor ifTrue:[^ false].
|
|
1003 |
|
|
1004 |
myMinor := self minorVersion.
|
|
1005 |
othersMinor := anotherVersion minorVersion.
|
|
1006 |
|
|
1007 |
myMinor > othersMinor ifTrue:[^ true].
|
|
1008 |
myMinor < othersMinor ifTrue:[^ false].
|
|
1009 |
|
|
1010 |
^ version > anotherVersion version
|
|
1011 |
!
|
|
1012 |
|
|
1013 |
majorVersion
|
|
1014 |
^ Integer readFrom:(version upTo:$:)
|
|
1015 |
!
|
|
1016 |
|
|
1017 |
minorVersion
|
|
1018 |
^ Integer readFrom:((version restAfter:$.) upTo:$.)
|
|
1019 |
! !
|
|
1020 |
|
|
1021 |
!StoreProjectBrowser::PundleVersion methodsFor:'printing'!
|
|
1022 |
|
|
1023 |
displayString
|
|
1024 |
^ version , ' (',user,') ' , self timestamp printString
|
|
1025 |
! !
|
|
1026 |
|
7006
|
1027 |
!StoreProjectBrowser class methodsFor:'documentation'!
|
|
1028 |
|
|
1029 |
version
|
8727
|
1030 |
^ '$Header: /cvs/stx/stx/libtool/Tools__StoreProjectBrowser.st,v 1.9 2009-09-19 14:50:15 cg Exp $'
|
7006
|
1031 |
! !
|