if99.net

IF99 ITB

Archive for the ‘productivity’ 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

MS Word: ‘Paste text without formatting’ keyboard binding

without comments

It’s very annoying if you have to copy text from website or other places to email or you document and get the text formatted like it is on the website. Yes there is option to paste text without formatting in the menu but to get there you have to open dialog and so on and so on.

This document shows you how to create a keyboard binding for ‘Paste text without formatting’ in Microsoft Word 2000 and above. I will just copy the information here.

First we need to create the macro:

To create the macro to cut and paste without formatting

  1. Start Word.
  2. On the Tools menu, point to Macro, and then click Macros to display the Macros dialog box.
  3. In the Macro name box, type PasteUnformattedText.
  4. Make sure that All active templates and documents is displayed in the Macros in list, and then click Create. The Microsoft Visual Basic® Editor is displayed.
    Note If you need to learn about the Visual Basic Editor, see the Power User Corner column Managing Macros with the Visual Basic Editor.
  5. Directly above the End Sub statement in the PasteUnformattedText subroutine, type the following line of code:
    Selection.PasteSpecial DataType:=wdPasteText
    
  6. On the File menu, click Close and Return to Microsoft Word.

And now how to create the keyboard binding. Instead of Ctrl+V that is shown in the article, I will make my keyboard binding for the macro Ctrl+Shift+V.

To create the keyboard binding

  1. On the Tools menu, click Customize.
  2. Click the Keyboard button.
  3. Make sure the Save changes in box displays Normal.dot.
  4. In the Categories list, click Macros.
  5. In the Macros list, click PasteUnformattedText.
  6. Click in the Press new shortcut key box, press and hold the CTRL and Shift key, and then press and hold the V key at the same time. The Press new shortcut key box displays Ctrl+Shift+V.
  7. Click Assign. Click Close and then click Close again.

That’s it… now you can press Ctrl+Shift+V to paste text without formatting easily.

Related posts:

  1. My top Eclipse keyboard shortcut
  2. Eclipse 3.3 Live Rename Refactoring
  3. Mac keyboard cheat sheet

MS Word: ‘Paste text without formatting’ keyboard binding originally appeared on satukubik on May 26, 2010.

Written by Nanda Firdausi

May 26th, 2010 at 5:28 pm