From 2d5f1e4105af7aea88fed819dc09944015265d87 Mon Sep 17 00:00:00 2001 From: Torsten Bergmann Date: Tue, 27 Feb 2024 14:46:14 +0100 Subject: [PATCH] [Cleanup] #notNil to #isNotNil in Spec Fix #1526 --- src/Spec2-Adapters-Morphic/SpFontStyle.class.st | 14 +++++++------- .../SpMorphicTableCellBuilder.class.st | 2 +- .../SpMorphicTableColumn.class.st | 2 +- .../SpMorphicTreeTableAdapter.class.st | 2 +- .../SpNotebookPageMorph.class.st | 2 +- .../SpToolbarButtonMorph.class.st | 2 +- .../SpToolbarToggleButtonMorph.class.st | 2 +- src/Spec2-Adapters-Morphic/SpTreeColumn.class.st | 2 +- .../SpCodeMethodInteractionModelTest.class.st | 2 +- src/Spec2-Code-Tests/SpCodePresenterTest.class.st | 4 ++-- .../SpCodeScriptingInteractionModelTest.class.st | 6 +++--- src/Spec2-Code/SpCodePresenter.class.st | 6 +++--- src/Spec2-Code/SpContextInteractionModel.class.st | 2 +- src/Spec2-CommandLine/SpApplication.extension.st | 2 +- src/Spec2-Core/SpAbstractPresenter.class.st | 8 ++++---- src/Spec2-Core/SpDialogWindowPresenter.class.st | 2 +- src/Spec2-Core/SpDropListPresenter.class.st | 4 ++-- src/Spec2-Core/SpListPresenter.class.st | 4 ++-- src/Spec2-Core/SpMenuItemPresenter.class.st | 2 +- .../SpNotebookPageLabelPresenter.class.st | 2 +- src/Spec2-Core/SpStringTableColumn.class.st | 2 +- src/Spec2-Core/SpTSearchable.trait.st | 2 +- src/Spec2-Core/SpTableColumn.class.st | 2 +- src/Spec2-Core/SpWindowPresenter.class.st | 8 ++++---- src/Spec2-Layout/SpTAlignable.trait.st | 4 ++-- ...ractWidgetPresenterDeferringActionTest.class.st | 2 +- 26 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/Spec2-Adapters-Morphic/SpFontStyle.class.st b/src/Spec2-Adapters-Morphic/SpFontStyle.class.st index e9f4fff9..cfa8e1c9 100644 --- a/src/Spec2-Adapters-Morphic/SpFontStyle.class.st +++ b/src/Spec2-Adapters-Morphic/SpFontStyle.class.st @@ -101,10 +101,10 @@ SpFontStyle >> addFontToCache: aFont [ { #category : 'private' } SpFontStyle >> anyFontDecorator [ - ^ color notNil - or: [ size notNil - or: [ bold notNil - or: [ italic notNil ] ] ] + ^ color isNotNil + or: [ size isNotNil + or: [ bold isNotNil + or: [ italic isNotNil ] ] ] ] { #category : 'private' } @@ -217,7 +217,7 @@ SpFontStyle >> colorVariable [ SpFontStyle >> definedFont [ | definedFont | - (self predefinedFont notNil and: [ self anyFontDecorator not ]) ifTrue: [ + (self predefinedFont isNotNil and: [ self anyFontDecorator not ]) ifTrue: [ ^ self obtainPredefinedFont ]. self withCachedFontDo: [ :aFont | ^ aFont ]. @@ -238,7 +238,7 @@ SpFontStyle >> displayScaleFactor [ { #category : 'private' } SpFontStyle >> hasPredefinedFont [ - ^ self predefinedFont notNil + ^ self predefinedFont isNotNil ] { #category : 'testing' } @@ -258,7 +258,7 @@ SpFontStyle >> isItalic [ { #category : 'testing' } SpFontStyle >> isReset [ - ^ name notNil and: [ name isResetVariable ] + ^ name isNotNil and: [ name isResetVariable ] ] { #category : 'accessing' } diff --git a/src/Spec2-Adapters-Morphic/SpMorphicTableCellBuilder.class.st b/src/Spec2-Adapters-Morphic/SpMorphicTableCellBuilder.class.st index fc0d568b..faae429b 100644 --- a/src/Spec2-Adapters-Morphic/SpMorphicTableCellBuilder.class.st +++ b/src/Spec2-Adapters-Morphic/SpMorphicTableCellBuilder.class.st @@ -212,7 +212,7 @@ SpMorphicTableCellBuilder >> visitCheckboxColumn: aTableColumn [ SpMorphicTableCellBuilder >> visitCompositeColumn: aTableColumn [ super visitCompositeColumn: aTableColumn. - (aTableColumn isExpandable and: [ aTableColumn width notNil ]) + (aTableColumn isExpandable and: [ aTableColumn width isNotNil ]) ifTrue: [ cell hResizing: #rigid. cell width: aTableColumn width ] diff --git a/src/Spec2-Adapters-Morphic/SpMorphicTableColumn.class.st b/src/Spec2-Adapters-Morphic/SpMorphicTableColumn.class.st index 7d23812a..9811aff6 100644 --- a/src/Spec2-Adapters-Morphic/SpMorphicTableColumn.class.st +++ b/src/Spec2-Adapters-Morphic/SpMorphicTableColumn.class.st @@ -118,7 +118,7 @@ SpMorphicTableColumn >> width: aNumber [ widthToAdd := addEmptySpace ifTrue: [ aNumber - self emptySpace ] ifFalse: [ aNumber ]. - (self model isExpandable and: [ aNumber notNil ]) + (self model isExpandable and: [ aNumber isNotNil ]) ifTrue: [ self model width: widthToAdd ] ]. super width: widthToAdd ] diff --git a/src/Spec2-Adapters-Morphic/SpMorphicTreeTableAdapter.class.st b/src/Spec2-Adapters-Morphic/SpMorphicTreeTableAdapter.class.st index e7a55617..3c25a2af 100644 --- a/src/Spec2-Adapters-Morphic/SpMorphicTreeTableAdapter.class.st +++ b/src/Spec2-Adapters-Morphic/SpMorphicTreeTableAdapter.class.st @@ -41,7 +41,7 @@ SpMorphicTreeTableAdapter >> addColumnsFromPresenterTo: tableMorph [ fixed width of column: I need to enlarge that width with the width of the expander." self columns withIndexDo: [ :each :index | | column | column := self newColumnFrom: each. - (index = 1 and: [ column width notNil ]) ifTrue: [ + (index = 1 and: [ column width isNotNil ]) ifTrue: [ column addEmptySpace. "column width: column width + SpMorphicTreeTableDataSource emptyMorph width" ]. tableMorph addColumn: column ]. diff --git a/src/Spec2-Adapters-Morphic/SpNotebookPageMorph.class.st b/src/Spec2-Adapters-Morphic/SpNotebookPageMorph.class.st index ce6814d3..97533221 100644 --- a/src/Spec2-Adapters-Morphic/SpNotebookPageMorph.class.st +++ b/src/Spec2-Adapters-Morphic/SpNotebookPageMorph.class.st @@ -31,7 +31,7 @@ SpNotebookPageMorph >> actualPageMorph: anObject [ { #category : 'testing' } SpNotebookPageMorph >> isRendered [ - ^ actualPageMorph notNil + ^ actualPageMorph isNotNil ] { #category : 'accessing' } diff --git a/src/Spec2-Adapters-Morphic/SpToolbarButtonMorph.class.st b/src/Spec2-Adapters-Morphic/SpToolbarButtonMorph.class.st index 8d83bbea..381bcfa7 100644 --- a/src/Spec2-Adapters-Morphic/SpToolbarButtonMorph.class.st +++ b/src/Spec2-Adapters-Morphic/SpToolbarButtonMorph.class.st @@ -102,7 +102,7 @@ SpToolbarButtonMorph >> getLabelSelector: aSelector [ { #category : 'accessing' } SpToolbarButtonMorph >> hasBadge [ - ^ self badge notNil + ^ self badge isNotNil ] { #category : 'style' } diff --git a/src/Spec2-Adapters-Morphic/SpToolbarToggleButtonMorph.class.st b/src/Spec2-Adapters-Morphic/SpToolbarToggleButtonMorph.class.st index 02c62ea3..f791fe7b 100644 --- a/src/Spec2-Adapters-Morphic/SpToolbarToggleButtonMorph.class.st +++ b/src/Spec2-Adapters-Morphic/SpToolbarToggleButtonMorph.class.st @@ -106,7 +106,7 @@ SpToolbarToggleButtonMorph >> getLabelSelector: aSelector [ { #category : 'accessing' } SpToolbarToggleButtonMorph >> hasBadge [ - ^ self badge notNil + ^ self badge isNotNil ] { #category : 'style' } diff --git a/src/Spec2-Adapters-Morphic/SpTreeColumn.class.st b/src/Spec2-Adapters-Morphic/SpTreeColumn.class.st index 5dff3716..2f41b6c9 100644 --- a/src/Spec2-Adapters-Morphic/SpTreeColumn.class.st +++ b/src/Spec2-Adapters-Morphic/SpTreeColumn.class.st @@ -43,7 +43,7 @@ SpTreeColumn >> setHeaderButtonLabel: aLabel font: aFont icon: anIconForm target ifNotNil: [ self header label: aLabel font: aFont ]. anIconForm ifNotNil: [ self header icon: (ImageMorph new form: anIconForm) ]. - (aSelector notNil and: [ aReceiver notNil ]) + (aSelector isNotNil and: [ aReceiver isNotNil ]) ifFalse: [ ^ self ]. self header actionSelector: aSelector. self header target: aReceiver diff --git a/src/Spec2-Code-Tests/SpCodeMethodInteractionModelTest.class.st b/src/Spec2-Code-Tests/SpCodeMethodInteractionModelTest.class.st index dd5d2642..fb39bd5a 100644 --- a/src/Spec2-Code-Tests/SpCodeMethodInteractionModelTest.class.st +++ b/src/Spec2-Code-Tests/SpCodeMethodInteractionModelTest.class.st @@ -37,7 +37,7 @@ SpCodeMethodInteractionModelTest >> testBehavior [ SpCodeMethodInteractionModelTest >> testBindingOf [ self assert: (interactionModel bindingOf: #somethingNotExistent) isNil. - self assert: (interactionModel bindingOf: #Object) notNil + self assert: (interactionModel bindingOf: #Object) isNotNil ] { #category : 'tests' } diff --git a/src/Spec2-Code-Tests/SpCodePresenterTest.class.st b/src/Spec2-Code-Tests/SpCodePresenterTest.class.st index 0ec5ef02..c964aa2d 100644 --- a/src/Spec2-Code-Tests/SpCodePresenterTest.class.st +++ b/src/Spec2-Code-Tests/SpCodePresenterTest.class.st @@ -57,7 +57,7 @@ SpCodePresenterTest >> testContextKeyBindings [ | contextKeyBindings | contextKeyBindings := presenter contextKeyBindings. - self assert: contextKeyBindings notNil. + self assert: contextKeyBindings isNotNil. self assert: (contextKeyBindings isKindOf: KMCategory). ] @@ -141,7 +141,7 @@ SpCodePresenterTest >> testDoBrowseClassReferences [ presenter selectionInterval: (1 to: 19). presenter doBrowseClassReferences. - self assert: navigation messageList notNil. + self assert: navigation messageList isNotNil. self assert: navigation messageList notEmpty ] diff --git a/src/Spec2-Code-Tests/SpCodeScriptingInteractionModelTest.class.st b/src/Spec2-Code-Tests/SpCodeScriptingInteractionModelTest.class.st index e8e4160f..851f7740 100644 --- a/src/Spec2-Code-Tests/SpCodeScriptingInteractionModelTest.class.st +++ b/src/Spec2-Code-Tests/SpCodeScriptingInteractionModelTest.class.st @@ -40,13 +40,13 @@ SpCodeScriptingInteractionModelTest >> testBehavior [ SpCodeScriptingInteractionModelTest >> testBindingOf [ "auto create of bindings on demand (it will always answer a value)" - self assert: (interactionModel bindingOf: #somethingNotExistent) notNil. + self assert: (interactionModel bindingOf: #somethingNotExistent) isNotNil. self assert: (interactionModel bindingOf: #somethingNotExistent) value isNil. "... even if it is an Object variable... is this correct?" - self assert: (interactionModel bindingOf: #Object) notNil. + self assert: (interactionModel bindingOf: #Object) isNotNil. self assert: (interactionModel bindingOf: #Object) value isNil. "and of course it will answer our added bindings" - self assert: (interactionModel bindingOf: #testVar) notNil. + self assert: (interactionModel bindingOf: #testVar) isNotNil. self assert: (interactionModel bindingOf: #testVar) value equals: 42 diff --git a/src/Spec2-Code/SpCodePresenter.class.st b/src/Spec2-Code/SpCodePresenter.class.st index 022d4d7f..2bff286a 100644 --- a/src/Spec2-Code/SpCodePresenter.class.st +++ b/src/Spec2-Code/SpCodePresenter.class.st @@ -382,7 +382,7 @@ SpCodePresenter >> doBrowseSenders [ variable := self lookupEnvironment lookupVar: variableOrClassName. "For global and class variables, sender-of shows intead the using methods" - (variable notNil and: [(variable isGlobalVariable or: [variable isClassVariable])]) + (variable isNotNil and: [(variable isGlobalVariable or: [variable isClassVariable])]) ifTrue: [ self systemNavigation openBrowserFor: variable name withMethods: variable usingMethods ] ifFalse: [ self systemNavigation browseAllReferencesTo: variableOrClassName ] @@ -494,7 +494,7 @@ SpCodePresenter >> hasLineNumbers [ { #category : 'testing' } SpCodePresenter >> hasResetAction [ - ^ resetBlock notNil + ^ resetBlock isNotNil ] { #category : 'testing' } @@ -506,7 +506,7 @@ SpCodePresenter >> hasSmartCharacters [ { #category : 'testing' } SpCodePresenter >> hasSubmitAction [ - ^ submitBlock notNil + ^ submitBlock isNotNil ] { #category : 'testing' } diff --git a/src/Spec2-Code/SpContextInteractionModel.class.st b/src/Spec2-Code/SpContextInteractionModel.class.st index 07c65540..e46ac3f2 100644 --- a/src/Spec2-Code/SpContextInteractionModel.class.st +++ b/src/Spec2-Code/SpContextInteractionModel.class.st @@ -62,7 +62,7 @@ SpContextInteractionModel >> hasBindingOf: aString [ { #category : 'testing' } SpContextInteractionModel >> hasUnsavedCodeChanges [ - ^ context notNil and: [ context sourceCode ~= owner text asString ] + ^ context isNotNil and: [ context sourceCode ~= owner text asString ] ] { #category : 'testing' } diff --git a/src/Spec2-CommandLine/SpApplication.extension.st b/src/Spec2-CommandLine/SpApplication.extension.st index 5ef866bc..a78e9060 100644 --- a/src/Spec2-CommandLine/SpApplication.extension.st +++ b/src/Spec2-CommandLine/SpApplication.extension.st @@ -9,7 +9,7 @@ SpApplication class >> applicationName [ { #category : '*Spec2-CommandLine' } SpApplication class >> findAll [ - ^ self allSubclasses select: [ :each | each applicationName notNil ] + ^ self allSubclasses select: [ :each | each applicationName isNotNil ] ] { #category : '*Spec2-CommandLine' } diff --git a/src/Spec2-Core/SpAbstractPresenter.class.st b/src/Spec2-Core/SpAbstractPresenter.class.st index 062ef99b..a64a1f6a 100644 --- a/src/Spec2-Core/SpAbstractPresenter.class.st +++ b/src/Spec2-Core/SpAbstractPresenter.class.st @@ -271,25 +271,25 @@ SpAbstractPresenter >> forceUpdateSlot: aSymbol [ { #category : 'testing' } SpAbstractPresenter >> hasAdapter [ - ^ adapter notNil + ^ adapter isNotNil ] { #category : 'testing' } SpAbstractPresenter >> hasAnnouncer [ - ^ announcer notNil + ^ announcer isNotNil ] { #category : 'testing' } SpAbstractPresenter >> hasEventHandler [ - ^ eventHandler notNil and: [ eventHandler hasEvents ] + ^ eventHandler isNotNil and: [ eventHandler hasEvents ] ] { #category : 'testing' } SpAbstractPresenter >> hasOwner [ - ^ self owner notNil + ^ self owner isNotNil ] { #category : 'testing' } diff --git a/src/Spec2-Core/SpDialogWindowPresenter.class.st b/src/Spec2-Core/SpDialogWindowPresenter.class.st index 010948a9..b52dbdc6 100644 --- a/src/Spec2-Core/SpDialogWindowPresenter.class.st +++ b/src/Spec2-Core/SpDialogWindowPresenter.class.st @@ -168,7 +168,7 @@ SpDialogWindowPresenter >> executeDefaultAction [ { #category : 'testing' } SpDialogWindowPresenter >> hasDefaultButton [ - ^ defaultButton notNil + ^ defaultButton isNotNil ] { #category : 'initialization' } diff --git a/src/Spec2-Core/SpDropListPresenter.class.st b/src/Spec2-Core/SpDropListPresenter.class.st index a9f83350..728ed958 100644 --- a/src/Spec2-Core/SpDropListPresenter.class.st +++ b/src/Spec2-Core/SpDropListPresenter.class.st @@ -158,9 +158,9 @@ SpDropListPresenter >> getList [ SpDropListPresenter >> hasIcons [ "Answer whether the dropdown list will show icons" - ^ iconBlock notNil and: [ + ^ iconBlock isNotNil and: [ self model collection anySatisfy: [ :each | - each icon notNil or: [ (self getIconFor: each) notNil ] ] ] + each icon isNotNil or: [ (self getIconFor: each) isNotNil ] ] ] ] { #category : 'api' } diff --git a/src/Spec2-Core/SpListPresenter.class.st b/src/Spec2-Core/SpListPresenter.class.st index 208d5add..d1e8137f 100644 --- a/src/Spec2-Core/SpListPresenter.class.st +++ b/src/Spec2-Core/SpListPresenter.class.st @@ -44,7 +44,7 @@ SpListPresenter >> clickOnSelectedItem [ | item | item := self selection selectedItem. - ^ item notNil + ^ item isNotNil and: [ (item respondsTo: #click) and: [ item click ] ] ] @@ -114,7 +114,7 @@ SpListPresenter >> hasHeaderTitle [ SpListPresenter >> hasIcons [ "Answer true if the list has an icon provider (See `SpListPresenter>>#icons:`)." - ^ self displayIcon notNil + ^ self displayIcon isNotNil ] { #category : 'api' } diff --git a/src/Spec2-Core/SpMenuItemPresenter.class.st b/src/Spec2-Core/SpMenuItemPresenter.class.st index 5d3aa1b5..eb096276 100644 --- a/src/Spec2-Core/SpMenuItemPresenter.class.st +++ b/src/Spec2-Core/SpMenuItemPresenter.class.st @@ -68,7 +68,7 @@ SpMenuItemPresenter >> description: aString [ { #category : 'testing' } SpMenuItemPresenter >> hasShortcut [ - ^ self shortcut notNil + ^ self shortcut isNotNil ] { #category : 'api' } diff --git a/src/Spec2-Core/SpNotebookPageLabelPresenter.class.st b/src/Spec2-Core/SpNotebookPageLabelPresenter.class.st index a3eb46ba..4056f0a3 100644 --- a/src/Spec2-Core/SpNotebookPageLabelPresenter.class.st +++ b/src/Spec2-Core/SpNotebookPageLabelPresenter.class.st @@ -57,7 +57,7 @@ SpNotebookPageLabelPresenter >> label [ { #category : 'accessing - model' } SpNotebookPageLabelPresenter >> model: aModel [ - (model notNil + (model isNotNil and: [ model ~= aModel ]) ifTrue: [ self unsubscribePage: model ]. diff --git a/src/Spec2-Core/SpStringTableColumn.class.st b/src/Spec2-Core/SpStringTableColumn.class.st index a6b4a9b9..62d9de8b 100644 --- a/src/Spec2-Core/SpStringTableColumn.class.st +++ b/src/Spec2-Core/SpStringTableColumn.class.st @@ -142,5 +142,5 @@ SpStringTableColumn >> sortFunction: aBlockOrSortFunction [ ^ self ]. super sortFunction: aBlockOrSortFunction asSortFunction. - self isSortable: aBlockOrSortFunction notNil + self isSortable: aBlockOrSortFunction isNotNil ] diff --git a/src/Spec2-Core/SpTSearchable.trait.st b/src/Spec2-Core/SpTSearchable.trait.st index 6c79e056..6462a0d8 100644 --- a/src/Spec2-Core/SpTSearchable.trait.st +++ b/src/Spec2-Core/SpTSearchable.trait.st @@ -31,7 +31,7 @@ SpTSearchable >> enableSearch [ SpTSearchable >> hasCustomSearch [ "Answer true if the list has a custom search defined (See `SpListPresenter>>#searchMatching:`" - ^ searchBlock notNil + ^ searchBlock isNotNil ] { #category : 'initialization' } diff --git a/src/Spec2-Core/SpTableColumn.class.st b/src/Spec2-Core/SpTableColumn.class.st index d96116ca..039e1d4b 100644 --- a/src/Spec2-Core/SpTableColumn.class.st +++ b/src/Spec2-Core/SpTableColumn.class.st @@ -143,7 +143,7 @@ SpTableColumn >> isExpandable [ SpTableColumn >> isSortable [ "Answer if this column is sortable" - ^ self sortFunction notNil + ^ self sortFunction isNotNil ] { #category : 'private' } diff --git a/src/Spec2-Core/SpWindowPresenter.class.st b/src/Spec2-Core/SpWindowPresenter.class.st index 92f96deb..8937f2f5 100644 --- a/src/Spec2-Core/SpWindowPresenter.class.st +++ b/src/Spec2-Core/SpWindowPresenter.class.st @@ -237,14 +237,14 @@ SpWindowPresenter >> hasDecorations [ SpWindowPresenter >> hasMenu [ "Answer if window has a menu defined" - ^ self menu notNil + ^ self menu isNotNil ] { #category : 'testing' } SpWindowPresenter >> hasPresenter: aPresenter [ "Answer if window includes `aPresenter`" - ^ aPresenter isNotNil and: [aPresenter adapter notNil + ^ aPresenter isNotNil and: [aPresenter adapter isNotNil and: [ self adapter hasWidget: aPresenter adapter ]] ] @@ -252,14 +252,14 @@ SpWindowPresenter >> hasPresenter: aPresenter [ SpWindowPresenter >> hasStatusBar [ "Answer if window has a status bar defined" - ^ self statusBar notNil + ^ self statusBar isNotNil ] { #category : 'testing' } SpWindowPresenter >> hasToolbar [ "Answer if window has a toolbar defined" - ^ self toolbar notNil and: [ self toolbar notEmpty ] + ^ self toolbar isNotNil and: [ self toolbar notEmpty ] ] { #category : 'api' } diff --git a/src/Spec2-Layout/SpTAlignable.trait.st b/src/Spec2-Layout/SpTAlignable.trait.st index 42b2882e..5fc7e26c 100644 --- a/src/Spec2-Layout/SpTAlignable.trait.st +++ b/src/Spec2-Layout/SpTAlignable.trait.st @@ -61,14 +61,14 @@ SpTAlignable >> hasAlignment [ SpTAlignable >> hasHAlign [ "Answer whether the component has an horizontal alignment defined" - ^ hAlign notNil + ^ hAlign isNotNil ] { #category : 'testing' } SpTAlignable >> hasVAlign [ "Answer whether the component has a vertical alignment defined" - ^ vAlign notNil + ^ vAlign isNotNil ] { #category : 'accessing' } diff --git a/src/Spec2-Tests/SpAbstractWidgetPresenterDeferringActionTest.class.st b/src/Spec2-Tests/SpAbstractWidgetPresenterDeferringActionTest.class.st index f31945e6..816de777 100644 --- a/src/Spec2-Tests/SpAbstractWidgetPresenterDeferringActionTest.class.st +++ b/src/Spec2-Tests/SpAbstractWidgetPresenterDeferringActionTest.class.st @@ -25,5 +25,5 @@ SpAbstractWidgetPresenterDeferringActionTest >> testWithAdapterPerformOrDeferExe presenter adapter: Object new. presenter withAdapterPerformOrDefer: [ :anAdapter | executed := anAdapter. ]. - self assert: executed notNil + self assert: executed isNotNil ]