One thing that annoys me constantly is that the browsers always ask me for inst or class var names to rename or create Accessors for, even if I have a variable name selected in the class definition.
The solution is quite easy: change EtAbstractMethodsBrowser>>#createInstVarAccessors to:
- Code: Select all
createInstVarAccessors
| instVars |
self changeRequest ifFalse: [^self].
instVars := (self selectedText isNil or: [self selectedText isEmpty]) "Use the selection if available"
ifTrue: [self selectInstanceVariables] ifFalse: [self selectedText subStrings]. "Even prepared for selection of multiple variable names"
instVars isEmpty ifTrue: [^self].
instVars do: [:each |
self handleError: [
(CreateAccessorsForVariableRefactoring
variable: each
class: self actualClass
classVariable: false) execute]].
self changedClass
With this fix in place the system asks no questions if I want to create an accessor for one selected inst var name.
Fixing renameInstVar:in: should be equally easy. The same goes for class variables.
I would like to go one step further: The "selection..." Menu is only active if only one variable name is selected. Why shouldn't this be also possible for multiple instVars?