tips Tag

Recently I wanted to use the good old ServiceTracker to get access to OSGi services registered under a specific interface and matching a given filter. I was surprised to discover that there is no constructor for the ServiceTracker that allows the specification of a class name and a filter. A quick look into the OSGi specification revealed: the list of the service interfaces is made available...

Read More

I've met many programmers over the years who had just started using Eclipse or already had "some experience" -- but they used Eclipse just as a text editor or handled it in a very cumbersome way. The main problem was that they hadn't yet learned about Eclipse's capabilities and how to leverage its powerful features. So, I thought I would write about my top 10 recommendations...

Read More

Working with tables or trees with more than a handful of rows, you quickly find that you need a way to filter or search for content, otherwise they become unusable. The Eclipse workbench offers an out-of-the-box component named FilteredTree which adds an input field to an SWT tree where filter strings can be entered by the user. However, support for SWT tables is missing. This...

Read More

Ever wondered how you can create a p2 repository from an arbitrary bunch of pre-built Eclipse bundles and features?  OK, you might also be wondering why you would want to do that. Let me give you a 'real world' situation where I badly needed to package p2 repos.  On an RCP Project that I coached last year we switched from PDE-build to Maven Tycho. In our target...

Read More

Whatever your project's specific policy on whitespaces is (tabs vs. spaces, etc), the most important rule should always be consistency. Not just to make your code look nice, but also to avoid issues with patches and your version control system. Changes to whitespaces may be more or less invisible to the naked eye, but Git and co. register them anyway. Here are some simple ways to...

Read More

Recently I scanned the source code of our current Eclipse RCP/RAP project for occurrences of the Listener (or Observer) pattern. I found no less than 6 (!) different implementations and decided to unify them into one. When researching the implementation options (and the Java world has many to offer), I found an aspect of Listener programming that is usually not mentioned by internet resources. But...

Read More

In RAP v1.5 we introduced markup support for several widgets. One of the most frequently asked questions about markup support is: "Why are my images not displaying?". In this blog post I will give you a step-by-step guide on how to make your images available using markup. Save your images in your bundle source folder. In this example the images are located in "src/resources". Register your image...

Read More

In Java, every object has a method hashCode that is simple to understand but still it's sometimes forgotten or misused. Here are three things to keep in mind to avoid the common pitfalls. An object's hash code allows algorithms and data structures to put objects into compartments, just like letter types in a printer's type case. The printer puts all “A” types into the compartment for...

Read More