[Pharo-project] How to use the OmniBrowser regex refactor to transform code?

T.J. Richter tjrichter at live.com
Tue Sep 22 05:14:29 EDT 2009


I feel stupid for asking this, but I Googled and found nothing, checked classes
for comments and found nothing, then skimmed Pharo by Example and also found
nothing. Lukas mentioned helpfully in another thread that you can use the regex
refactoring tools in the OmniBrowser to transform code, but I can't seem to
figure out how to do it. I figured out how to "scope" the refactoring to a
class or class hierarchy, which results in a gold window popping up with the
selected class(es) in the left-most panel. When I right-click on the class at
the top and choose "refactor->source regex", I get a template in the code
panel that looks like this:

ORSourceRegexRefactoring new

	"Example 1: Replace symbols with strings"
	replace: '#(\w+)' with: '''$1''' ignoreCase: false;
	
	"Example 2: Replace 4 spaces with tabs"
	replace: '    ' with: '	' ignoreCase: false;

	yourself

I wanted to rename a method (and all senders of it in the selected scope) from
"nextValue" to "nextItem", so I edit the template to this:


ORSourceRegexRefactoring new
	
	replace: 'nextValue' with: 'nextItem' ignoreCase: false;

	yourself

I highlight it all with Alt-a, then Do It with Alt-d, but nothing seems to
happen.





More information about the Pharo-dev mailing list