Define Eclipse shortcuts in Unity (Ubuntu)

I wanted to define Eclipse shortcuts in Ubuntu pointing to my individual workspaces.

You can define Eclipse shortcuts including parameters, e.g. the -data parameter via a .desktop file. Once defined you can drag the file into the Dash of Unity to get a new entry (including your shortcuts).

[Desktop Entry]
Icon=application-x-executable
Name=eclipse
Type=Application
Exec=/home/vogella/Eclipse37/eclipse -data /home/vogella/workspace/docu

X-Ayatana-Desktop-Shortcuts=Docu;vogella;

[Docu Shortcut Group]
Name=Docu
Exec=/home/vogella/Eclipse37/eclipse -data /home/vogella/workspace/docu
TargetEnvironment=Unity

[vogella Shortcut Group]
Name=vogella
Exec=/home/vogella/Eclipse37/eclipse -data /home/vogella/workspace/vogella
TargetEnvironment=Unity

This should create an entry in the menu with two quick links to your workspaces.

Thanks to Holger Joest for helping with that on G+.

Posted in Eclipse | Tagged , , | 5 Comments

Thanks for the Eclipse Top Newcomer Evangelist Award 2012

Thanks everybody for voting me to the Eclipse Top Newcomer Evangelist Award 2012.

I enjoy being part of the Eclipse community, a community which is small ;-) , friendly and well educated.

Receiving the award is a great honor and I hope that my work as Eclipse Evangelist will continue to help other learning and embracing the Eclipse platform.

I’m very sorry that I can’t join EclipseCon in the US, my best regards to all EclipseCon visitors. Enjoy this great conference.

Thanks again!

Posted in Eclipse | 5 Comments

Marcel Bruch joins the vogella Trainer Team

I’m happy to announce that Marcel Bruch joins the trainer team of vogella.


Marcel is the project lead of Eclipse Code Recommenders. Eclipse Code Recommenders provides improvements in the Eclipse IDE which increases the developer productivity.

Marcel also has a vast and deep background in Eclipse Plug-in and RCP development and will help to deliver the Eclipse 4 training course.

Posted in Eclipse | Tagged | Leave a comment

Eclipse 4.2 M6 is out – And it is a good one

Eclipse 4.2 M6 is out and its really feels good to use it. If you thought earlier version of Eclipse 4.2 felt laggy, you should try this one, it has much improved in user interface responsiveness.

For Eclipse 4 RCP there have been also several enhancements and bug fixes compared to Eclipse 4.2 M5 so I suggest you to move to M6.

I also updated my Eclipse 4 RCP tutorial to Eclipse 4.2 M6.

The major concern I heard about getting started with Eclipse 4.2 is that the correct update site for the Eclipse tools fitting to the M-build is too hard to find. Therefore I added the correct update site for the M6 build in the tutorial.

Have fun!

In case you wondering what happened to my planned book about Eclipse 4, it is currently reviewed by a few people and should be available in a few weeks.

Posted in Eclipse | Tagged , | 3 Comments

How to determine the ID in the R.java file of a drawable resource in Android?

Assume you have several drawables in your Android resource folder and what to iterate over them. You use a certain naming schema and would like to use this to determine the resources ID’s.

The following snippets shows how to get a resource ID based on the resource name:

// Name of resource
// Type
// Package of the app
int identifier = getResources().getIdentifier("pic1", "drawable","android.demo");
ImageView image = (ImageView) findViewById(R.id.imageView1);
image.setImageResource(identifier);

I hope this helps.

Posted in Android | Tagged , | 2 Comments

Running Eclipse 3.x RCP application on Eclipse 4

I updated Using the Compatibility Layer for Eclipse 3.x RCP applications tutorial with the latest information.

The migration for your Eclipse 3.x RCP applcation to Eclipse 4.2 is now super easy.

If you are using a feature based product configuration file which includes the exiting Eclipse 3.x “org.eclipse.rcp” feature, then almost no change in your product or application is required to run on Eclipse 4.2 is required. You only have to add two additional features org.eclipse.emf.common and
org.eclipse.emf.ecore. See Bugreport for details.

In my opinion there is no reason anymore not to migrate to Eclipse 4. The integration builds are already very stable and Eclipse 4.2M6 is expected to be really good as this will be the released used for EclipseCon.

Please give the latest integration builds a try with your Eclipse 3.x RCP application and report any issues to give the team the chance to fix any outstanding issues.

Posted in Eclipse | Tagged , , | Comments Off

How to center a Button in an Android Layout?

In my last Android Training several people asked how they could center a single view, e.g. a Button, so I assume it is worth a short blog entry.

If you have a single Button in your Activity and you want to center it the simplest way is to use a RelativeLayout and set the android:layout_centerInParent=”true” property on the Button.

For example like this:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/captureFront"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:onClick="onClick"
        android:text="Make Photo" />

</RelativeLayout>

Alternative you can do this via a LinearLayout (thanks to Ravi Tamada via Twitter for the tip.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:gravity="center"
    >

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello"
        />

</LinearLayout>
Posted in Android | Tagged , | Comments Off

Eclipse 4 is now a full dependency injection container with @Creatable

If you want to get your own Java objects injected into a model elements just annotated them with @Creatable. If you then tell Eclipse that you need an instance of the your class it will generate it for you.

For example, lets say you have the following domain model.

@Creatable
class Todo {
 @Inject
 public Todo(Dependent depend, YourOSGiService service) {
     // placeholder
 }
}

@Creatable
class Dependent {
 public Dependent() {
 // placeholder
 }
}

Assuming that you have defined the required OSGi service, you can get an instance of your Todo data model injected in a Part.

// Field Injection
@Inject Todo todo

Pretty cool, I think. For details check out the Bug report.

To use this please use one of the recent integration builds. Eclipse 4.2M5 does not yet contain the feature.

I added this also to Eclipse 4 Tutorial. It is also included in my Eclipse 4 RCP training.

Posted in Eclipse | Tagged , | 6 Comments

vogella.de gets a motto – “Because knowledge feels like magic”

Every company has a motto which should describe its primary purpose. Google has the “Don’t be evil” motto, Nike has “Just do it”, IBM has to my knowledge “Think” as motto and Apples has “Think Different”.

I personally like to acquire and distribute knowledge. Knowledge and certain skills can feel very impressive, I still remember that programming felt a bit like magic to me then I started with it approx. 25 years ago.

The primary purpose of vogella.de is to distribute knowledge and to enable others to do cool things with technology.

After some thinking I therefore decided that the motto of vogella.de should be: “Because knowledge feels like magic“.

Let me know what you think.

Posted in vogella | Tagged | 10 Comments

Eclipse 4 RCP training available

A few weeks ago I heard from Mike Milinkovich at the Eclipse Day At Googleplex 2011 that Eclipse 4.2 will be the basis for the Juno release and Eclipse 3.8 will be the last Eclipse 3.x release.

I already gave two full Eclipse 4 trainings and I’m very enthusiastic about the new capabilities, the consistent API and the flexibility of the programming model. It also appears to me that it is much easier to learn for the attendees of the training, due to the consistent API.

The Eclipse 4.2 M5 release is already very stable (which was the basis for my trainings) and lots of new stuff will be available in the Eclipse 4.2 M6 release.

Based on these facts, I decided that it is time to upgrade my Eclipse RCP training to the programming model of Eclipse 4.2.

An updated (English) agenda can be found here:

Eclipse 4 RCP training

This is not only a delta training but a complete introduction into the Eclipse 4 RCP platform also covering SWT, JFace, OSGi modularity, OSGi services and more. I also cover the compatibility layer which allows you to migrate your Eclipse 3.x application to Eclipse 4.2. In this training a complete application will be developed from ground up.

The training material is in English, if you are looking to get an Eclipse 4 RCP training outside Germany feel free to contact me.

Posted in Eclipse | Tagged , | Comments Off