if99.net

IF99 ITB

Archive for the ‘jdt’ Category

Eclipse: Copy Qualified Java Name

without comments

Eclipse has a nice feature to copy qualified name from a resource and this is very useful to create documentation or working with XML. For example:

Say that I need the full qualified name from class CaseFormat. What I have to do is:

  1. Click on + beside CaseFormat.java.
  2. Right click on CaseFormat (not CaseFormat.java).
  3. Select Copy Qualified Name.
  4. There you go, you can paste the full qualified name of class CaseFormat anywhere you want.

But that’s kind of a lot of steps, isn’t it?

OK… you can create a keyboard shortcut for Copy Qualified Name but still you have to expand CaseFormat.java before you can do that. If you don’t expand the *.java node what you’ll get is: ‘/guava/src/com/google/common/base/CaseFormat.java’ instead of ‘com.google.common.base.CaseFormat’.

This problem is kind of annoying and if you have to do this a lot of time, will certainly damage your productivity.

So here is a tiny plugin to solve the problem.

com.satukubik.copyqualifiedname_1.0.0

You can download it, save it to your dropins folder, and restart Eclipse. After that a shortcut Ctrl+Shift+C is available for you to copy qualified java name without having to expand the *.java node.

For those who are curious, I’ve put the source code of the plugin here: http://code.google.com/a/eclipselabs.org/p/copyqualifiedjavaname/. Feel free to clone, suggest improvement, or report a bug.

Related posts:

  1. My top Eclipse keyboard shortcut
  2. Eclipse plugin: Introduce Static Imports
  3. Maven Plugin: Java Code Formatter

Eclipse: Copy Qualified Java Name originally appeared on satukubik on May 26, 2010.

Written by Nanda Firdausi

May 26th, 2010 at 5:44 pm