Archive for August, 2006

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: , ,

Refactoring Web Project with IntelliJ IDEA

Friday, August 25th, 2006

My article about how refactoring can help you develop and maintain Web projects has finally been published at TheServerSide.
I covered various aspects of refactoring as it applies to HTML, CSS, XML and JSP, which are the typical compound that glues up any decent Web project.
Of course I used IntelliJ IDEA to demonstrate all the examples, mainly because I use it everyday (just like all other JetBrains folks do), and I’m quite happy with it.
You are welcome to read the full story - Refactoring: A Must for Supporting Web Projects.
Feel free to leave comments or you can post them right here, your option.

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: , ,

Running Mustang

Thursday, August 17th, 2006

These days I am running a beta of IntelliJ IDEA on a preview release of JDK 1.6.0 (also known as Mustang). Because I use both in my daily work and play, I like to see how the new versions are going to be while I can still have some influence on their implementation. Here is how I do it.
Normally IntelliJ IDEA does not run on a non-supported JDK, so It is necessary to disable the JDK version checking it performs. This is done by editing the idea.properties file that can be found in the bin directory inside IDEA’s installation directory. Add the following line:
idea.no.jdk.check=true

Furthermore, the environment variable IDEA_JDK or JDK_HOME should be set to point to the location where JDK 1.6.0 is installed. This is the JDK IntelliJ IDEA will use to run itself on. If IDEA_JDK is defined, the value of that variable will be used, otherwise IntelliJ IDEA tries to use JDK_HOME. IntelliJ IDEA can now be started with the idea.bat file on Windows or idea.sh on Unix and will be running on Mustang. On the Mac the procedure is slightly different.

Let me tell you first about the bad sides to running IntelliJ IDEA on Mustang, before I get to the good parts. Disadvantage number one, it is unsupported. Any bugs you find in IntelliJ IDEA running on Mustang will most likely not be fixed. At least not before JDK 1.6.0 is released, probably in October 2006. Disadvantage number two, Mustang still has bugs. For example until Mustang build 94, which I am currently using, closing all file editor tabs needed to be avoided at all costs. An exception was thrown and it was not possible anymore to open new files until IntelliJ IDEA was restarted. Currently the most serious bug I know about is slow scrolling in the IntelliJ IDEA editor and diff windows.

And now some advantages. Mustang contains a fix for the infamous “grey rect”. On Windows and Linux a Java frame is no longer cleared with a grey background every time it is obscured and revealed, but it is redrawn from a back buffer containing the frame’s previous contents. The fix has the psychological effect of making IDEA appear more responsive and it looks much better too. Mac users don’t need this fix, as any Java application already looks much better there than on the other platforms.

IntelliJ IDEA with visible gray rect problems

Another Mustang feature IntelliJ IDEA can make use of is the splash screen functionality. Mustang’s Java application launcher has a new command line option which tells it to show a splash screen image while it is starting up. This is especially nice when starting IDEA with the bat file, because the splash screen appears almost instantaneously, while using an older JDK the splash screen takes several seconds to show up.

IntelliJ IDEA logo

To use Mustang’s splash screen with IntelliJ IDEA, use a zip application to open the icons.jar file. This file can be found in the lib directory in the IntelliJ IDEA’s installation directory. Extract from this archive the file idea_logo.png and place it in the IntelliJ IDEA’s bin directory. This is the image that will be used as the splash screen. Now edit the file idea.vmoptions and add the following line:
-splash:idea_logo.png

And that is it. Start IntelliJ IDEA with idea.bat and the splash will appear immediately. After several seconds it will be replaced with the IntelliJ IDEA’s normal splash screen, which also shows you your license information.

Technorati tags:, , ,

TeamCity: user’s experience and new features

Monday, August 14th, 2006

It is always a pleasure to get a positive feedback on the products we develop, especially enterily new ones. We really appreciate the Continuous Integration Revisited post, where the author describes TeamCity’s features and his own experience. He noted that TeamCity’s installation and configuration was really quick and transparent, pointed at the benefits of the Delayed commit feature, and discussed possibility of creating the build configurations using different build runners and testing frameworks for remote code testing.

Now about new features that are not mentioned in this review, since they appeared only in the latest EAP build (that you can download at http://www.jetbrains.net/confluence/display/TW/Download). Among several enhancements and new features, the most important one is displaying of the Code Inspection results in a dedicated tab on Results page. Now you can locate the dead code, find probable bugs, check coding guidelines and specifications violations right on the web. TeamCity’s code inspections are based on the IntelliJ IDEA’s Static Code Analysis and Code Inspection tool, so you can use the power of more than 600 code inspections for remote code analysis.



Right now, you can’t navigate to the discovered problems from the web to IntelliJ IDEA. But this functionality will be implemented in the nearest IntelliJ IDEA EAP builds.

To get the full list of changes and new features in TeamCity EAPs, monitor the changes log.


Technorati tags: , , , , , , ,

XPathView Plugin: Boosting XSL and XML Development

Thursday, August 10th, 2006

IntelliJ IDEA features excellent support for XML development. Smart editor with code completion, error highlighting and other productivity aimed features help create efficient code. However, there is no limit in perfecting the development environment.

XPathView plugin extends IntelliJ IDEA XML and XSL support by providing for:

  • Instant XPath evaluation

    Get the fully qualified XPath expression that identifies certain XML document node. Use it in your application to refer to that node, or create an XSL base stylesheet.

    XPathView plugin: Evaluation

    The plugin also lets you evaluate XPath queries and examine what results they produce. You can define the context and scope for your queries to make XSL scripts debugging yet more productive.
  • XSL aware completion and highlighting

    XPathView extends IntelliJ IDEA completion and error highlighting to make XML development even more productive.
    XPathView is aware of all functions, variables and other entities defined within an XSL stylesheet…

    XPathView plugin: Code Completion

    ….and of parameters defined for specific templates.

    XPathView plugin: Code Completion

    The plugin recognizes XSL specific errors, like missing function parameters, unresolved references, incorrect expression and XPathView syntax and more.

    XPathView plugin: Error Highlighting
  • XSL aware refactorings

    XPathView provides for refactoring of template, function, parameter and variable names. Inline and introduce refactorings let flexibly manage XSL code and replace expressions with variables and vice versa.

    XPathView plugin: Refactoring

  • XSL aware intention actions
    XPathView features intentions for transforming XSL code. For example, converting xsl:if into xsl:choose

    XPathView plugin: Refactoring
  • XSL debugging run configurations

    Plugin supports creating run configurations through the standard IntelliJ IDEA settings dialog. You can use it to test and debug your XSL scripts, verify stylesheet output, etc. just like you would do that with an ordinary application. Plugin lets pass specific parameters to scripts at runtime and supports for multiple output formats, including IntelliJ IDEA console and user defined files.



For more detailed information about XPathView and complete feature list, visit its home page

XPathView is freeware and available for installation through IntelliJ IDEA Plugin manager.

You can also dowload it from IntelliJ Plugin Repository

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: , ,

InteliJ IDEA Plugins: Accessing XML through IntelliJ IDEA DOM

Wednesday, August 2nd, 2006

Peter Gromov, one of IntelliJ IDEA developers, shares his knowledge about utilizing IntelliJ IDEA 6.0 XML DOM power in the field of plugin authoring.

Peter wrote the article that describes the key principles of working with XML data through this DOM and quickly outlines how it can be used to empower and simplify plugin development with the latest version of IntelliJ IDEA.

Read the full story

IntelliJ IDEA 6.0 is now avaliable as beta version. The complete release is scheduled to the mid of fall, 2006.

Technorati tags: , , ,