Archive for February, 2012

IntelliJ IDEA 11.1 EAP build 114.243

Tuesday, February 28th, 2012

New EAP build of IntelliJ IDEA 11.1 is available.

Notable changes include updated Subversion 1.7 and Perforce integrations, fixes in new Flash / ActionScript / Flex configuration and Jboss 7.1 Final support.

See release notes for complete list.

You can download the new build from the EAP page or install it using the “Check for updates” action inside the IDE.

AnnotationConfig*ApplicationContext support in IntelliJ IDEA 11.1

Friday, February 24th, 2012

From this short post you’ll find out (and see) how to:

  • configure your non-XML Spring contexts using @Configuration classes, AnnotationConfigApplicationContext or AnnotationConfigWebApplicationContext
  • set-up “active” profiles for annotation-based configurations
  • If you use AnnotationConfigWebApplicationContext then simply add your configurations or packages-to-scan to “contextConfiguration” context-param of your web.xml and these files will be autodetected by IntelliJ IDEA.

    or add your @Configuration classes to a new annotation-based fileset if your application uses AnnotationConfigApplicationContext.

    So, what do you think?

    Integration with Android Lint tool in IntelliJ IDEA 11.1

    Thursday, February 23rd, 2012

    In IntelliJ IDEA 11.1 we’ve added many inspections based on Android Lint tool, which reports many kinds of potential problems in the sources of your Android project.

    For example IntelliJ IDEA will notify you about useless views in layout xml files and will offer to remove it:

    Another example is that IDE warns you about hardcoded text and offer to extract a new string resource:

    Some issues (such as duplicated icons or incomplete translations) aren’t shown in the editor, but reported when you run inspections for your project. Simply launch Analyze | Inspect Code from the main menu:

    You can see all the Lint based inspections and tune them in Settings | Inspections | Android | Lint.

    The feature is available to try it in the latest IntelliJ IDEA 11.1 EAP.

    Want more from IntelliJ IDEA? Press the same shortcut again!

    Wednesday, February 22nd, 2012

    Sometimes you invoke an action and you don’t get what you wanted immediately. In such cases it may help to invoke the action again by pressing the same shortcut. In basic code completion (Ctrl+Space) this will list non-imported classes:

    It works in similar way for smart-type and class name completions:

    In File Structure popup (Ctrl+F12) you will show inherited members with it:

    When introducing a variable (Ctrl+Alt+V), you may want to reassign an existing one instead:

    I may have missed something, but all this is already available in IntelliJ IDEA 11. And there’s a couple more nice things you can try in IntelliJ IDEA 11.1 EAP. First, all Goto actions (Ctrl+N for classes, Ctrl+Shift+N for files etc.) now expand their search scope after you press their shortcut again. For example, Goto Action (Ctrl+Shift+A) suggests to search in non-menu actions:

    Finally, Show Usages action (normally Ctrl+Alt+F7, remapped to Meta+Alt+F7 by me) will expand the search scope as well:

    Try it and tell us how you like it.

    Renewed File Structure in IntelliJ IDEA 11.1

    Tuesday, February 21st, 2012

    We know that one of the most popular ways to navigate within a file is File Structure popup. We’ve recently redesigned it to make the navigation more comfortable. New File Structure is tree-based and shows everything in your file when you first invoke it with Control+F12.

    The following short screencast should explain better what we did.

    Did you notice you can use Show Quick Doc and Show Implementations action from File Structure popup?

    You can already try it in the latest IntelliJ IDEA 11.1 EAP. Let us know what you think and we can improve it even further before 11.1 is shipped.

    Chained expression completion in IntelliJ IDEA 11.1

    Monday, February 20th, 2012

    If you use completion autopopup in IntelliJ IDEA 11, you may have seen “n variants…” suggestions:

    This means there are two StringUtil classes available, neither of them is imported, and IDE can’t choose which of them to put to the first place. When you choose such variant no new import statements will be added. The good side is that you won’t get wrong imports after pressing space, dot or a bracket. The bad side is that you eventually have to face this choice: you may either explicitly invoke completion (Ctrl+Space) again or choose the correct qualified name from the auto-import hint which appears after choosing the item.

    Here’s a good news though, now (since IntelliJ IDEA 11.1) you don’t ever have to choose the qualified name. In this particular case, you just type a dot, no import is inserted as before, but the next completion autopopup will list all the possible static members from both possible StringUtil classes:

    Needless to say, after you choose the method you want all the necessary imports will be added.

    In fact, this feature is even more powerful. It tries to enumerate all the completion variants matching the non-existent qualifier and suggest chained calls based on this. So you may spare some typing even if you don’t use autopopup (or have hit dot too early before it appeared):

    Ah, yes, this works in Java and Groovy code.

    IntelliJ IDEA 11.1 build 114.145

    Friday, February 17th, 2012

    We now return to our regular weekly schedule of publishing EAP builds. This week, we bring you:

    • a new Groovy shell (Tools | Groovy Shell…) for quickly evaluating snippets of code in the context of your project;
    • a number of important fixes for the new Flex project configuration;
    • continued work on Gradle project synchronization;
    • an updated version of SVNKit with better Subversion 1.7 support;
    • the usual bunch of bugfixes.

    You can download the new build from the EAP page or install it using the “Check for updates” action inside the IDE.

    Improved Flex Project Setup in IntelliJ IDEA 11.1

    Thursday, February 16th, 2012

    Hi, Flash and Flex devs!

    We’ve been analyzing feedback from those of you who use IntelliJ IDEA for Flex and ActionScript development. A common problem turns out to be complicated project setup. To address this issue in IntelliJ IDEA 11.1, we have reworked the user interface, all the way from module wizard and project setup to run/debug configurations and AIR Packaging.

    We believe these changes will make product experience better for everyone, and especially for the users of Eclipse-based IDEs.

    Read on to see what we’ve changed so far. However, this isn’t final, as we count on more feedback from you to make additional improvements and polishing.

    (more…)

    New “Magic Constant” Inspection

    Wednesday, February 15th, 2012

    Have you ever cursed an API which uses magic integer constants instead of the proper enumeration?

    What should I pass as the titleJustification parameter here? 0 or 1?
    Can I pass “42″ for the titlePosition parameter? Even Javadoc won’t know.
    Actually, you must use one of the constants in the TitledBorder class to make the code correct:

    I call these constants “magic” because sometimes it is far from easy to figure them out.

    Here comes a new “Magic constant” inspection that looks for usages of methods/variables which expect “magic constants” as their arguments:

    Then it helps you to replace plain numbers or strings with a proper magic constant:


    (more…)

    Try Kotlin with the IntelliJ IDEA plugin

    Tuesday, February 14th, 2012

    Some of you have guessed right. Yesterday’s IntelliJ IDEA EAP build was released in order to support the Kotlin plugin, which is finally available as a preview version today.

    The source code repository for Kotlin, which includes the IntelliJ IDEA plugin, is available on GitHub. The compiled version of the plugin is also available for download.

    Your feedback on Kotlin and the IntelliJ IDEA plugin is very much welcome in our issue tracker.