What’s the Difference? Creating Diffs with JGit

On June 16, 2016, Posted by , In Eclipse, By ,,, , With 20 Comments

In this post, I will dig into the details of how to diff revisions and create patches with JGit. Starting from the high-level DiffCommand all the way down to the more versatile APIs to find particular changes in a file. DiffCommand, Take I The diff command can be used to…

How to Replace Rules in JUnit 5

On April 6, 2016, Posted by , In JUnit, By ,,,, , With 11 Comments

The recently published JUnit 5 (aka JUnit Lambda) alpha release caught my interest, and while skimming through the documentation I noticed that rules are gone – as well as runners and class rules. According to the user guide, these partially competing concepts have been replaced by a single consistent extension…

SWT ScrolledComposite Explained

On March 1, 2016, Posted by , In Eclipse, By ,,,, , With 15 Comments

Like a friend of mine once put it, SWTs ScrolledComposite is a nasty beast. And to some point, I do agree. This is likely the reason why there are so many questions asked about how to use this widget. But it’s not only the authors of the ScrolledComposite to blame….

Getting Started with JGit

On December 15, 2015, Posted by , In Eclipse, By ,,, , With 39 Comments

If you ever wondered how basic Git commands like git init, git checkout and so on are executed in JGit, read on. This tutorial gives an overview of the most commonly used git commands and their counterparts in JGit. It walks through the steps to create a repository, fetch contents…

How to Clone Git Repositories with JGit

On November 30, 2015, Posted by , In Eclipse, By ,,, , With 45 Comments

Whatever you plan to do with an existing repository, first a clone has to be created. Whether you plan to contribute or just want to peek at its history, a local copy of the repository is needed. While cloning a repository with JGit isn’t particularly difficult, there are a few…

From Arrays to Streams and Back with Java 8

On November 16, 2015, Posted by , In Common,Spotlight, By ,,,, , With 4 Comments

Not long ago we upgraded some Eclipse plug-in projects to Java 8. And never looked back since. Among many other things, filtering, mapping, and finding elements in collections has become so much easier and more concise with lambdas and the streams API. Nothing new so far for the most of…

Clean Integration Testing with JUnit Rules

On September 28, 2015, Posted by , In JUnit, By ,,,, , With Comments Off on Clean Integration Testing with JUnit Rules

The benefits of JUnit Rules, especially when dealing with integration testing, can hardly be overrated. In this post, we’ll shine a light on the usefulness of ExternalResource extensions. These simplify fixture control in cases where we have to work with external-resource-abstracting third-party libraries. As an example, we’ll have a look…

Initializing Git Repositories with JGit

On May 6, 2015, Posted by , In Eclipse, By ,,, , With 10 Comments

I was recently asked how to initialize a new Git repository with JGit, i.e. achieve what git init /path/to/repo does. While creating a repository with JGit isn’t particularly difficult, there are a few details that might be worth noting. And because there are few online resources on the topic, and…

Getting Java Event Notification Right

On March 11, 2015, Posted by , In Common,Spotlight, By ,, , With 6 Comments

Implementing the observer pattern to provide Java event notification seems to be a straight forward thing to do. However, there are some pitfalls one easily can run into. Here comes an explanation of common mistakes I carelessly have produced myself on various occasions… Java Event Notification Let’s start with a…

How to Map Distinct Value Types Using Java Generics

On March 4, 2015, Posted by , In Common,Spotlight, By ,, , With 6 Comments

Occasionally the average developer runs into a situation where he has to map values of arbitrary types within a particular container. However, the Java collection API provides container related parameterization only. Which limits the type safe usage of HashMap for example to a single value type. But what if you…

OSGi Service Test Helper: ServiceRegistrationRule

On February 11, 2015, Posted by , In JUnit,OSGi, By ,,, , With Comments Off on OSGi Service Test Helper: ServiceRegistrationRule

OSGi Service Tests can be an efficient means to avoid problems related to dangling service references. As promised in my post about writing simple service contribution verifications, this time I introduce a JUnit rule that assists in testing interactions between components. OSGi Service Tests for Component Interaction Assume we have…

OSGi Service Test Helper: ServiceCollector

On February 5, 2015, Posted by , In JUnit,OSGi, By ,,, , With Comments Off on OSGi Service Test Helper: ServiceCollector

OSGi services come in handy for the development of systems based on loosely coupled components. But loose coupling can make it difficult to recognize problems related to dangling service references. Thus we usually run integrations tests to ensure the availability of service components at runtime. With the intention to reduce…

Apache FOP Integration with Eclipse and OSGi

On January 20, 2015, Posted by , In Eclipse,OSGi, By ,,, , With 2 Comments

Apache FOP is an open source print processor driven by XSL formatting objects (XSL-FO). It can be quite useful to transform data objects into a PDF for example. However it turned out to be somewhat cumbersome to get it integrated into PDE and finally up and running as OSGi Service….

Sacrilege – a Custom SWT Scrollbar

On December 17, 2014, Posted by , In Eclipse, By ,, , With 10 Comments

SWT is a thin abstraction layer on top of native OS widgets. Which is a very good thing if you intent that your applications integrate well with the OS look and feel. But as a trade-off this approach limits styling capabilities significantly. In particular I perceive the native SWT scrollbar…

JGit Authentication Explained

On December 9, 2014, Posted by , In Eclipse, By ,,, , With 50 Comments

Authentication in JGit is mostly on par with native Git. Commonly used protocols like SSH and HTTP(S) and their authentication methods are supported. This article summarizes how to use the JGit authentication API to access remote Git repositories securely. Though the examples in this article use the CloneCommand, the described…

Deferred Fetching of Model Elements with JFace Viewers

On December 2, 2014, Posted by , In Eclipse, By ,, , With 9 Comments

Model elements displayed by Eclipse JFace Viewers sometimes take a considerable amount of time to load. Because of this the workbench provides the type IDeferredWorkbenchAdapter to fetch such model elements in background. Unfortunately this mechanism seems to be supported only for AbstractTreeViewer derivates via the DeferredTreeContentManager. Hence I developed a…

SWT Mouse Click Implementation

On November 26, 2014, Posted by , In Eclipse, By ,, , With 5 Comments

Doing a bit of SWT custom widget development lately, I stumbled across the question why is there no such thing as a default SWT mouse click listener? As this subject raises once in a while, I thought writing a word or two about the rational ground behind – and how…

Efficient Creation of Eclipse Modules with Maven Archetype

On November 5, 2014, Posted by , In Common,Eclipse, By ,, , With Comments Off on Efficient Creation of Eclipse Modules with Maven Archetype

Maven Archetype is a project templating toolkit that provides developers with the means to generate parameterized versions of built-in or custom scaffolding artefacts. Recently I applied it to our Xiliary P2 repository to achieve automation of Eclipse module stubs creation. As it worked out well enough, I thought it might…

Lightweight Integration Tests for Eclipse Extensions

On November 3, 2014, Posted by , In Eclipse,JUnit, By ,,,, , With Comments Off on Lightweight Integration Tests for Eclipse Extensions

Recently I introduced a little helper for Eclipse extension point evaluation. The auxiliary strives to reduce boilerplate code for common programming steps, while increasing development guidance and readability at the same time. This post is the promised follow-up that shows how to combine the utility with an AssertJ custom assert…

Explore Git Internals with the JGit API

On October 20, 2014, Posted by , In Eclipse, By ,,, , With 5 Comments

Have you ever wondered how Git stores a commit and its content? Well, I have, and I had some spare time over the last rainy weekend, so I did a little research. Because I feel more at home with Java than with Bash, I used JGit and a couple of…