#OTHER by cg
class: SmallSense::SmalltalkQuickFixer
comment/format in: #fix
changed:
#apply:
#performFix:
--- a/SmallSense__SmalltalkQuickFixer.st Tue May 17 00:05:38 2016 +0200
+++ b/SmallSense__SmalltalkQuickFixer.st Tue May 17 01:24:41 2016 +0200
@@ -112,17 +112,23 @@
!SmalltalkQuickFixer methodsFor:'utilities'!
-apply: changes
+apply:aRefactoryChange
+ |changes firstChange browser|
+
+ changes := aRefactoryChange changes.
+
changes isEmptyOrNil ifTrue: [
^ self
].
- (changes size == 1 and: [ changes anElement isMethodCodeChange ]) ifTrue: [
+ firstChange := changes anElement.
+
+ (changes size == 1 and: [ firstChange isMethodCodeChange ]) ifTrue: [
"/ Only one change, modify the code directly in the editor
| oldSource newSource |
oldSource := view contents asString string.
- newSource := changes anElement source asString.
+ newSource := firstChange source asString.
oldSource ~= newSource ifTrue: [
| line |
@@ -139,16 +145,15 @@
]
info:'Rewrite the code'.
].
+ ^ self.
+ ].
+
+ browser := view application topApplication.
+ (browser respondsTo: #performRefactoring:) ifTrue: [
+ browser performRefactoring: changes.
] ifFalse: [
- | browser |
-
- browser := view application topApplication.
- (browser respondsTo: #performRefactoring:) ifTrue: [
- browser performRefactoring: changes.
- ] ifFalse: [
- self breakPoint: #jv.
- Dialog warn:'Sorry, this application does not support quick fixes'
- ]
+ 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>"