IntelliJ IDEA 6.0 Reviewer's Guide

advertisement
The most intelligent Java IDE around
IntelliJ IDEA 6.0
Reviewer’s Guide
IntelliJ IDEA 6.0 Reviewer’s Guide
Your Invitation to Review
Thank you for taking the time to look at this Guide to JetBrains IntelliJ IDEA 6.0 – by
far the most technically advanced, innovative and developer centric Java IDE.
This Guide is not a complete roadmap to IntelliJ IDEA 6.0’s new features. We
have included information we thought would help you minimize the time needed
to write an informed review.
It is important to note that the impact of using IntelliJ IDEA 6.0 does not result
from its new features alone. It comes from the way they are integrated, from the
most powerful code editing features on the market, from its continuing technological leadership in automating difficult procedures like refactoring and code
analysis, and – most of all – from how it all ties together into a developer experience unmatched by any other IDE. JetBrains IntelliJ IDEA 6.0 is, simply, the perfect environment for Java, Java EE and Web developers who want to “Develop
with pleasure!”
Support and Information
If you have unanswered questions, just give us a call and we’ll be glad to provide
the required answers or hook you up immediately with someone who can. Simply
contact:
JerAnn Oreshnikova
Marketing Director, JetBrains s.r.o.
Ann.Oreshnikova@jetbrains.com
Alexander Morozov
Marketing Manager, JetBrains s.r.o.
Alexander.Morozov@jetbrains.com
Useful Links
• A detailed guide to new features in IntelliJ IDEA 6.0 release is available at
http://www.jetbrains.com/idea/features/newfeatures.html
• A detailed guide for all the product features is available at
http://www.jetbrains.com/idea/features/index.html
• The history of JetBrains is available at
http://www.jetbrains.com/company/jbstory.html
• A timeline is linked at
http://www.jetbrains.com/company
• User testimonials can be reviewed at
http://www.jetbrains.com/company/customers
• Key JetBrains executives are introduced at
http://www.jetbrains.com/company/people/executives.html
• The company’s many awards are shown at
http://www.jetbrains.com/company/press/awards.htm
Your Invitation to Review
IntelliJ IDEA 6.0 Reviewer’s Guide
Introduction
This new version of IntelliJ IDEA comes with a great number of new features and
embedded tools, to support developers that specialize in different Java-related
development aspects.
• Enterprise & Web Development
General improvement of Java EE and Web development including support for
EJB 3.0 and several new frameworks such as Struts and GWT. Web development features supporting JavaScript, AJAX, HTML/CSS, XML, JSP, and JSF
are also significantly enhanced. Plus now IntelliJ IDEA integrates with more
application servers for easier deployment and debugging web applications.
• Enhanced Swing GUI Designer
Enhanced and extended Swing GUI designer that supports different layout
managers, provides many new usability features, and allows for fast and intelligent import of existing user interfaces, either hand coded or created in other
UI designers.
• Team Work Facilitation
Integration with TeamCity - a new JetBrains product for software development
teams to solve problems related to continuous integration of code changes by
multiple developers; plus a new team collaboration tool that lets developers
exchange text messages, exceptions, code pointers, and code changes without leaving the IDE.
• Numerous New Features & Enhancements
New and improved testing and static code analysis tools including code coverage, integration with JUnit 4, and new code inspections for Java and Java
EE. Among other improvements are new refactorings and intention actions,
project-wide error highlighting, and searchable Settings dialog.
This guide will look at these features in more detail further on.
System Requirements
Before installing IntelliJ IDEA 6.0, please make sure that all the system
require¬ments have been met:
http://www.jetbrains.com/idea/download/system_requirements.html
Installation
You’ll find the installers at http://www.jetbrains.com/idea/download/.
When you choose the installer program for your OS, installation instructions will
appear in a popup window. Installation takes only minutes.
Introduction
IntelliJ IDEA 6.0 Reviewer’s Guide
Enterprise & Web Development
EJB 3.0 support
IntelliJ IDEA lets you incorporate EJB in your projects and supports all EJB specification levels from 1.1 to the latest 3.0.
For all EJB specifications, IntelliJ IDEA simplifies development by providing EJBaware refactoring, code completion, error highlighting, quick fixes, intentions actions, and more for both enterprise beans and deployment descriptors.
For easier switching from earlier EJB specification to 3.0, IntelliJ IDEA provides
powerful migration assistance that automatically performs the following actions:
•
•
•
•
Convert EJB environment access
Rebuild EJB deployment descriptors
Transform EJB interfaces
Turn Entity Beans into Container Managed Persistence
To get this migration assistance, right-click the bean or the whole EJB module
and select Apply EJB 3.0 style.
EJB persistence management
IntelliJ IDEA helps you to easily create entities, listeners, and embeddable
enterprise beans. For managing EJB persistent entities and their relationships, it
also provides a convenient EJB persistence diagram that you can see by rightclicking a Persistence Unit and selecting Open ER Diagram.
Enterprise & Web Development
IntelliJ IDEA 6.0 Reviewer’s Guide
Another important part of IntelliJ IDEA’s support for EJB persistence is an ability
to quickly generate entities from a Hibernate or JDBC source.
To generate a persistence unit based on your database schema, you first need
to configure the data source (Tools | Data Sources). Then right-click the EJB
module, and select Generate Persistence Mapping | By database schema to
open the dialog box where you can specify how to map tables to entities.
Enterprise & Web Development
IntelliJ IDEA 6.0 Reviewer’s Guide
JSF
Native support for JavaServer Faces technology makes development of Web
applications easier than ever.
IntelliJ IDEA leverages the support for JSF through all its productivity aimed features:
• JSF-aware coding assistance with code completion and formatting:
• Dedicated tools for better JSF handling–configuration editor with intelligent
error highlighting
• Plus, the extended page navigation view with the support for managed beans
and page flow display
Additionally since version 6.0 IntelliJ IDEA supports the JBoss Seam, with code
validation and completion and also provides for automatic generation of JSF
data access pages for easier Web interface prototyping.
Enterprise & Web Development
IntelliJ IDEA 6.0 Reviewer’s Guide
Struts support
Develop Struts applications with pleasure. IntelliJ IDEA 6.0 features native Struts
support:
•
•
•
•
•
•
•
•
Visual configuration editor
Built-in properties inspector
Integrated code completion, navigation and highlighting
Struts-aware refactorings
Native Support for Tiles and Validator
Built-in inspections, quick fixes, and intention actions for Struts mappings
Nested bean properties support
Support for comma-delimited lists
Enhanced JavaScript editor
IntelliJ IDEA features DOM based browser-specific completion for JavaScript code.
Properties and methods specific for Internet Explorer, Mozilla, Opera and Safari are
highlighted. This helps when creating scripts intended to run on multiple client
platforms.
The powerful Inspection-JS plugin is now part of the standard IntelliJ IDEA distribution, ensuring higher quality of your JavaScript code.
Enterprise & Web Development
IntelliJ IDEA 6.0 Reviewer’s Guide
Along with the best-of-breed AJAX development support, new code refactorings
and support for popular JavaScript frameworks like Dojo, Bindows and Prototype
are added to further improve the productivity and quality of JavaScript development in IntelliJ IDEA.
Improved HTML, CSS, and XML support
Select Analyze | Inspect Code and click OK to open the improved Inspection
Results window that lets you quickly navigate through the list of code errors and
instantly fix problems without having to open the files.
Structural search and replace lets you refactor your HTML and XML files and
perform batch structure updates with the help of fully customizable patterns.
JSP editor improvements
IntelliJ IDEA 6.0 features enhanced JSP code completion that supports property
file reference handling.
Now you can create custom Tag Libraries that can be used across multiple JSP
and JSPX files to implement specific JSP page elements that are reusable on
any web server where the corresponding Tag Library is installed.
Google Web Toolkit support
IntelliJ IDEA helps you to quickly generate stubs of different elements for Google
Web Toolkit (GWT) applications. You can add them just as you add classes or
packages to your project – just right-click the package in your Java module, and
click New | Google Web Toolkit, and then select the element to create.
For GWT application components, IntelliJ IDEA provides basic refactorings,
navigation actions, code inspections and quick fixes in the same way as for Java
or other supported web frameworks. The JavaScript embedded into native GWT
methods also gets the full gamut of coding assistance.
Enterprise & Web Development
IntelliJ IDEA 6.0 Reviewer’s Guide
Integration with the GWT compiler allows you to quickly run and debug GWT
application directly from IntelliJ IDEA. All you need is to add the GWT run/debug
configuration to your project and click Run.
To learn more about Google Web Toolkit support in IntelliJ IDEA, please see the
GWT Studio Live Demo.
New application server integrations
In addition to previous Tomcat and general JSR45 compatible server support,
IntelliJ IDEA now provides quick and easy deployment to the following servers:
•
•
•
•
•
WebLogic 9.0 support
WebSphere support
JBoss
Geronimo
Glassfish
To enable deployment to a specific application server, you just need to add the
corresponding run/debug configuration.
Enterprise & Web Development
IntelliJ IDEA 6.0 Reviewer’s Guide
Enhanced Swing GUI Designer
We highly recommend you to view the GUI designer demo before reading this
section. The demo shows how to create a form using the JGoodies layout manager, quickly add listeners, navigate between the form and Java code, internationalize UI, and migrate hand-written UI or forms created in other UI designers
to IntelliJ IDEA’s GUI designer.
New layout editing interface
IntelliJ IDEA automatically creates Grids and grid cells when you drop a component on the form. Keeping with its famous keyboard-centric approach, it enables
you to use the keyboard to edit layouts, select, add, move, resize components,
and perform other essential actions. Of course, everything can also be done with
the mouse.
In addition to already available actions such as quick creation of class fields for
UI components, this release adds three more:
• Surround With (Ctrl+Alt+T)/Flatten for wrapping/unwrapping selected components in a JPanel, JScrollPane, etc.
• Duplicate (Ctrl+D) for creating a copy of the selected components in the next
row
• Morph action, for converting component to a different class, while preserving
its properties (available from shortcut menu)
Java code integration
When you add a component to a GUI form, IntelliJ IDEA automatically generates
a corresponding field in the class to which the form is bound, and names the
field according to the component’s name or the text of an assigned label. For
example, if you have a list component with an assigned label, and the label text
is “Font name”, the name of the list will be “fontNameList”.
You can quickly add listeners to components right from UI designer – just press
Ctrl + O on the selected component and select the necessary listener. The anonymous listener class will be generated in the bound GUI class, to which you can
quickly navigate by pressing Ctrl + Alt + B. To navigate back to the GUI Designer,
click the icon next to a field that is bound to some UI component (see figure below).
Enhanced Swing GUI Designer
IntelliJ IDEA 6.0 Reviewer’s Guide
Enhanced compatibility and flexibility
One of the main advantages of the new GUI Designer is that generated code no longer requires runtime library. This facilitates application distribution and licensing.
The next advantage is an ability to use components that are created by custom
Java code. The new Custom Create property for GUI components enables you
to flag components to be skipped by automated code generation so you can
control how they are created. IntelliJ IDEA creates a constructor method in the
bound source code file and navigates you right to it so you can write your custom
code.
Custom containers are also supported. Now, when you add components to the
component palette, you can specify a component as a container.
The component palette also enables you to choose any GUI component class in
a project and place it into a GUI form, even if the component has not been added
to the palette.
Last but not least is the new “nested forms” feature which enables you to reuse
your already designed forms. Just right-click the .form file in the Project view,
and select to add it to the palette. The form will appear in the Palette tool window, so that you can drop it into any other form just as you would do with regular
GUI components.
GUI internationalization
Since version 5.1, text values in GUI components can be specified either by
“hard-coded” strings, or read from a specified resource bundle. In the new release, you can create and maintain “i18n” property files and keys directly from
the GUI designer. The designer highlights hard-coded String literals, and provides intention actions with Quick Fixes enabling you to quickly replace them with
property keys, or mark them as not requiring internationalization.
When you have multiple localizations for a GUI form, you can switch locales with
a single click to see how any variant looks at design time.
Enhanced Swing GUI Designer
10
IntelliJ IDEA 6.0 Reviewer’s Guide
Complete support for Swing features
The GUI designer now supports more layout managers including:
•
•
•
•
•
•
•
GridBagLayout
GridLayout
CardLayout
BorderLayout
FlowLayout
BoxLayout
JGoodies
The improved GUI Designer extends the set of properties supported for Swing
components, and adds a number of GUI Designer-specific properties that make
layout and alignment easier and more efficient. The default component palette
now contains JSeparator, JProgressBar, JToolBar, and JScrollBar. More border
types are supported for containers. New smart grouping automatically detects
components which should probably be grouped (radio buttons for example), provides a Quick Fix to create the group, and visually indicates component groups
in the GUI Designer.
Migrating forms to GUI designer
You can convert both hand-coded GUIs and GUI forms created in other designers
to IntelliJ IDEA’s GUI Designer with the following simple steps:
. Open the Java application containing the GUI to be migrated in IntelliJ IDEA.
. Right-click the Project view, and select New | Form Snapshot.
3. Create a new run configuration or open an existing one (if any), so IntelliJ
IDEA can launch the application.
4. In the running application, open the dialog you want to capture, then switch
back to IntelliJ IDEA and take the snapshot.
You can capture an entire dialog form or any part of it. Either way, IntelliJ IDEA
migrates both layout and component properties.
Enhanced Swing GUI Designer
11
IntelliJ IDEA 6.0 Reviewer’s Guide
Team Work Facilitation
TeamCity integration
IntelliJ IDEA fully integrates with Team City, JetBrains’ new team productivity tool
that is being released concurrently with version 6.0. This new, IDE independent,
integrated team environment is targeted towards both software developers and
their managers, helping them to solve problems that typically bog down development teams. TeamCity has a dedicated IntelliJ IDEA plugin that provides quick and
easy access to its main features directly from the IDE. You can learn more about
TeamCity at www.jetbrains.com/teamcity.
Team Work Facilitation
12
IntelliJ IDEA 6.0 Reviewer’s Guide
Developer collaboration
Now developers can communicate with each other and discuss their code without leaving the IDE. The new release includes an Instant Messaging client plugin,
“IDE Talk”, that provides such standard actions as exchanging text messages,
management of contacts, and navigation through message history, plus unique
code-related communications allowing developers to:
• Send a “code pointer” - a reference to a particular point in a file with one-click
navigation directly to the referenced point
•
•
•
•
Send stacktrace with direct links to underlying source code
View difference between project files opened by two team members
View a list of files opened in IntelliJ IDEA by any IDE Talk contacts
Manage others’ access to the IDE project files
The bundled IDE Talk client is accessible via a tool window located by default
along the right edge of the main frame. Click the IDE Talk button to open the list
of contacts. To populate the list, click the top-left button on the client’s toolbar
and add colleagues using the local network protocol. If the development team
is geographically dispersed, you can search for contacts by Jabber ID (to learn
more about Jabber protocol, please refer to http://www.jabber.org/).
VCS integration improvements
IntelliJ IDEA integrates with several Version Control Systems, including Subversion, Perforce, CVS, StarTeam, and Visual SourceSafe. This release not only
improves integration with supported VCSs, but also provides a unified user interface for committing/uploading changes to any of them.
No matter what VCS developers use, the dedicated Changes tool window shows
“change lists” – sets of modified files organized on some principle (e.g. files related to certain tasks). This view allows developers to quickly commit and roll
Team Work Facilitation
13
IntelliJ IDEA 6.0 Reviewer’s Guide
back changes, view differences between two file versions, and more. To open
the Changes tool window, click the Changes button at the bottom edge of the
IntelliJ IDEA main window.
Sharing run configurations
Run configurations can now be saved in the project file, which allows sharing
them among team members. To enable configuration sharing, select the Share
configuration check box when creating or editing a run/debug configuration.
Numerous New Features & Enhancements
Enhanced coding assistance and refactoring
IntelliJ IDEA constantly extends its robust set of refactorings and coding assistance features with each new release. This release adds intention actions related
to field initializers and constructors (for example, “create constructor from usage”), improves functionality and usability of several refactorings, and introduces
one entirely new refactoring – Invert Boolean – that changes the sense of the
Boolean method or variable to the opposite one.
Extended code analysis features
Automated code analysis becomes even more powerful with IntelliJ IDEA 6.0.
Besides adding several new code inspections to the more than 600 inspections
already provided, IntelliJ IDEA now enables you to create custom inspections
based on the Structural Search & Replace template.
If you want to create your own inspection, choose Errors in the Settings dialog
(opened by Ctrl + S), and when switch on the Structural Search inspection.
There you can add the necessary templates. To learn more about these templates, please refer to the “Structural Search and Replace: What, Why, and Howto” article at www.jetbrains.com/idea/documentation/ssr.html.
One more powerful feature added by this release is the possibility to define scopebased inspection profiles. While an inspection profile in general allows you to
configure the set of rules according to which your code is to be analyzed,
Numerous New Features & Enhancements
14
IntelliJ IDEA 6.0 Reviewer’s Guide
scope-based (or “project”) profiles allows assigning different inspection sets to
arbitrary parts of the project.
Project-wide error-highlighting
Files containing compilation errors as well as packages containing such files are
now highlighted right in the Project and Packages views. To turn on the highlighting in the newly opened project, you need to make or compile it first. After
that, the tool window will keep reflecting the error status of your project.
Code coverage
IntelliJ IDEA helps you measure the code coverage of your unit tests, or tests
written as simple applications with the main() method, without leaving the
IDE. The code coverage engine is based on the EMMA open-source toolkit
(see http://emma.sourceforge.net/ for more information).
To switch on the code coverage feature, open your project’s run/debug configuration, and on the Code Coverage tab select the Enable code coverage check
box. Then you simply need to run or debug your application.
Numerous New Features & Enhancements
15
IntelliJ IDEA 6.0 Reviewer’s Guide
After the application has run, you can view the code coverage results either in the
Project view (press Ctrl+Alt+F6), or right in the editor.
This feature as implemented by IntelliJ IDEA brings several technical innovations
to the Java code coverage field. Most important are on-the-fly code coverage
execution with no class pre- scanning phase, and display of correct coverage
information for files edited after coverage statistics have been gathered.
Navigation bar
Now IntelliJ IDEA provides an alternative to the Project view for easier navigation to recent or neighboring files. Just press Alt + Home and use arrow keys to
locate the necessary file (or invoke actions from the context menu).
JUnit 4 support
Now IntelliJ IDEA’s test runner, on-the-fly test statistics, and test results tree fully
support the JUnit 4 test framework.
Searchable Settings dialog
IntelliJ IDEA’s extensive settings can now be quickly and easily searched, to
locate just the option(s) you want to configure. Simply type a keyword in the
Search field, and IntelliJ IDEA will highlight related settings groups. Opened dialogs and tabs set their filters in accordance with the keyword entered in the Settings dialog.
Numerous New Features & Enhancements
16
IntelliJ IDEA 6.0 Reviewer’s Guide
@NotNull annotation runtime assertions
IntelliJ IDEA’s compiler can be configured to track @NotNull annotation compliance during the application runtime by selecting the corresponding check box in
the compiler settings.
Let’s illustrate how this feature works. For example, you have the following code:
At program run-time, if the @NotNull-annotated expression evaluates to null, an
exception is thrown.
Numerous New Features & Enhancements
17
IntelliJ IDEA 6.0 Reviewer’s Guide
Extended Open API
IntelliJ IDEA constantly extends its Open API providing plugin developers with
easy access to its functionality. From version 6.0, plugins can contribute to
IntelliJ IDEA static code analysis by creating their own “global” inspections (the
ones that analyze the structure of more than one file in the project), add support
for different injected languages (like SQL included into Java code as strings),
and add coding assistance for different XML-based languages.
THANK YOU
Thank you for taking IntelliJ IDEA 6.0 for a spin! If you have more questions, don’t
hesitate to contact us!
Numerous New Features & Enhancements
18
Download