Eclipse使用技巧

eclipse中批量替换代码,原始代码(这里有n个方法都调用了this.sourceCode(),一个一个添加太繁琐了!)

	public void test1(){
		this.sourceCode();
	}
	public void test2(){
		this.sourceCode();
	}
	public void testn(){
		this.sourceCode();
	}

想要替换完的代码

	public void test1(){
		//这是注释
		newcource;
		this.sourceCode();
	}
	public void test2(){
		//这是注释
		newcource;
		this.sourceCode();
	}
	public void testn(){
		//这是注释
		newcource;
		this.sourceCode();
	}

CTRL+F

Find

this\.sourceCode\(\);

Repace With:
\/\/这是注释\R\t\tnewcource\;\R\t\tthis\.sourceCode\(\);

你可能感兴趣的:(Eclipse使用技巧)