Saturday, June 27, 2009

Eclipse Galileo - The first impression

During the last 5 years it became sort of tradition: I'm waiting till the end of June to download the latest release of Eclipse. The cynics usually say: "Wait for the first SP, the release is always full of bugs!" But I'm never patient enough to wait.

Usually I'm downloading the JEE bundle (the one that previously was called "wtp-all-in-one") and this is exactly what I did this time. The budnle's size for Galileo became larger: 189MB.
The Europa was 126MB and Ganymede was 163MB. Actually wtp-all-in-one 2.0.1 was 259MB, so 189MB is not that large.

Before launching Eclipse, I always take a look to eclipse.ini.
The good news: It now contains predefined memory settings, so it doesn't use the JVM defaults. And you don't need to remember how to set -Xms and -Xmx ("after -vmargs that must be the last arguments in the command line..." and so on).
Somehow it contains the double definition of launcher.XXMaxPermSize (a bug?)
In addition, I prefer setting also PermSize to 256MB and setting both -Xms and -Xmx to the same size: 512MB.
For the first run I decided to leave these settings as is.

So let's see it running... Wow, it started quite fast. If Eclipse became faster, it's really the good news. It always was somewhat slow.

The "Welcome" page. Also different. OK, links to JEE sub-projects... Here it is, the "What's New" section. Click. Click. Click. Hey! What's going on? Nothing happens! Samples? Tutorials? Workbench? Oh, finally it worked. Here comes the Workbench. And where is "What's New"?
Listen, folks, it's very disappointing that you put broken links on the "Welcome" page.

Anyway I think I can find "What's New" section myself: Help -> Help Contents. Wow! This was quick! Workbench User Guide -> What's New in 3.5. Great!

Don't be frightened. I'm not going copy here the whole "What's New" section. I'll only mention the bullets I have really liked:
1. Switching between open editors and multiple editor pages has been streamlined. Ctrl+PageDown and Ctrl+PageUp now always activate the next or previous editor tab, even in multi-page editors. To switch between pages of a multi-page editor, use Alt+PageDown and Alt+PageUp. - Cool! I really hated the previous situation, when multi-page editor makes you stuck, when you're using Ctrl+PageUp to switch between the open editors.
2. The whole "Install New Software" section has been completely changed again. I say "again", since it was completely changed just one year ago. From the first look, it's better now. I've installed CollabNet Desctop pretty smoothly.
3. Textual editors now support block (aka column or rectangular) selection mode. Quite a cool feature.
4. An Open Implementation hyperlink has been added for overridable methods, which directly opens the implementation in case there's only one, or shows all the concrete implementations for that method in the hierarchy of its declaring type, using the quick type hierarchy. By default, the hyperlink appears when you hold down the Ctrl key while hovering over an overridable method.
5. And here comes the coolest feature till now: The new toString() generator allows you to quickly generate a toString() method for your class. I was really missing this feature!
6. As usual there are compiler enhancements with new warnings. Nothing really special, but it's nice to have them. I'm still waiting for the warning about calling non-private methods from the constructors.
7. And the last enhancement, I would like to mention, is using Plug-in Spy in menus. Previously, it was possible to open a Plug-in Spy from Views and Editors only. Now its abilities were extended to menus: click Alt+Shift+f2 and select the menu.

So these were my favorite features from the "What's New" sections. In addition, I paid attention to some unmentioned (but still cool) content assist features. For example, when creating an anonymous class from the interface, the methods are generated automatically.
I believe there are many more features I didn't pay attention yet.

Let's sum up: The first impression from the Eclipse Galileo is very positive. The bugs I paid attention till now are minor and there are a lot of cool features.
In addition, I have a feeling that Eclipse Galileo is faster then the previous release. I hope it isn't just a feeling and that it IS faster.
I'll continue using Galileo and promise to report anything that is worthy mentioning in this blog. So follow up :)

Sunday, June 14, 2009

Eclipse: Fixing Copyright (Copyright Tool)

It's possible to fix (or to set) the Copyright notice in the beginning of the file.
The plugin that fixes copyrights is not included by default in the distribution, but it can be downloaded using the Eclipse update site.
It's called "Eclipse Releng Tools".

The copyright header is set using Window -> Prefernces -> Copyright Tool.
In order to set this header for the whole project, switch to the "Resources" perspective and select "Advanced Fix Copyrights".

Wednesday, June 10, 2009

Calling non-private methods from constructors

Every time I join a new project there is usually a discussion about the Coding Guidelines. Usually it includes stupid guidelines, like "use underscore prefix with the fields" or "end constants with "CN".
In extreme stupid cases the guidelines require surrounding methods with "try-catch" blocks, while catch does something like "log.error(exception); return null;" and later it becomes impossible to understand from the log what actually has happened.

Usually I insist on adding the following guideline: "Never call methods that can be overridden by a subclass from the constructor." It means that if you decide to call a method from the constructor, it should be either private, or static, or final. It's also possible to declare the whole class final.


Run the following example and see what happens.
public class Base {

public static class A {

public A() {
printHello();     // calling method from constructor

protected void printHello() {

public static class B extends A {

private String helloWorld = "Hello world!";

public B() {


// override printHello
protected void printHello() {
System.out.println(helloWorld.length());    // Null pointer exception will be thrown here.

public static void main(String[] args) {
B b = new B();


Recommended Reading

1. How Would You Move Mount Fuji? Microsoft's Cult of the Puzzle - How the World's Smartest Company Selects the Most Creative Thinkers
2. User Interface Design for Programmers
3. Code Complete: A Practical Handbook of Software Construction

Tuesday, June 9, 2009

Encoder 0.5.0

It's was a long time, since the previous release of the Encoder. Actually I didn't work much on the Encoder's functionality, but I did a lot of enhancements to the Dynamic Dialogs functionality. Interesting if someone, but me, really uses it...

Anyway 0.5.0 version is ready. It requires Java 6 and Eclipse 3.4.2.
Apart of enhancement to the Dynamic Dialogs it includes the following features:
1. Hitting Ctrl+A in the text areas will perform "Select All".
2. The text areas now support different encodings when transforming from text to bytes.
3. The input text area was enhanced with "Import" functionality, which allows importing a binary file to the input text area.
4. Both input and output text areas were enhanced with the "Export" functionality that save the content of the area to a file. For text, the defined encoding will be used.

I didn't create a standalone distribution this time, but only an Eclipse plugin. If you want it as standalone, please let me know in the comments, and I'll create it for you.

Enjoy :)