Author Archive

Analyzing external stack traces

Tuesday, August 29th, 2006

As a developer, you certainly get exceptions from users or QA engineers. And unlike the exceptions that you get in the debug mode, they don’t have those nice links that help you to navigate to source. If your source code is scrambled, the things get even more complicated.

Now imagine that you can simply copy an exception to your IDE and then navigate to source from the console. How much time will it save?

To save your time and make bug fixing a little less boring, IntelliJ IDEA developed the Stack Trace Analyzer. It works exactly as described above. Just click Analyze Stacktrace under the Analyze menu, and copy your stack trace in the dialog box. If your bug tracker or mail client corrupts stack traces (cut or wrap lines, etc.), simply click Normalize.



IntelliJ IDEA can unscramble the stack trace. By default, it supports only Zelix KlassMaster, but others can be added by plugins (for example, ProGuard plugin). You only need to select your unscramble tool and specify the location of log file.

Click OK, and voila - you get the stack trace in the console and the navigation to source is available.



Got interested? Read more about IntelliJ IDEA’s debugger and stack trace navigation.

Note   This tip was originally posted at www.javalobby.org.


Technorati tags: , ,

Using IntelliJ IDEA 6.0 features

Monday, August 21st, 2006

JetBrains has announced the list of new features in IntelliJ IDEA 6.0 some time ago, but people often ask us where to find or how to use a certain feature. Probably, in this case Reviewer’s Guide can help. Don’t be afraid of the document title, since it is actually an overview of the new functionality for the IntelliJ IDEA 6.0 release. It contains more detailed info than the “new features” page and describes all necessary shortcuts and menu commands for the most interesting features. Finally, it simply has more screenshots.

Read now

Technorati tags: , ,

Switching between API’s with ease

Monday, August 7th, 2006

While you develop and maintain your product, the framework and API on which your product is based on is also being developed and upgraded. This is why the other day you come to a point when you need to switch to a new API. At this time you may already have thousands lines of code where the old API is used.

The good example is migrating from java.util.Vector that was widely used a few years ago to the nonsynchronized ArrayList class. Doing this manually takes hours of work, but of course IntelliJ IDEA can automate and speed up this process.

IntelliJ IDEA provides a tool that helps you with migrating packages and classes. In case of switching between API’s you will also need to make a couple of tricks such as creation of temporary files and some refactoring. Here is the step-by-step instruction:

  1. Create a new class in one of the project packages. This class is temporary and you will need to delete it after migration. The temporary class should have the same name as the class from the old API and extend the class from the new API. For example, when migrating from java.util.Vector to ArrayList, create the temporary Vector class that extends ArrayList.
    Then define all methods lacking or deprecated in the new API but available in the old one.
    In our example, the code will look like below:

    public class Vector extends ArrayList{
      public Object elementAt (int index){
           return get(index);
       }
    }
  2. Migrate the project from the old API to your temporary class using the Refactoring | Migrate command and create a new migration map like shown on the screenshot:
  3. When migrating, you can preview the usages of the old API with the help of the standard IntelliJ IDEA’s Find window.
  4. After migration, in the temporary class, use the Inline refactoring for each defined method. So IntelliJ IDEA will inline all the methods that are not presented in the new API, but possibly used in your code. As a result, you can switch to the new API without any inconsistencies. In our example, there is only one elementAt() method which is inlined.
  5. Use Refactoring | Migrate once again to migrate from your temporary class to the new API class (in our case, from Vector to java.util.ArrayList). Now you can remove the temporary class.

Don’t say it was hard!

Note   This tip&trick was originally posted at www.javalobby.org.


Technorati tags: , ,

IntelliJ IDEA 6.0 & TeamCity 1.0 Beta Release

Friday, July 28th, 2006

JetBrains is pleased to announce the wide public beta release of IntelliJ IDEA 6.0 and TeamCity 1.0.

We’d like to encourage you to download both beta versions, try them out, and let us know what you think.


Technorati tags: ,, , , ,

Designing GUI with pleasure: live demo

Monday, July 17th, 2006

The live demo showing the enhanced GUI Designer (one of the announced features of the IntelliJ IDEA 6.0 release) is published at Javalobby. The presentation is made by Dmitry Jemerov, JetBrains developer who actually made all the new GUI designer features. Learn how to design Swing UI with pleasure!

Technorati tags: , , , ,

What’s new in IntelliJ IDEA 6.0 and what’s TeamCity?

Thursday, July 13th, 2006

The full list of features for IntelliJ IDEA 6.0 release is now available. Learn more about improved Java EE development, enhanced Swing GUI designer, team work facilitation, and other new features and improvemnts at www.jetbrains.com/idea/features/newfeatures.html.

The overview of the new JetBrains product - TeamCity - is also published. TeamCity is an official name for the “Team Server” that is an integrated team environment which, following the tradition of IntelliJ IDEA, brings the software team productivity to a whole new level. You can learn more about TeamCity at www.jetbrains.com/teamcity/.

And the final news is that JetBrains launched the “Buy IntelliJ IDEA 5.1 now and get Version 6.0 and TeamCity 1.0 for free” offer. Don’t miss the chance - buy IntelliJ IDEA 5.1 or upgrade to it from your current version right now.

Technorati tags: ,, , , ,

Customizing TODO filters

Friday, July 7th, 2006

Note   Contributed by: Esko Luontola

Probably, you already know about IntelliJ IDEA TODO window that finds your “TODO” comments and helps you quickly navigate to them. But did you know that you can work not only with TODO comments, but with any custom pattern?

For example, when you create a quick fix for a problem and don’t have the time to create a proper solution, you write a “hack” and leave a comment. You can start the comment from “Hack” and then explain why this code is bad and what should be done to fix it. Of course, it would be useful to find these comments later and navigate to them like you can do with TODO.

To add a new comments pattern, you need to press “Filter TODO Items” icon in the TODO tool window, and then select Edit Filters.



This will open the TODO dialog, where you can add, delete and modify your patterns. You can also apply filters that will display only certain patterns in the TODO window (to switch between filters, use the same “Filter TODO Items” icon).



When you add a new pattern, you can also specify the text color (it will appear in both the editor and TODO tool window) and the icon that can be used to show the priority.



After that, you can find your “hack” comments in the TODO window.



Technorati tags: , ,

TestNG plugin

Wednesday, June 28th, 2006

IntelliJ IDEA provides JUnit integration out of the box, but it does not mean that you cannot use other test frameworks. TestNG-J is a plugin that provides integration with the TestNG framework in a very similar way to the native IntelliJ IDEA integration with JUnit.
TestNG-J adds its own type of run/debug configuration that allows for running tests. It also displays testing results and highlights failed and passed tests. To learn more about plugin features and configuration, take a look at the plugin overivew.
The plugin is free and can be downloaded and installed using IntelliJ IDEA Plugin Manager. The plugin is available for both IntelliJ IDEA 5.x and EAP versions of IntelliJ IDEA 6.0.

Technorati tags: , , , ,

XML productivity tips

Monday, June 26th, 2006

IntelliJ IDEA is not “only Java” IDE. If you have a license, you don’t need a separate XML editor (as well as HTML/CSS or JavaScript ones). These editors come with IntelliJ IDEA “out-of-the-box”.

Here is a couple of links that may help you with being more productive with XML editing:



One more useful tip is that IntelliJ IDEA completes XML documents even if no schema is specified. All tag and attribute names and values are completed based on what you are typing. IntelliJ IDEA tracks your input and suggests new tag names and attributes for already used tags. It also filters out attributes that have already been specified for a tag, so you don’t have to worry about duplicates.

For example, you typed a tag like this:

<shopitem pricestandard=”200″ pricediscount=”180″ pricevip=”150″ group=”1″ qty=”1000″ id=”188839″/>



When you are about to create another shopitem tag and start typing “price” attributes, you will get the completion:



Start typing another attribute, and IntelliJ IDEA will help you avoid duplicates by removing what you already typed from completion list.



Edit XML with pleasure!

Technorati tags: , , ,

IntelliJ IDEA 6.0: GWT support

Friday, June 23rd, 2006

IntelliJ IDEA always strives for innovations. So, the innovative Google Web Toolkit is supported in forthcoming IntelliJ IDEA 6.0 release. Moreover, you can try it right now - the latest EAP version of IntelliJ IDEA comes bundled with GWT Studio plugin and provides general functionality. See the GWT demo to get the first impression and read the roadmap to see what’s coming next.

By the way, GWT Studio has quite an interesting story. The plugin was originally written by JetBrains marketing director, Alex Tkachman. Yes, we really eat our own dog food and even our marketing staff believes that IntelliJ IDEA is a great tool and tries to make it better in all possible ways.

Technorati tags: , , ,