Copy paste code directly in Eclipse

Recently learned a really cool trick for copy-pasting code in Eclipse.

Let's say you have the following code:

package com.veerasundar.demo;

    public class CopyCode {
    	private int nothing;
    }

Now copy the above code, go to any Eclipse project and right click on *source *folder and paste. See what happens! Impressive isn't it!?

Here's what Eclipse did: it parsed the clipboard, found that there's a Java code in it, create the necessary package structure for the code to fit in and then copied the code there.

Neat!

Veerasundar profile photo

Written by Veerasundar

Veerasundar is a Software Engineer, currently working at Salesforce as a Lead Member of Technical Staff. He has over 16 years of industry experience, building consumer facing web applications. He lives in Chennai, India.

Contact Veerasundar: Email or Twitter

If you liked my writing, you should look at my other projects