automatic import of static classes

Hello All,

I'm trying to make Intellij automatically add imports of some classes when using static methods, e.g.
By typing "assertTrue" I'd like to have IDEA automatically import org.testng.Assert.assertTrue;

Using Eclipse I was able to set (in preferences) the names of classes that I'd like to be searched for static imports (like described here: http://jdcarlflip.blogspot.com/2008/07/eclipse-tip-static-imports.html) . Is it possible with IDEA? Or maybe IDEA offers some other approach?

--
Cheers,
Tomek Kaczanowski

2 comments

In IDEA 9, you can type "assertTrue()", and then invoke the "Static Import Method" QuickFix.
In IDEA 10, support for automatic static imports has been improved quite significantly: type "assT", and invoke Ctrl-Alt-Space.

0

>In IDEA 9, you can type "assertTrue()", and then invoke the "Static Import Method" QuickFix.
Yes, it works, but the necessity of writing the brackets is irritating.

>In IDEA 10, support for automatic static imports has been improved quite significantly: type "assT", and invoke Ctrl-Alt-Space.
Great! So I will move to IDEA 10 EAP and see how it works.

Thank you very much.

--
Cheers,
Tomek

0

Please sign in to leave a comment.