Archive for October, 2009

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.

Update a Running JavaEE Application

Thursday, October 29th, 2009

Next Maia EAP build includes new action that lets you quickly update a running JavaEE application after you changed its code. To invoke it, either press Ctrl+F10, or click this button on the Run tool window bar:

IntelliJ IDEA will allow you to select what to update in application:

Settings are saved in a current Run Configuration, so you can change them later even if you select Don’t ask again option.

Invoking Run/Debug Actions in IntelliJ IDEA 9

Monday, October 26th, 2009

In IntelliJ IDEA 9 (Maia), we’ve slightly changed the way you run and debug your applications. You’re still able to quickly run or debug a previous configuration (Shift+F10/F9), as well as to create and run/debug a temporary configuration in a context-dependent manner (Ctrl+Shift+F10/F9). However, it’s now much easier to select and run/debug different configurations from the keyboard.

In IntelliJ IDEA 9, you can choose a configuration that you wish to run with one of the following shortcuts:

  • Alt+Shift+F9 to debug your application.
  • Alt+Shift+F10 to run it.

Invoking any of these actions displays a pop-up window with available configurations, like this:

You can edit a configuration before launch (press F4) or show a configuration dialog box to edit all your configurations and their default settings (press 0). You can also instantly delete a temporary configuration by pressing Delete.

That’s not the end of the story: you’re now able to temporary switch to an opposite action directly from this pop-up window by pressing and holding Shift. When you do that, Run becomes Debug and vice versa.

And even more: we’ve extended the pop-up window with context-dependent configurations. That means whenever you press Alt+Shift+F10 right in a test method’s body, the pop-up displays a temporary configuration to run the current method only or all tests from the current test class.

We’ve also added a number of quick access shortcuts:

  • 1 for a previously selected configuration.
  • 2 and 3 for context-dependent configurations.
  • 0 to display the Edit Configuration dialog box.

One more tip: we’ve mapped this pop-up to F9 (debugger’s Resume Program action). The pop-up now displays on pressing F9 when you’re unable to actually resume anything - that is, when you’re not yet running any debug session.

Generating Flex Methods

Friday, October 23rd, 2009

In Maia, you can easily generate Flex Constructor, Getter, Setter, Event Handler, and toString() methods, and some other stuff by just pressing Alt+Insert when cursor is in *.mxml or *.as file. Let’s have a look at some examples.
(more…)

New JSF 2.0 Features in Maia

Wednesday, October 21st, 2009

You are welcome to try new JSF 2.0 support features in upcoming Maia EAP:

1. Improved template support:

2. ActionSources and ValueHolders:

3. Targets attribute of composite components:

4. Extended support for EL in composite components implementation; and more.

Updated build of Community Edition released

Friday, October 16th, 2009

Yesterday’s release of IntelliJ IDEA Community Edition was a big event for us - and like many big events, it wasn’t perfect. Because of this, today we’ve released an updated build (IC-90.96) which fixes a number of important problems:

  • The Mac build now starts correctly on MacOS X 10.5
  • DevKit and Eclipse interoperability plugins were missing from the distribution
  • Fixed performance problems with the file chooser in Open Project and similar dialogs

You can download the new build from the IntelliJ IDEA Community Edition page.

IntelliJ IDEA Open Sourced

Thursday, October 15th, 2009

I believe you’ll like this announcement — IntelliJ IDEA has just gone open-source! Check out the press release as well as the new jetbrains.org community site for the details. We all will soon get a lot of new friends and colleagues in our IntelliJ IDEA community!

Starting with the upcoming version 9.0, IntelliJ IDEA will be offered in two editions: Community Edition and Ultimate Edition. The Community Edition focuses on Java SE technologies, Groovy and Scala development. It’s free of charge and open-sourced under the Apache 2.0 license. The Ultimate edition with full Java EE technology stack remains our standard commercial offering. See the feature comparison matrix for the differences.

Briefly, in the free Community Edition you’ll get all the Java code support — various refactorings and code inspections, coding assistance; debugging, TestNG and JUnit testing; CVS, Subversion and Git support; Ant and Maven build integration; and Groovy and Scala support (through a separate plugin). To learn more and download the Public Preview of IntelliJ IDEA 9 Community Edition, please visit the IntelliJ IDEA Community Edition site.

The IntelliJ platform, the common foundation for all our IDEs (IDEA, RubyMine, WebIDE or MPS), is being open-sourced under the APL 2.0, too.

You’ll find all the relevant information on how to participate and benefit at JetBrains.org. Check out the FAQ if you have additional questions.

Servlet 3.0 (JSR 315) support in Maia

Tuesday, October 6th, 2009

Maia supports Servlet 3.0 specification (JSR 315). You can now create a Web application without a web.xml descriptor:

Now, configure your servlets and filters with @WebServlet and @WebFilter annotations:

Everything is recognized by IntelliJ IDEA, as well as Web fragment descriptors and static resources packaged in libraries.

You can also use built-in Glassfish v3.0 integration to deploy your applications. Good luck!

FREE Upgrade Program Begins

Tuesday, October 6th, 2009

Great news, Everyone! We’re very happy to inform you all, that in spirit of a good old tradition (established around three years ago), everyone who buys or upgrades to IntelliJ IDEA 8 after October 1st 2009, is entitled to a FREE copy of IntelliJ IDEA 9 (Maia), which is scheduled for release in November 2009.

Develop with pleasure!

New Ways of Setting up Packaging Configurations

Monday, October 5th, 2009

IntelliJ IDEA 9 (Maia) brings a more powerful and flexible way to set up packaging configurations (artifacts) for your project. Artifacts are configured in Project Structure dialog:

Output layout of an artifact is displayed in a tree. You can edit it with Alt+Ins and Delete shortcuts, and by using drag-and-drop.

You can build artifact at any time from the main menu (Build | Build Artifact | <artifact name>), or you can automate it with the use of Build on make option in artifact settings, and Build Artifacts option in run configuration settings:

These features will be available in the next Maia EAP (around next Monday). Packaging configurations of existing JavaEE facets are migrated to artifacts automatically.