Improvement in QuickFixer - if the fix is local to the method, only update codeview's contents.
--- a/SmallSense__SmalltalkQuickFixer.st Wed Sep 18 01:29:45 2013 +0100
+++ b/SmallSense__SmalltalkQuickFixer.st Wed Sep 18 01:30:51 2013 +0100
@@ -99,20 +99,34 @@
!SmalltalkQuickFixer methodsFor:'utilities'!
apply: allChanges
- | changes |
+
+ allChanges isEmptyOrNil ifTrue:[ ^ self ].
+ (allChanges size == 1 and:[allChanges anElement isMethodCodeChange]) ifTrue:[
+ | oldSource newSource |
- changes := Tools::ChangeSetBrowser2 confirmChanges: allChanges.
- changes isEmptyOrNil ifTrue:[ ^ self ].
- (changes size == 1 and:[view reallyModified]) ifTrue:[
- view contents: changes anElement source clear: false.
+ oldSource := view contents asString string.
+ newSource := allChanges anElement source asString.
+ oldSource ~= newSource ifTrue:[
+ view list: newSource asStringCollection.
+ view modified: true.
+ view isCodeView2 ifTrue:[
+ view reallyModifiedChannel value: true.
+ ]
+ ].
] ifFalse:[
| browser |
-
- self halt.
+ browser := view application topApplication.
+ (browser respondsTo: #performRefactoring:) ifTrue:[
+ browser performRefactoring: allChanges.
+ ] ifFalse:[
+ self breakPoint: #jv.
+ Dialog warn: 'Sorry, this application does not support quick fixes'
+ ]
]
"Created: / 16-02-2012 / 14:46:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 07-09-2013 / 00:36:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmalltalkQuickFixer::QuickFix methodsFor:'accessing'!