Book “Distributed Version Control with Git” published in the third edition

I’m proud to annouce that I finally managed to release the third edition of my Distributed Version Control with Git – Mastering the command line book has been released.

The book has grown in size, it is 1/4 larger than the last edition. A big thanks goes to Robin Stocker and Alex Blewitt for providing feedback on this edition.

Git book cover

Posted in Eclipse, Lars Vogel | Tagged | Leave a comment

Introducing the saneclipse project

If you went to one of the software conferences in which the Eclipse IDE was presented it is not unlikely that you went to one of these sessions, called “JDT Kung-Fu” or “Efficient Eclipse IDE usage”. You also find lots of blog entries with tips on how to configure your Eclipse IDE better.

Examples for this include, the default time to get code completion, file extensions registration, additional templates, running jobs in background by default, automatic placement of semicolon and similar settings.

We at the vogella GmbH company got tired of setting up the same values again and again for every workspace. Also we noticed that several of the developers we work together leave the Eclipse default untouched, maybe they are overwhelmed with the options or just don’t know that they can make their life better.

That is why we created the saneclipse project. This project provides a set of plug-ins which:

  • Registers several default file endings in the Eclipse text editor, because opening the system editor is typically not the desired behavior
  • Adds more JDT templates for JFace, Android and Java programmer
  • Configures the preference at startup of Eclipse to defaults we think have proven to be reasonable

You can find its homepage at http://www.saneclipse.com/. The p2 update site is hosted at bintray under http://dl.bintray.com/vogellacompany/saneclipse/ and the source is free available under the EPL at Github.

We hope this helps, the project is relatively new, so we expect to improve that over time. For example the additional templates are not context sensitive, we plan to fix that shortly.

Pull request to improve the project are welcome.

Posted in Eclipse, Lars Vogel | 1 Comment

Publish an Eclipse p2 update site at Bintray (via a shell script)

We at vogella GmbH recently started to use Bintray for the distribution of Eclipse p2 update sites. Bintray is a content delivery system which offers free hosting for Open Source projects. Bintray offers a REST API to upload content and we have written a small shell script which uploads the content of a p2 update side to Bintray and activates it.

You find it at Github https://github.com/vogellacompany/bintray-publish-p2-updatesite/. Pull requests to improve the script are welcome.

I used Bintray-Examples as blueprint for the script. This repo had an example how to upload a RPM to Bintray.

Posted in Eclipse, Lars Vogel | 1 Comment

vogella GmbH is looking for interested students to work in the Eclipse Open Source project

So much to do in the Eclipse platform project. We are looking for students enthusiastic about Eclipse to help us improve it.

See Student – Eclipse Open Source development. Contact hr@vogella.com in case you are interested.

Posted in Eclipse, Lars Vogel | Leave a comment

Defining JDT code templates via the org.eclipse.ui.editors.templates extension point

I recently had again the need to define new Java code templates via a plug-in so that they can be easily shared among a group of developer. I finally took the time to document it, seeAdding code templates to the Eclipse IDE via plug-ins for a short summary of it.

Posted in Eclipse, Lars Vogel | 1 Comment

Make Ubuntu to show all open Windows if you use Alt-Tab

By default Ubuntu only show the windows on the same desktop if you use Alt-Tab. To see the windows on all virtual desktops you have to use Ctrl+Alt+Tab.

This drives me crazy. To change this:

sudo apt-get install compizconfig-settings-manager

ccms

and change the highlighted entries.

ubuntu-virtualdesktop

 

Posted in Lars Vogel | Tagged | Leave a comment

Ignore whitespace changes in Eclipse Git blame

I recently learned that Eclipse GIt can ignore whitespaces changes in its blame annotations.  To enable blame annotation in Eclipse click on your editor border and select “Show Annotations”.
gitblameannotations
To ignore whitespae changes this select Preferences > Team > Git, Ignore whitespace changes. Thanks to Robin Stocker for the tip.
Posted in Eclipse, Lars Vogel | Tagged , | Leave a comment

Migration to JUnit 4

When you’re facing the issue to migrate your JUnit 3 tests to JUnit 4, it can be very annoying, because of course you all have a lot of tests. ;)

In general it is a mindless task to migrate things that have been changed due to a new major release.

For JUnit 4 one of the most popular features, which are new compared to JUnit 3, is the usage of Annotations and Pojos for test classes.

So what has to be done in order to migrate a TestCase:

  1. Remove the inheritance from TestCase
  2. Add static imports for org.junit.Assert methods, as these are not available from inheritance any more
  3. Make setUp() method public and add @Before annotation
  4. Make tearDown() method public and add @After annotation
  5. Add the @Test annotation to your test methods

Quite a lot of work, if you have to do it manually, isn’t it?

In order to automate this “mindless task” a bit, I started to write a migration plugin, which is available on GitHub[1] and also as p2 updatesite on bintray.com[2].

After you have installed this plugin you can trigger the follwing action on every Java project, java package or java class in the package explorer by selecting Soure > Convert to Junit 4.

Convert_to_JUnit4

As one of our aims at the vogella company is keeping the Eclipse code clean and modern the migration of the Eclipse tests to JUnit 4 is currently in progress.

 

[1] https://github.com/SimonScholz/codemodify – Github repo with Sources

[2] http://dl.bintray.com/vogellacompany/junit-4-tools/ – P2 updatesite to directly install it

Posted in Eclipse, Java, Simon Scholz | Tagged , , , | Leave a comment

Accessing the caller information of a method in Java code

Sometimes it is nice to access the caller of a method. Doing this is relatively simple, you can use the getStackTrace() method on the current thread. This returns the call stack in reverse order, e.g. the first element is the own call, the second element the direct caller and so on.

The following example demonstrate how to print out a maximum of 4 callers in the current stack trace:


public void aMethod(){
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
for (int i = 1; i < stackTraceElements.length && i<=4; i++) {
StackTraceElement stackTraceElement = stackTraceElements[i];
System.out.println(stackTraceElement.getClassName() + " Method "
+ stackTraceElement.getMethodName()); //$NON-NLS-1$

}
}

Posted in Java | Tagged | 3 Comments

Automatic error reporting for the Eclipse IDE

Our friends from codetrails have developed an awesome tool to automatically report any error in the Eclipse IDE to the relevant Eclipse project.

If you want to improve our IDE experience in the future I highly recommend installing this tool and activating it.

This is the p2 update site to install it: http://download.eclipse.org/recommenders/updates/milestones/

stacktracesinstall10

Your find a very good user guide under the following URL: Stacktraces and Error Reporting Tool.

Afterwards Eclipse committer will automatically receive error messages (after user confirmation) and can work on the issues which currently annoys you without you spending any time on it. Here is a screenshot of the dashboard for Eclipse committers I extracted from the user documentation guide.

dash

Posted in Eclipse, Lars Vogel | 2 Comments