Mittwoch, 16. Juli 2008

Search for Java casts

Here is a little regular expression which
allows you to search for Java casts.

Its not perfect, but a good starting point.

\([a-zA-Z]+\)

Montag, 7. Juli 2008

Eclipse 3.4 Ganymede and subversion repositories

I tried out the new Eclipse version 3.4.

I really has some nice new features.
But it also was very hard to get it to behave
properly with subversion repositories.

Here are my findings:

1. Don't use subclipse anymore.
The current version does not work properly with Eclipse 3.4

2. It seems that subversive has won the "battle" for default eclipse svn plugin.
( http://www.eclipse.org/subversive )

3. It is now even "included" with 3.4. But you have to select it for installation.

3.5. download and install Eclipse Ganymede
( Eclipse IDE for Java EE Developers (163 MB) )

4. install subversive BEFORE you import any project.
Or you get in trouble.

"Help" -> "Software Updates..." -> "Available Software" -> "Ganymede" ->
"Collaboration Tools" -> "SVN *"

( Please note, that I have installed 3.4 in a new directory with a new workspace,
I do not recommend any other way of installation, due to my SVN plugin switch. )

5. In the Software Updater add a new Site;
http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/

Install the JAVA HL 1.5 svn connector from that site.

5.5. Restart eclipse.

6. Choose "File" -> "Import..." -> Existing projects into workspace.

If everything is correct, you should see your projects and
also in [brackets] the path to the svn server.

7. If you have troubles check the classes directory,
There may NOT be any .svn directories there.
Subversive WILL NOT work correctly if so.

If you have these, close all projects and
manually delete all files in the classes directory.
Then open your projects again.

3 cool Eclipse 3.4 tricks

1. If you have a piece of code in the clipboard,
select a package on the left inside the package explorer.
Then press ctrl+v to automatically create a new Snippet.java
with a class and a main method. Inside ? Your code from the
clipboard, ready to test.

2. If you have a line with a function call like System.getProperties();
Press Ctrl+2, release and then press L.
This create a new variable of the proper type and even
a reasonable name. Its one of the greates time savers !

3. Ever wondered why sometimes the function parameter help
in Eclipse shows the parameters you are currently supposed to enter
and sometimes not ? Well after you type in an object name, type "."
to get the list of functions, then select one and press enter.
Now you get the parameter hints. If you moved the cursor around
and lost the hint, just go behind the inserted function name and
press ctrl+space and then select the function and then press enter.
Basically pressing enter after the selection is the trick.