136 |
134 |
137 modified := aBoolean |
135 modified := aBoolean |
138 ! |
136 ! |
139 |
137 |
140 specClass |
138 specClass |
141 "get the class where the resource spec is implemented" |
139 "returns the class where the resource spec is implemented" |
142 |
140 |
143 ^specClass |
141 ^specClass |
144 ! |
142 ! |
145 |
143 |
146 specClass:aClass |
144 specClass:aClass |
147 "set the class (or name) where the resource spec is (or should be) implemented" |
145 "sets the class (or name) where the resource spec is (or should be) implemented" |
148 |
146 |
149 aClass isBehavior ifTrue:[specClass := aClass name] |
147 aClass isBehavior ifTrue:[specClass := aClass name] |
150 ifFalse:[specClass := aClass] |
148 ifFalse:[specClass := aClass] |
151 ! |
149 ! |
152 |
150 |
153 specSelector |
151 specSelector |
154 "get the method selector of the resource spec" |
152 "returns the method selector of the resource spec" |
155 |
153 |
156 ^specSelector |
154 ^specSelector |
157 |
155 |
158 ! |
156 ! |
159 |
157 |
160 specSelector:aSelector |
158 specSelector:aSelector |
161 "set the method selector of the resource spec" |
159 "sets the method selector of the resource spec" |
162 |
160 |
163 specSelector := aSelector |
161 specSelector := aSelector |
164 ! ! |
162 ! ! |
165 |
163 |
166 !ResourceSpecEditor methodsFor:'aspects'! |
164 !ResourceSpecEditor methodsFor:'aspects'! |
167 |
165 |
168 aspectFor:aKey |
166 aspectFor:aKey |
169 "get the aspect for a aKey or nil" |
167 "returns the aspect for a aKey or nil" |
170 |
168 |
171 ^aspects at: aKey ifAbsent: [super aspectFor:aKey] |
169 ^aspects at: aKey ifAbsent: [super aspectFor:aKey] |
172 |
170 |
173 ! |
171 ! |
174 |
172 |
175 tabModel |
173 tabModel |
176 "get the value holder for the tab selection" |
174 "returns the value holder for the tab selection" |
177 |
175 |
178 |holder| |
176 |holder| |
179 (holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
177 (holder := builder bindingAt:#tabModel) isNil ifTrue:[ |
180 holder := AspectAdaptor new subject:self; forAspect:#tabSelection. |
178 holder := AspectAdaptor new subject:self; forAspect:#tabSelection. |
181 builder aspectAt:#tabModel put:holder. |
179 builder aspectAt:#tabModel put:holder. |
291 ! ! |
289 ! ! |
292 |
290 |
293 !ResourceSpecEditor methodsFor:'private'! |
291 !ResourceSpecEditor methodsFor:'private'! |
294 |
292 |
295 askForItemModification |
293 askForItemModification |
296 "ask for resource item modification" |
294 "asks for resource item modification" |
297 |
295 |
298 self valueOfEnablingCommitButtons value |
296 self valueOfEnablingCommitButtons value |
299 ifTrue: |
297 ifTrue: |
300 [ |
298 [ |
301 ((YesNoBox title:'Resource item was modified!!\Save it?\' withCRs) |
299 ((YesNoBox title:'Resource item was modified!!\Save it?\' withCRs) |
314 ^true |
312 ^true |
315 |
313 |
316 ! |
314 ! |
317 |
315 |
318 askForListModification |
316 askForListModification |
319 "ask for resource modification" |
317 "asks for resource modification" |
320 |
318 |
321 modified |
319 modified |
322 ifTrue: |
320 ifTrue: |
323 [ |
321 [ |
324 ((YesNoBox title: 'List was modified!!') |
322 ((YesNoBox title: self class resourceType asUppercaseFirst, ' spec was modified!!') |
325 noText:'Cancel'; |
323 noText:'Cancel'; |
326 yesText:'Waste it and proceed'; |
324 yesText:'Waste it and proceed'; |
327 showAtPointer; |
325 showAtPointer; |
328 accepted) ifFalse: [^false]. |
326 accepted) ifFalse: [^false]. |
329 modified := false |
327 modified := false |
330 ]. |
328 ]. |
331 ^true |
329 ^true |
332 ! |
330 ! |
333 |
331 |
334 askForModification |
332 askForModification |
335 "ask first for item and then for resource modification" |
333 "asks first for item and then for resource modification" |
336 |
334 |
337 ^self askForItemModification and: [self askForListModification] |
335 ^self askForItemModification and: [self askForListModification] |
338 |
336 |
339 ! |
337 ! |
340 |
338 |
341 resolveClassNamed |
339 resolveClassNamed |
342 "get current class or nil" |
340 "returns current class or nil" |
343 |
341 |
344 ^Smalltalk resolveName:specClass inClass:self class |
342 ^Smalltalk resolveName:specClass inClass:self class |
345 ! |
343 ! |
346 |
344 |
347 resourceMessage: aString |
345 resourceMessage: aString |
348 "extract from aString the specClass and the specSelector" |
346 "extracts from aString the specClass and the specSelector" |
349 |
347 |
350 (aString notNil and: [self askForModification]) |
348 (aString notNil and: [self askForModification]) |
351 ifTrue: |
349 ifTrue: |
352 [ |
350 [ |
353 |msg cls sel| |
351 |msg cls sel| |
495 self valueOfEnablingCommitButtons value: false. |
493 self valueOfEnablingCommitButtons value: false. |
496 modified := true |
494 modified := true |
497 ! |
495 ! |
498 |
496 |
499 doBrowseClass |
497 doBrowseClass |
500 "open a System Browser on the specClass and specSelector" |
498 "opens a System Browser on the specClass and specSelector" |
501 |
499 |
502 |cls| |
500 |cls| |
503 |
501 |
504 (cls := self resolveClassNamed) notNil |
502 (cls := self resolveClassNamed) notNil |
505 ifTrue: [SystemBrowser openInClass:cls class selector: specSelector] |
503 ifTrue: [SystemBrowser openInClass:cls class selector: specSelector] |
506 ifFalse:[self information:'No class defined!!'] |
504 ifFalse:[self information:'No class defined!!'] |
507 ! |
505 ! |
508 |
506 |
509 doEditImage |
507 doEditImage |
510 "open the Image Editor on a resource retriever and icon selector" |
508 "opens a Image Editor on a resource retriever and icon selector" |
511 |
509 |
512 |cls resourceClass resourceSelector imageResourceMessage readStream| |
510 |cls resourceClass resourceSelector imageResourceMessage readStream| |
513 |
511 |
514 cls := self resolveName: specClass. |
512 cls := self resolveName: specClass. |
515 cls isNil ifTrue:[ |
513 cls isNil ifTrue:[ |
534 |
532 |
535 |
533 |
536 ! |
534 ! |
537 |
535 |
538 doLoad |
536 doLoad |
539 "open a Resource Selection Browser in order to get a resource message" |
537 "opens a Resource Selection Browser in order to get a resource message" |
540 |
538 |
541 self loadFromMessage: |
539 self loadFromMessage: |
542 (ResourceSelectionBrowser |
540 (ResourceSelectionBrowser |
543 request: 'Load ', self class resourceType asUppercaseFirst, ' Spec From Class' |
541 request: 'Load ', self class resourceType asUppercaseFirst, ' Spec From Class' |
544 onSuperclass: nil |
542 onSuperclass: nil |