The Inbox: Tools-ct.1031.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tools-ct.1031.mcz

commits-2
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.1031.mcz

==================== Summary ====================

Name: Tools-ct.1031
Author: ct
Time: 10 March 2021, 6:26:41.374559 pm
UUID: 90289614-021a-254a-b67f-5612c973d257
Ancestors: Tools-mt.1030

Fixes styling in change sorters if no real method is selected. No need to invoke Shout on messages such as "method was removed".

Using an instance variable for this to avoid duplication of the contents logic.

=============== Diff against Tools-mt.1030 ===============

Item was changed:
  CodeHolder subclass: #ChangeSorter
+ instanceVariableNames: 'parent myChangeSet currentClassName currentSelector priorChangeSetList contentsAreStyleable'
- instanceVariableNames: 'parent myChangeSet currentClassName currentSelector priorChangeSetList'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Tools-Changes'!
 
+ !ChangeSorter commentStamp: 'ct 3/10/2021 18:24' prior: 0!
- !ChangeSorter commentStamp: 'wiz 2/3/2010 23:38' prior: 0!
  I display a ChangeSet.  Two of me are in a DualChangeSorter.
 
  aStringOrNil
  Instance Variables
  currentClassName: <aStringOrNil>
  currentSelector: <aStringOrNil>
  myChangeSet: <aChangeSet>
  parent: <aDualChangeSorterOrNil>
  priorChangeSetList: <aCollection>
+ contentsAreStyleable <aBoolean>
 
 
  currentClassName
  - string parseable into class-name [class] [class trait]
  needs to be fitlered by (self withoutItemAnnotation: currentClassName) to remove pakaging note
 
 
  currentSelector
  - string parseable into selector-name
  needs to be fitlered by (self withoutItemAnnotation: currentSelector) to remove pakaging note
 
  myChangeSet
  - name of current changeset
  parent
  -the dual changesorter that contains this one. Used for dealing with the other half.
  priorChangeSetList
+ - holds the current change set list. Used to detect changes in list when a newly generated list no long match the prior list.!
- - holds the current change set list. Used to detect changes in list when a newly generated list no long match the prior list.
- !

Item was changed:
  ----- Method: ChangeSorter>>aboutToStyle: (in category 'code pane') -----
  aboutToStyle: aStyler
  "This is a notification that aStyler is about to re-style its text.
  Set the classOrMetaClass in aStyler, so that identifiers
  will be resolved correctly.
  Answer true to allow styling to proceed, or false to veto the styling"
 
+ contentsAreStyleable ~= false ifFalse: [^false].
- self isModeStyleable ifFalse: [^false].
- self currentSelector ifNil: [^false].
  aStyler classOrMetaClass: self selectedClassOrMetaClass.
  ^true!

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.
+ contentsAreStyleable := false.
  myChangeSet ifNil: [^ contents := String empty].   "should not happen but can"
  currentClassName ifNil: [^ contents := myChangeSet preambleString ifNil: [String empty]].
  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!!'].
+ contentsAreStyleable := true.
  contents := class sourceCodeAt: sel.
  (#(prettyPrint prettyDiffs) includes: contentsSymbol) ifTrue:
  [contents :=  class prettyPrinterClass
  format: contents in: class notifying: nil].
+ self showingAnyKindOfDiffs ifTrue: [
+ contentsAreStyleable := false.
+ contents := self diffFromPriorSourceFor: contents].
- 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].!

Item was changed:
+ (PackageInfo named: 'Tools') postscript: 'ChangeSorter allSubInstancesDo: [:sorter |
+ (sorter instVarNamed: ''contentsAreStyleable'') ifNil: [
+ sorter instVarNamed: ''contentsAreStyleable'' put: true]].'!
- (PackageInfo named: 'Tools') postscript: '(Smalltalk globals at: #ObjectsUnderInspection ifAbsent: [#()])
- do: [:objectUnderInspection |
- ToolSet inspect: objectUnderInspection].
- Smalltalk globals removeKey: #ObjectsUnderInspection.'!