Skip to content

Commit

Permalink
fixed some style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Jul 6, 2020
1 parent a31c1ed commit 77267b4
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/Spec2-Examples/SpClassMethodBrowser.class.st
Expand Up @@ -71,7 +71,7 @@ SpClassMethodBrowser >> initializePresenters [
classListPresenter := self newList.
methodListPresenter := self newList.
textPresenter := self newCode.
textPresenter whenSubmitDo: [ :t | methodListPresenter selectedItem inspect ].
textPresenter whenSubmitDo: [ :text | methodListPresenter selectedItem inspect ].
methodListPresenter display: #selector.
self focusOrder
add: classListPresenter;
Expand Down
2 changes: 1 addition & 1 deletion src/Spec2-Morphic-Examples/SpMethodBrowser.class.st
Expand Up @@ -61,7 +61,7 @@ SpMethodBrowser >> connectPresenters [
textModel text: m sourceCode.
textModel beForMethod: m.
toolbarModel method: m ] ].
self whenSubmitDo: [ :t | self listModel selectedItem inspect ].
self whenSubmitDo: [ :text | self listModel selectedItem inspect ].
self wrapWith: [ :item | item methodClass name , '>>#' , item selector ]
]

Expand Down
3 changes: 2 additions & 1 deletion src/Spec2-Tools/ChangeSorterModel.class.st
Expand Up @@ -146,10 +146,11 @@ ChangeSorterModel >> fileOutSelector: selector from: aClass [
ChangeSorterModel >> findChangeSetIn: aCollectionOfChangeSets [
"Search for a changeSet by name. Pop up a menu of all changeSets whose name contains the string entered by the user. If only one matches, then the pop-up menu is bypassed"
| index pattern candidates nameList |

self okToChange ifFalse: [^ self].
pattern := UIManager default request: 'ChangeSet name or fragment?'.
pattern isEmptyOrNil ifTrue: [^ self].
nameList := aCollectionOfChangeSets collect: #name.
nameList := aCollectionOfChangeSets collect: [ : each | each name ].
candidates := aCollectionOfChangeSets select:
[:c | (nameList includes: c name) and:
[c name includesSubstring: pattern caseSensitive: false]].
Expand Down
2 changes: 1 addition & 1 deletion src/Spec2-Tools/MessageBrowser.class.st
Expand Up @@ -170,7 +170,7 @@ MessageBrowser >> codeFont [
{ #category : #initialization }
MessageBrowser >> connectPresenters [
messageList
whenSelectionChangedDo: [ :selection | [ :item | self selectItem: item ] cull: selection selectedItem ];
whenSelectionChangedDo: [ :selection | self selectItem: selection selectedItem ];
whenModelChangedDo: [ self updateTitle ].
textModel whenSubmitDo: [ :text | (self accept: text notifying: nil) notNil ]
]
Expand Down
2 changes: 1 addition & 1 deletion src/Spec2-Tools/MessageList.class.st
Expand Up @@ -71,7 +71,7 @@ MessageList >> buildHierarchyForMessages: messages [
^ result ].

result := Dictionary new.
classes := (messages collect: #methodClass) asSet.
classes := (messages collect: [ :each | each methodClass ]) asSet.
messages do: [:message || level class |
class := message methodClass.
level := OrderedCollection new.
Expand Down
6 changes: 4 additions & 2 deletions src/Spec2-Tools/SpChooseMethodUI.class.st
Expand Up @@ -122,7 +122,7 @@ SpChooseMethodUI >> classListAction [
ifNil: [ #()]]
postTransmission: [ :protcolList |
protocolList
selectIndex: ((protcolList items collect: #name) indexOf: '-- all --') ]
selectIndex: ((protcolList items collect: [ :each | each name ]) indexOf: '-- all --') ]
]

{ #category : #initialization }
Expand All @@ -136,8 +136,10 @@ SpChooseMethodUI >> connectPresenters [

{ #category : #'initialization - actions' }
SpChooseMethodUI >> fillWith: aClass [

methodList items: aClass methods.
^ protocolList items: (aClass protocols collect: [ :eachSymbol | aClass organization protocolOrganizer protocolNamed: eachSymbol ])
^ protocolList items: (aClass protocols
collect: [ :eachSymbol | aClass organization protocolOrganizer protocolNamed: eachSymbol ])
]

{ #category : #initialization }
Expand Down
60 changes: 36 additions & 24 deletions src/Spec2-Tools/VersionBrowser.class.st
Expand Up @@ -70,12 +70,15 @@ VersionBrowser class >> registerToolsOn: registry [

{ #category : #visiting }
VersionBrowser >> accept: text notifying: notifyer [
^ self selectedMessage
ifNotNil: [:message |
message methodClass
compile: text
classified: message protocol
notifying: notifyer ]
| message |

message := self selectedMessage.
message ifNil: [ ^ self ].

message methodClass
compile: text
classified: message protocol
notifying: notifyer
]

{ #category : #actions }
Expand Down Expand Up @@ -127,7 +130,7 @@ VersionBrowser >> compareToCurrentVersion [
VersionBrowser >> compareToOtherVersion [
| labels versions index selected |
versions := self changeList.
labels := versions collect: #stamp.
labels := versions collect: [ :each | each stamp ].
index := UIManager default chooseFrom: labels.
index > 0 ifFalse: [ ^ self ].
selected := versions at: index.
Expand Down Expand Up @@ -186,6 +189,8 @@ VersionBrowser >> installIconStylerFor: anItem [

{ #category : #accessing }
VersionBrowser >> messageListMenu [

self flag: #TODO. "At least some of this options needs to be a command"
^ self newMenu
addGroup: [ :aGroup |
aGroup
Expand Down Expand Up @@ -219,13 +224,15 @@ VersionBrowser >> messageListMenu [

{ #category : #'instance creation' }
VersionBrowser >> revert: aChangeRecord [
aChangeRecord
ifNil: [ ^ self inform: 'nothing selected, so nothing done' ]
ifNotNil: [ rgMethod realClass
compile: aChangeRecord sourceCode
classified: aChangeRecord category
withStamp: aChangeRecord stamp
notifying: nil ].

aChangeRecord ifNil: [
^ self inform: 'nothing selected, so nothing done' ].

rgMethod realClass
compile: aChangeRecord sourceCode
classified: aChangeRecord category
withStamp: aChangeRecord stamp
notifying: nil.

"reinitialize me"
self setRGMethodFrom: rgMethod realClass >> rgMethod selector.
Expand All @@ -237,42 +244,46 @@ VersionBrowser >> revert: aChangeRecord [

{ #category : #private }
VersionBrowser >> selectItem: item [

sourcePresenter ifNil: [ ^ self ].

self
setSourceContentWith:
(self textConverter
method: item;
getText).
self setSourceContentWith: (self textConverter
method: item;
getText).

sourcePresenter clearUndoManager.
self installIconStylerFor: item
]

{ #category : #'accessing model' }
VersionBrowser >> setModelBeforeInitialization: aMethod [
self setRGMethodFrom: aMethod.

self setRGMethodFrom: aMethod
]

{ #category : #initialization }
VersionBrowser >> setRGMethodFrom: aMethod [
"asHistorical, because active RGMethods don't always have the source pointer attached"
rgMethod := aMethod asRingDefinition asHistorical.
rgMethod := aMethod asRingDefinition asHistorical
]

{ #category : #private }
VersionBrowser >> setSourceContentWith: content [

isShowingDiff
ifTrue: [ (content isText or: [ content isString ])
ifTrue: [
(content isText or: [ content isString ])
ifTrue: [ sourcePresenter leftText: ''.
sourcePresenter rightText: content ]
ifFalse: [ sourcePresenter leftText: content first.
sourcePresenter rightText: content second ] ]
ifFalse: [ sourcePresenter text: content ]
ifFalse: [
sourcePresenter text: content ]
]

{ #category : #'instance creation' }
VersionBrowser >> showDiffMorphWithConverter: aConverter [

sourcePresenter := self newDiff.
isShowingDiff := true.
self needRebuild: false.
Expand All @@ -284,12 +295,13 @@ VersionBrowser >> showDiffMorphWithConverter: aConverter [

{ #category : #'instance creation' }
VersionBrowser >> showSourceWithConverter: aConverter [

sourcePresenter := self newCode.
isShowingDiff := false.
self needRebuild: false.
self buildWithSpec.
self textConverter: aConverter.
sourcePresenter whenSubmitDo: [ :text :notifyer | (self accept: text notifying: notifyer) notNil ].
sourcePresenter whenSubmitDo: [ :text | (self accept: text notifying: nil) notNil ].
sourcePresenter beForMethod: self selectedMessage.
messageList selectIndex: (messageList selectedIndex)
]

0 comments on commit 77267b4

Please sign in to comment.