#REFACTORING by exept
class: AbstractSettingsApplication::SourceCodeFormatSettingsAppl
comment/format in: #initialize
changed:19 methods
--- a/AbstractSettingsApplication.st Sat Feb 22 01:18:16 2020 +0100
+++ b/AbstractSettingsApplication.st Sat Feb 22 01:26:07 2020 +0100
@@ -15858,7 +15858,7 @@
)
from:RBFormatter.
- self autoFormat value:currentUserPrefs autoFormatting.
+ autoFormat value:currentUserPrefs autoFormatting.
self updateModifiedChannel.
reformatLocked := false.
self reformat.
@@ -15866,33 +15866,33 @@
basicSaveSettings
- currentUserPrefs autoFormatting:self autoFormat value.
- currentUserPrefs at:#'formatter.tabIndent' put:self tabIndent value.
- currentUserPrefs at:#'formatter.spaceAroundTemporaries' put:self spaceAroundTemporaries value.
- currentUserPrefs at:#'formatter.emptyLineAfterTemporaries' put:self emptyLineAfterTemporaries value.
- currentUserPrefs at:#'formatter.spaceAfterReturnToken' put:self spaceAfterReturnToken value.
- currentUserPrefs at:#'formatter.spaceAfterKeywordSelector' put:self spaceAfterKeywordSelector value.
- currentUserPrefs at:#'formatter.spaceAfterBlockStart' put:self spaceAfterBlockStart value.
- currentUserPrefs at:#'formatter.spaceBeforeBlockEnd' put:self spaceBeforeBlockEnd value.
- currentUserPrefs at:#'formatter.cStyleBlocks' put:self cStyleBlocks value.
- currentUserPrefs at:#'formatter.blockArgumentsOnNewLine' put:self blockArgumentsOnNewLine value.
- currentUserPrefs at:#'formatter.maxLengthForSingleLineBlocks' put:self maxLengthForSingleLineBlocks value.
+ currentUserPrefs autoFormatting: autoFormat value.
+ currentUserPrefs at:#'formatter.tabIndent' put: tabIndent value.
+ currentUserPrefs at:#'formatter.spaceAroundTemporaries' put: spaceAroundTemporaries value.
+ currentUserPrefs at:#'formatter.emptyLineAfterTemporaries' put: emptyLineAfterTemporaries value.
+ currentUserPrefs at:#'formatter.spaceAfterReturnToken' put: spaceAfterReturnToken value.
+ currentUserPrefs at:#'formatter.spaceAfterKeywordSelector' put: spaceAfterKeywordSelector value.
+ currentUserPrefs at:#'formatter.spaceAfterBlockStart' put: spaceAfterBlockStart value.
+ currentUserPrefs at:#'formatter.spaceBeforeBlockEnd' put: spaceBeforeBlockEnd value.
+ currentUserPrefs at:#'formatter.cStyleBlocks' put: cStyleBlocks value.
+ currentUserPrefs at:#'formatter.blockArgumentsOnNewLine' put: blockArgumentsOnNewLine value.
+ currentUserPrefs at:#'formatter.maxLengthForSingleLineBlocks' put: maxLengthForSingleLineBlocks value.
RBFormatter
- tabIndent:self tabIndent value;
- spaceAroundTemporaries:self spaceAroundTemporaries value;
- emptyLineAfterTemporaries:self emptyLineAfterTemporaries value;
- spaceAfterReturnToken:self spaceAfterReturnToken value;
- spaceAfterKeywordSelector:self spaceAfterKeywordSelector value;
- spaceAfterBlockStart:self spaceAfterBlockStart value;
- spaceBeforeBlockEnd:self spaceBeforeBlockEnd value;
- cStyleBlocks:self cStyleBlocks value;
- blockArgumentsOnNewLine:self blockArgumentsOnNewLine value;
- maxLengthForSingleLineBlocks:self maxLengthForSingleLineBlocks value asInteger.
+ tabIndent: tabIndent value;
+ spaceAroundTemporaries: spaceAroundTemporaries value;
+ emptyLineAfterTemporaries: emptyLineAfterTemporaries value;
+ spaceAfterReturnToken: spaceAfterReturnToken value;
+ spaceAfterKeywordSelector: spaceAfterKeywordSelector value;
+ spaceAfterBlockStart: spaceAfterBlockStart value;
+ spaceBeforeBlockEnd: spaceBeforeBlockEnd value;
+ cStyleBlocks: cStyleBlocks value;
+ blockArgumentsOnNewLine: blockArgumentsOnNewLine value;
+ maxLengthForSingleLineBlocks: maxLengthForSingleLineBlocks value asInteger.
!
reformat
- |tree s_tabIndent s_spaceAroundTemporaries s_emptyLineAfterTemporaries
+ |"tree" s_tabIndent s_spaceAroundTemporaries s_emptyLineAfterTemporaries
s_spaceAfterReturnToken s_spaceAfterKeywordSelector s_cStyleBlocks
s_maxLengthForSingleLineBlocks s_blockArgumentsOnNewLine
s_spaceAfterBlockStart s_spaceBeforeBlockEnd|
@@ -15913,16 +15913,16 @@
s_maxLengthForSingleLineBlocks := RBFormatter maxLengthForSingleLineBlocks.
RBFormatter
- tabIndent:self tabIndent value;
- spaceAroundTemporaries:self spaceAroundTemporaries value;
- emptyLineAfterTemporaries:self emptyLineAfterTemporaries value;
- spaceAfterReturnToken:self spaceAfterReturnToken value;
- spaceAfterKeywordSelector:self spaceAfterKeywordSelector value;
- spaceAfterBlockStart:self spaceAfterBlockStart value;
- spaceBeforeBlockEnd:self spaceBeforeBlockEnd value;
- cStyleBlocks:self cStyleBlocks value;
- blockArgumentsOnNewLine:self blockArgumentsOnNewLine value;
- maxLengthForSingleLineBlocks:self maxLengthForSingleLineBlocks value.
+ tabIndent: tabIndent value;
+ spaceAroundTemporaries: spaceAroundTemporaries value;
+ emptyLineAfterTemporaries: emptyLineAfterTemporaries value;
+ spaceAfterReturnToken: spaceAfterReturnToken value;
+ spaceAfterKeywordSelector: spaceAfterKeywordSelector value;
+ spaceAfterBlockStart: spaceAfterBlockStart value;
+ spaceBeforeBlockEnd: spaceBeforeBlockEnd value;
+ cStyleBlocks: cStyleBlocks value;
+ blockArgumentsOnNewLine: blockArgumentsOnNewLine value;
+ maxLengthForSingleLineBlocks: maxLengthForSingleLineBlocks value.
"/ tree := RBParser
"/ parseMethod:self class exampleText
@@ -15952,16 +15952,16 @@
resetToRBDefault
reformatLocked := true.
- self tabIndent value: 8.
- self spaceAfterReturnToken value:false.
- self spaceAfterKeywordSelector value:true.
- self spaceAroundTemporaries value:true.
- self spaceAfterBlockStart value:true.
- self spaceBeforeBlockEnd value:true.
- self emptyLineAfterTemporaries value:false.
- self cStyleBlocks value:false.
- self blockArgumentsOnNewLine value:false.
- self maxLengthForSingleLineBlocks value: 20.
+ tabIndent value: 8.
+ spaceAfterReturnToken value:false.
+ spaceAfterKeywordSelector value:true.
+ spaceAroundTemporaries value:true.
+ spaceAfterBlockStart value:true.
+ spaceBeforeBlockEnd value:true.
+ emptyLineAfterTemporaries value:false.
+ cStyleBlocks value:false.
+ blockArgumentsOnNewLine value:false.
+ maxLengthForSingleLineBlocks value: 20.
reformatLocked := false.
self reformat.
!
@@ -15969,16 +15969,16 @@
resetToStxDefault
reformatLocked := true.
- self tabIndent value: 4.
- self spaceAfterReturnToken value: true.
- self spaceAfterKeywordSelector value: false.
- self spaceAroundTemporaries value: false.
- self spaceAfterBlockStart value:false.
- self spaceBeforeBlockEnd value:false.
- self emptyLineAfterTemporaries value: true.
- self cStyleBlocks value: true.
- self blockArgumentsOnNewLine value:false.
- self maxLengthForSingleLineBlocks value: 20.
+ tabIndent value: 4.
+ spaceAfterReturnToken value: true.
+ spaceAfterKeywordSelector value: false.
+ spaceAroundTemporaries value: false.
+ spaceAfterBlockStart value:false.
+ spaceBeforeBlockEnd value:false.
+ emptyLineAfterTemporaries value: true.
+ cStyleBlocks value: true.
+ blockArgumentsOnNewLine value:false.
+ maxLengthForSingleLineBlocks value: 20.
reformatLocked := false.
self reformat.
! !
@@ -15986,134 +15986,72 @@
!AbstractSettingsApplication::SourceCodeFormatSettingsAppl methodsFor:'aspects'!
autoFormat
-
- autoFormat isNil ifTrue:[
- autoFormat := currentUserPrefs autoFormatting asValue.
- autoFormat onChangeSend:#updateModifiedChannel to:self
- ].
^ autoFormat.
!
blockArgumentsOnNewLine
-
- blockArgumentsOnNewLine isNil ifTrue:[
- blockArgumentsOnNewLine := true asValue.
- blockArgumentsOnNewLine addDependent:self.
- ].
^ blockArgumentsOnNewLine.
!
cStyleBlocks
-
- cStyleBlocks isNil ifTrue:[
- cStyleBlocks := true asValue.
- cStyleBlocks addDependent:self.
- ].
^ cStyleBlocks.
!
editorText
-
- editorText isNil ifTrue:[
- editorText := ValueHolder new.
- ].
^ editorText.
!
emptyLineAfterTemporaries
-
- emptyLineAfterTemporaries isNil ifTrue:[
- emptyLineAfterTemporaries := true asValue.
- emptyLineAfterTemporaries addDependent:self.
- ].
^ emptyLineAfterTemporaries.
!
maxLengthForSingleLineBlocks
-
- maxLengthForSingleLineBlocks isNil ifTrue:[
- maxLengthForSingleLineBlocks := ValueHolder new.
- maxLengthForSingleLineBlocks addDependent:self.
- ].
^ maxLengthForSingleLineBlocks.
!
spaceAfterBlockStart
-
- spaceAfterBlockStart isNil ifTrue:[
- spaceAfterBlockStart := true asValue.
- spaceAfterBlockStart addDependent:self.
- ].
^ spaceAfterBlockStart.
!
spaceAfterKeywordSelector
-
- spaceAfterKeywordSelector isNil ifTrue:[
- spaceAfterKeywordSelector := true asValue.
- spaceAfterKeywordSelector addDependent:self.
- ].
^ spaceAfterKeywordSelector.
!
spaceAfterReturnToken
-
- spaceAfterReturnToken isNil ifTrue:[
- spaceAfterReturnToken := true asValue.
- spaceAfterReturnToken addDependent:self.
- ].
^ spaceAfterReturnToken.
!
spaceAroundTemporaries
-
- spaceAroundTemporaries isNil ifTrue:[
- spaceAroundTemporaries := true asValue.
- spaceAroundTemporaries addDependent:self.
- ].
^ spaceAroundTemporaries.
!
spaceBeforeBlockEnd
-
- spaceBeforeBlockEnd isNil ifTrue:[
- spaceBeforeBlockEnd := true asValue.
- spaceBeforeBlockEnd addDependent:self.
- ].
^ spaceBeforeBlockEnd.
!
tabIndent
-
- tabIndent isNil ifTrue:[
- tabIndent := ValueHolder new.
- tabIndent addDependent:self.
- ].
^ tabIndent.
! !
!AbstractSettingsApplication::SourceCodeFormatSettingsAppl methodsFor:'change & update'!
update:something with:aParameter from:changedObject
- (changedObject == self blockArgumentsOnNewLine
- or:[ changedObject == self cStyleBlocks
- or:[ changedObject == self emptyLineAfterTemporaries
- or:[ changedObject == self maxLengthForSingleLineBlocks
- or:[ changedObject == self spaceAfterKeywordSelector
- or:[ changedObject == self spaceAfterReturnToken
- or:[ changedObject == self spaceAfterBlockStart
- or:[ changedObject == self spaceBeforeBlockEnd
- or:[ changedObject == self spaceAroundTemporaries
- or:[ changedObject == self tabIndent]]]]]]]]])
+ (changedObject == blockArgumentsOnNewLine
+ or:[ changedObject == cStyleBlocks
+ or:[ changedObject == emptyLineAfterTemporaries
+ or:[ changedObject == maxLengthForSingleLineBlocks
+ or:[ changedObject == spaceAfterKeywordSelector
+ or:[ changedObject == spaceAfterReturnToken
+ or:[ changedObject == spaceAfterBlockStart
+ or:[ changedObject == spaceBeforeBlockEnd
+ or:[ changedObject == spaceAroundTemporaries
+ or:[ changedObject == tabIndent]]]]]]]]])
ifTrue:[
self updateModifiedChannel.
self reformat.
^ self
].
- super
- update:something
- with:aParameter
- from:changedObject
+ super update:something with:aParameter from:changedObject
! !
!AbstractSettingsApplication::SourceCodeFormatSettingsAppl methodsFor:'help'!
@@ -16136,7 +16074,40 @@
].
reformatLocked := false.
- "Modified: / 08-02-2017 / 00:30:17 / cg"
+ autoFormat := currentUserPrefs autoFormatting asValue.
+ autoFormat onChangeSend:#updateModifiedChannel to:self.
+
+ blockArgumentsOnNewLine := true asValue.
+ blockArgumentsOnNewLine addDependent:self.
+
+ cStyleBlocks := true asValue.
+ cStyleBlocks addDependent:self.
+
+ editorText := ValueHolder new.
+
+ emptyLineAfterTemporaries := true asValue.
+ emptyLineAfterTemporaries addDependent:self.
+
+ maxLengthForSingleLineBlocks := ValueHolder new.
+ maxLengthForSingleLineBlocks addDependent:self.
+
+ spaceAfterBlockStart := true asValue.
+ spaceAfterBlockStart addDependent:self.
+
+ spaceAfterKeywordSelector := true asValue.
+ spaceAfterKeywordSelector addDependent:self.
+
+ spaceAfterReturnToken := true asValue.
+ spaceAfterReturnToken addDependent:self.
+
+ spaceAroundTemporaries := true asValue.
+ spaceAroundTemporaries addDependent:self.
+
+ spaceBeforeBlockEnd := true asValue.
+ spaceBeforeBlockEnd addDependent:self.
+
+ tabIndent := ValueHolder new.
+ tabIndent addDependent:self.
!
postBuildTextEditor:aWidget
@@ -16148,7 +16119,7 @@
!AbstractSettingsApplication::SourceCodeFormatSettingsAppl methodsFor:'queries'!
hasUnsavedChanges
- self autoFormat value ~= currentUserPrefs autoFormatting ? false ifTrue:[^ true].
+ autoFormat value ~= currentUserPrefs autoFormatting ? false ifTrue:[^ true].
(self
hasChangedAspectIn: