Getting started with eclipse RCP development
Lars Vogel is maintaining a really helpful set of up-to-date articles about eclipse RCP programming.
My eclipse 3.5 blog entry has been promoted to be published by the German "eclipse magazin"
A while ago I had written this blog entry about the upcoming eclipse 3.5 release. The german “eclipse magazin” asked my if I would share this blog for being published in their next issue. Today I received a printed copy of this issue. They actually allocated almost a page for this
eclipse 3.5
Since eclipse 1.0 has been released back in November 2001 it has evolved into a pretty popular and feature rich IDE. I remember using eclipse 2.0.1 first time, it was pretty much only a Java development IDE with little support for application containers.
Soon eclipse 3.5 (galileo) arrives supporting a wide palette of programming languages, programming models and execution environments, application containers, etc. The past 3 months I had been testing galileo from early milestone releases and been happy with it – also with my favourite eclipse plugins that I use in my daily business.
Here I briefly show some of the many features that I like:
Install New Software
I believe with eclipse 3.4 the user interface for updating/installing plugins has been pretty much messed up. Seems the eclipse engineers have done a good job to fix it up again. It has never been so easy and intuitive (with drag & drop support for update-site URLs) to install and update an eclipse plugin. But even more important, now it is possible to export bookmarks of your favourite plugins (you can select them plugin by plugin) and import them into another eclipse installation (e.g. for switching to a new eclipse release).

Type Filter (eclipse 3.4)
With a large number of libraries in the classpath it gets pretty overloaded in the type search dialogs. Mostly you find lots of classes that you never want to deal with directly. E.g. classes from the com.sun.* packages. Still you have to skip over them while searching for some other classes.
By defining a type filter you can suppress any package you are not interested in.

toString() Method
I usually would use the ToStringBuilder from the Apache commons-lang package to implement any toString() method.
As of eclipse 3.5 the Source->generate toString()… feature can be customized to support the commons-lang ToStringBuilder pattern.

Format edited lines only (eclipse 3.4)
In a team environment it is important that everybody is using the same formatting rules for auto-formatting the source code. Otherwise code comparison / mergeing can get pretty nasty. However sometimes this is not the case. Still eclipse can help to minimize the impact of autoformatting. You can choose the option to format only the code portion that has been actually changed.

Breadcrumbs (eclipse 3.4)
Eclipse has always had a perspective called Java Browsing (some heritage from good old Visual Age). I never really liked it, as it consumes quite a lot of space of the workbench.
With eclipse 3.4 the eclipse team introduced the so called breadcrumbs (Alt-Shift-B) which is showing almost they same information but much is more compact. It allows you to quickly jump between packages, classes, members, etc.

Block selection
Alt-Shift-A activates a special editing mode where it is possible to select any rectangular text area and copy / paste it.

Flex Builder plugin installation
A few days ago I had installed the Flex Builder Plugins on a staging eclipse ganymede installation where I typically would test plugins. The installer created a link
d:/Java/Flex Builder 3 Plug-in
To activate this plugins in my productive eclipse installation I just copied this link file and restarted eclipse but the flex plugins didn’t get activated. After a while I found a discussion in some Adobe forum.
So I changed the contents of the link file to:
path=d:/Java/Flex Builder 3 Plug-in
Now it works!
Unfortunately the eclipse documentation on this also didn’t clarify that.
Register XML schema in eclipse XML catalog
Sometimes XML schemas don’t get published to public sites but are provided as part of of a jar etc. Under these circumstances it’s impossible for a XML editor to perform proper validation of a XML document against its XML schema.
eclipse allows registering schemas in its internal XML catalog in various ways. Open the XML Catalog property sheet in the preferences dialog and add the schema location.
An example for registering a schema in a jar:
Location: jar:file:D:/workspace/mvn-repositories/local/org/apache/activemq/activemq-core/5.1.0/activemq-core-5.1.0.jar!/activemq.xsd
Key Type: Schema Location
Key: http://activemq.apache.org/schema/core/activemq-core.xsd
eclipse ganymede – New Save Action Option
I am absolutely convinced that source code must be formatted according to rules a team agrees on. Therefore I have my Save Actions setup for auto-formatting my code (by the way I just rely on the eclipse built-in rules, I would only adjust the line length to 120) every time it is saved.
For those whow often need to fix/change unformatted code (code that is not auto formatted at all) are going nuts. Once you start comparing with older revisions you can’t actually tell anymore what exactly you have modified, the auto-formatter has done a damn good job!
So now you can set an option that only formats actually modified lines code.
eclipse 3.3 and WAR file imports
eclipse 3.3.1.1 has an annoying bug. Try to import a WAR file that contains class files in WEB-INF/classes. Thes class files are not imported into the right folder in the imported project structure.
Importing a WAR file gets you a special folder ImportedClasses which is supposed to contain the package/folder structure for imported classes. Due to a bug in the eclipse WAR importer they are copied to ImportedClasses/WEB-INF/classes. As a result, starting a deployed web application presents plenty of ClassNotFoundExceptions and the like.
Today I tried this again with eclipse 3.4-M4 and was glad to see this bug fixed, I was already preparing to file a bug. Until 3.4 is released the classes must be moved manually to the right folder!
eclipse the memory hog
Occasionally I have to help people with this painful java.lang.OutOfMemoryError: PermGen space because it is running out of PermGen space. Here I have found a good article explaining the necessary setting – in future I can just direct them to my posting and they can help themselfes
Maven2 eclipse web tools platform integration
When developing web applications it’s always been a hassle to keep the WEB-INF/lib folder up to date especially when starting to experiment with different versions of libraries or frameworks .
In the past (since being a Maven2 user) I helped myself with issuing the mvn war:inplace command to pull in all required libraries into WEB-INF/lib. So, occasionally I only would update my POM and rerun the command to have the latest versions of jars in my project!
This is extremely handy when using profiles for example to switch dependencies between a set of JSF 1.1 or JSF 1.2 libraries. Only with a twinkle I could change the classpath definition for any project. Ok so far this is nice.
For server development I’m working with the WTP plugin which makes handling a server a bit easier. So, regarding my library dependencies I’d feel more comfortable if they were updated every time I started my server (and thus publish the latest project files to the server).
So, I updated my m2eclipse plugin to 0.0.11 and tried to mark the Maven Dependencies Library Container as a J2EE Dependency, restarted my Web Container and was really excited that finally this is supported now. This means all of my dependencies from pom.xml are actually deployed to the server.
Eclipse Type Browser Filter
As Java evolves it grows continually in terms of numbers of classes. Type browsing is getting more and more a tiring task even when using wildcards and the camel case search notation. Just too many internal classes appear that are not supposed to be used by clients anyway (they make up the internal implementation of Java APIs). So this is a good reason to hide them anyway.
So go to Preferences->Java->Appearance->Type Filters and add any package or type filter. I have found useful to add at least
- com.sun.*
- sun.*
- sunw.*



