Archive for the ‘Opinions’ Category

Play! Console in IntelliJ IDEA

Thursday, January 12th, 2012

Did you know that IntelliJ IDEA 11 provides an integrated Play Framework console?

Start it from “Tools” menu, complete Play! commands, use command history, analyze output.
Play! with pleasure!

Play! with IntelliJ IDEA EAP build 110.187

Friday, October 21st, 2011

Grab the new build here and start playing with the Play! framework. Here you’ll find a few related screencasts. The new build also has significant changes in PostgreSQL syntax support.

The new build also includes the first step of a visual redesign of the UI (starting from the navigation bar).

Please download the new build, check out the complete release notes and send us feedback through the issue tracker.

New in 11: Downloading sources of third party JAR’s from web

Tuesday, October 11th, 2011

When exploring a code, sometimes you end up in a decompiled code from a JAR for which there’s no source code attached. Previously you had to:

    1. go find the source JAR on the Web
    2. download it to your disk
    3. go to your project structure settings
    4. attach the JAR to the library of interest

A bit too much, isn’t it? Now (in the next EAP) IntelliJ IDEA 11 does it all for you:

New in 11: Create GitHub Gists from IDE

Thursday, September 29th, 2011

Helo guys,

We know that many of you are keen on GitHub and use gists in your everyday work. We are excited to tell you that now you can share your code instantly from the IDE. Here is a small demo of how it works.

Open any file you want to share with others or even a selection within this file, invoke the context menu and select Create Gist… menu item.

At first you’ll be asked to login to GitHub to be able to create personal gists. The IDE stores your GitHub password inside a built-in secure password storage, so you can be asked for your master password to access the storage.

Anyway if you don’t want to use it, you’ll see the GitHub login form:

Note that even without any account on GitHub you still can create gists for instant sharing of code samples with anyone.

And here we are, enter a description, select the desired gist options and press OK to create it!

This functionality will be available in the nearest IntelliJ IDEA 11 EAP and in all IntelliJ based products. It is still under development, so it is a subject to change and improve, so your feedback and thoughts are welcome. For example, we’re thinking about a preview editor to modify your code before publishing it.

Also we have a bunch of feature requests about GitHub integration in our issue tracker. Feel free to comment and vote for them. That’s all for now. Enjoy!

Develop with pleasure!
JetBrains Team

Java 7. @SafeVarargs

Friday, April 8th, 2011

Java 7 provides a way to remove a compiler warning about generics vararg invocation. With Java 7 you can annotate your vararg method with SafeVararg annotation and your clients won’t get these nasty warnings any more. IntelliJ IDEA 10.5 will help you to perform this migration. It will find for you all the places where @SafeVarargs annotation is applicable and suggest you to add this annotation. Of course, it will also check if existing @SafeVarargs annotations are applicable.

Suppose you have annotated your method with @SafeVararg but already have suppressions for unchecked warning in client’s code:

Since its version 6 IntelliJ IDEA contains an inspection to find redundant suppressions (available in batch mode only). Now you can use it to remove all suppressions which are garbage in your code. It will carefully check that these unchecked warnings were caused by generics vararg invocation and suggest you to remove all such suppressions. Simply run the ‘Redundant Suppression’ inspection (Ctrl-Alt-Shift-I).

All you need to do is to install Java 7 and setup language level to 7.

Download IntelliJ IDEA 10.5 EAP, try the new described features and let us know what you think.

New concept of Android SDK in IntelliJ IDEA 10.5

Wednesday, March 30th, 2011

The recent EAP of IntelliJ IDEA 10.5 introduces a new presentation of Android platform inside a project.

Previously, you could configure Android SDK inside Android facet settings, while JDK played the role of the main Project/Module SDK. IntelliJ IDEA 10.5 considers Android platform itself as a Project/Module SDK:

Thus, the standard JDK jars aren’t included to the classpath of your Android module. So, the IDE will not complete the java classes which are not supported by the Android platform anymore. Also, the usages of such classes will be correctly highlighted as errors:

Note, that in addition to the Android SDK, you still need a Java SDK because IntelliJ IDEA uses it for compilation. You’ll be prompted for it while creating a new Android SDK.

It is important to mention that once you open an existing Android project in IntelliJ IDEA 10.5 it will be converted automatically, no manual configuration needed.

You are welcome to try it in the latest IntelliJ IDEA 10.5 EAP build and let us know what you think.

More intelligence for JSF component libraries

Tuesday, March 30th, 2010

Make sure you try the extended JSF components support in the latest IntelliJ IDEA 9.0.2 EAP. Completion, error highlighting and basic refactorings have been added for RichFaces 3.x (a4j and rich) and standard (html and core) component libraries.

Write us about your favorite JSF library and we’ll add support for it asap.

IntelliJ IDEA PSI Viewer

Thursday, November 19th, 2009

If you’re an IntelliJ IDEA plugin developer, you’re surely going to enjoy IntelliJ IDEA PSI Viewer (Tools -> View PSI Structure), which displays internal structure of various files, as they’re interpreted by IntelliJ IDEA. If you’re implementing a new language support, or trying to add some cool new features to what’s already supported — this viewer is what you’re gonna need a lot.

As you see, PSI Viewer is made up of of tree parts:

  • An editor with file content
  • PSI structure view with parent-child tree of its elements
  • Area that displays references of element selected in PSI structure view.

Note that references marked as red resolve to null.

Available since build 92.35

Tracking Changelist Conflicts in Maia

Thursday, November 5th, 2009

Working on more than one task at once, you may run in some problems with your changes. Say, you have changed some files in a changelist, then switched to another changelist and made a massive refactoring. Oops! Some files in the first changelist are touched too. Now, committing any of these changelists without the other may lead to troubles.

Maia introduces a way to avoid such scenarios. You can protect files in inactive changelists. When you’re trying to change them (by direct editing or by applying a refactoring) you will see a dialog indicating the files to be changed:

The dialog gives you a number of options to resolve the conflict. You can shelve the changes you made in an inactive changelist and unshelve them later. You can move the previously changed files into the active changelist so that they would be committed together. If all conflicting files belong to a single changelist, you can switch to it, and the new changes will be added there. Finally, you can just ignore the notification and manage the conflict manually.

This strict protection is not enabled by default. You should go to Project Settings -> Version Control -> Changelist Conflicts and select the Show conflict resolving dialog option.

By default, IntelliJ IDEA warns you if you changed files from an inactive changelist. They are highlighted in the Project View, and have a yellow stripe in the editor.

ThreadLocal in One Click

Friday, October 30th, 2009

Most of applications initially are single threaded, and IntelliJ IDEA was no different; though luckily, now it isn’t — but we had to adapt our code to use multiple threads. In this post I’m going to tell you how.

In our example we see SAXBuilder, which is too expensive to be created every time we need it, so it is stored in a static final field.

Because SAXBuilder is not thread safe, multiple calls to loadDocument from different threads cause a lot of interesting exceptions. This is why we need either to make access to this field synchronized, or to make the field ThreadLocal. In our case, we’re choosing the latter. We encapsulate the field, change its type and initializer, then fix a generated getter. Quite a lot of work, right? Luckily in Maia you can do it all in just one click. Just place caret on a field and press Alt+Enter to smoothly migrate it to ThreadLocal.