A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-tcj.832.mcz ==================== Summary ==================== Name: Tools-tcj.832 Author: tcj Time: 21 October 2018, 3:50:02.553053 pm UUID: 52acbd13-8832-4974-b7ae-2f0ecfd3b4d7 Ancestors: Tools-cmm.831 Handle case where a minimized project window is deleted (and thus a changeset is removed) while a Simple Change Sorter window is open. Stops a DNU from arising. Perhaps there is a more graceful way to handle this occasion in ChangeSorter>>#update or #updateIfNecessary =============== Diff against Tools-cmm.831 =============== Item was changed: ----- Method: ChangeSorter>>setContents (in category 'code pane') ----- setContents "return the source code that shows in the bottom pane" | sel class strm changeType | self clearUserEditFlag. + myChangeSet ifNil: [^ contents := '']. "should not happen but can" currentClassName ifNil: [^ contents := myChangeSet preambleString ifNil: ['']]. class := self selectedClassOrMetaClass. (sel := self selectedMessageName) == nil ifFalse: [changeType := (myChangeSet atSelector: (sel := sel asSymbol) class: class). changeType == #remove ifTrue: [^ contents := 'Method has been removed (see versions)']. changeType == #addedThenRemoved ifTrue: [^ contents := 'Added then removed (see versions)']. class ifNil: [^ contents := 'Method was added, but cannot be found!!']. (class includesSelector: sel) ifFalse: [^ contents := 'Method was added, but cannot be found!!']. contents := class sourceCodeAt: sel. (#(prettyPrint prettyDiffs) includes: contentsSymbol) ifTrue: [contents := class prettyPrinterClass format: contents in: class notifying: nil]. self showingAnyKindOfDiffs ifTrue: [contents := self diffFromPriorSourceFor: contents]. ^ contents := contents asText makeSelectorBoldIn: class] ifTrue: [strm := WriteStream on: (String new: 100). (myChangeSet classChangeAt: (self withoutItemAnnotation: currentClassName)) do: [:each | each = #remove ifTrue: [strm nextPutAll: 'Entire class was removed.'; cr]. each = #addedThenRemoved ifTrue: [strm nextPutAll: 'Class was added then removed.']. each = #rename ifTrue: [strm nextPutAll: 'Class name was changed.'; cr]. each = #add ifTrue: [strm nextPutAll: 'Class definition was added.'; cr]. each = #change ifTrue: [strm nextPutAll: 'Class definition was changed.'; cr]. each = #reorganize ifTrue: [strm nextPutAll: 'Class organization was changed.'; cr]. each = #comment ifTrue: [strm nextPutAll: 'New class comment.'; cr. ]]. ^ contents := strm contents].! |
Thanks for the fix. I didn't test the condition, but I see no
possible downside to this, and there's already another defensive condition right there. I've loaded the method into my trunk image. Would like to piggyback this onto the next Tools change. On Sun, Oct 21, 2018 at 5:50 PM <[hidden email]> wrote: > > A new version of Tools was added to project The Inbox: > http://source.squeak.org/inbox/Tools-tcj.832.mcz > > ==================== Summary ==================== > > Name: Tools-tcj.832 > Author: tcj > Time: 21 October 2018, 3:50:02.553053 pm > UUID: 52acbd13-8832-4974-b7ae-2f0ecfd3b4d7 > Ancestors: Tools-cmm.831 > > Handle case where a minimized project window is deleted (and thus a changeset is removed) while a Simple Change Sorter window is open. Stops a DNU from arising. > > Perhaps there is a more graceful way to handle this occasion in ChangeSorter>>#update or #updateIfNecessary > > =============== Diff against Tools-cmm.831 =============== > > Item was changed: > ----- Method: ChangeSorter>>setContents (in category 'code pane') ----- > setContents > "return the source code that shows in the bottom pane" > > | sel class strm changeType | > self clearUserEditFlag. > + myChangeSet ifNil: [^ contents := '']. "should not happen but can" > currentClassName ifNil: [^ contents := myChangeSet preambleString ifNil: ['']]. > class := self selectedClassOrMetaClass. > (sel := self selectedMessageName) == nil > ifFalse: [changeType := (myChangeSet atSelector: (sel := sel asSymbol) class: class). > changeType == #remove > ifTrue: [^ contents := 'Method has been removed (see versions)']. > changeType == #addedThenRemoved > ifTrue: [^ contents := 'Added then removed (see versions)']. > class ifNil: [^ contents := 'Method was added, but cannot be found!!']. > (class includesSelector: sel) > ifFalse: [^ contents := 'Method was added, but cannot be found!!']. > contents := class sourceCodeAt: sel. > (#(prettyPrint prettyDiffs) includes: contentsSymbol) ifTrue: > [contents := class prettyPrinterClass > format: contents in: class notifying: nil]. > self showingAnyKindOfDiffs > ifTrue: [contents := self diffFromPriorSourceFor: contents]. > ^ contents := contents asText makeSelectorBoldIn: class] > ifTrue: [strm := WriteStream on: (String new: 100). > (myChangeSet classChangeAt: (self withoutItemAnnotation: currentClassName)) do: > [:each | > each = #remove ifTrue: [strm nextPutAll: 'Entire class was removed.'; cr]. > each = #addedThenRemoved ifTrue: [strm nextPutAll: 'Class was added then removed.']. > each = #rename ifTrue: [strm nextPutAll: 'Class name was changed.'; cr]. > each = #add ifTrue: [strm nextPutAll: 'Class definition was added.'; cr]. > each = #change ifTrue: [strm nextPutAll: 'Class definition was changed.'; cr]. > each = #reorganize ifTrue: [strm nextPutAll: 'Class organization was changed.'; cr]. > each = #comment ifTrue: [strm nextPutAll: 'New class comment.'; cr. > ]]. > ^ contents := strm contents].! > > |
Free forum by Nabble | Edit this page |