User Tools

Site Tools


Dave Orme muses about agile and functional programming.

My current work emphasizes SOA applications using Scala, Kubernetes, and AWS with a React-based SPA front-end. I'm also interested in progressive web applications and developer tools.


Scala, Clojure, and FP


The Cloud

Data-First Development

Older work

Coconut Palm Software home

Donate Bitcoin:



Kubernetes, Docker, Streaming Data, Spark, Scala, Clojure, OSGi, Karaf, GCP, AWS, SQL


Everything I say here is my own opinion and not necessarily that of my employer.


Implementing Login in RCP Applications

Recently, the eclipsepowered discussion mailing list has been talking about how to implement login in an Eclipse RCP application. In the discussion, I described two major use cases:

 1. RCP is a standard framework for deploying corporate applications.
    Logging into RCP implies logging into all of your corporate
 2. RCP is a container for many applications, some of which require a

Olivier Crameri [olivier.crameri <at>] then proposed an elegant solution to use case #1: implement your login in your RCP application's IPlatformRunnable class, after initializing the SWT Display object, but before running PlatformUI.createAndRunWorkbench.

Here's his solution with a few modifications by myself:

The IPlatformRunnable class looks something like the following:

    public class Client implements IPlatformRunnable {
        private static RootRMIInterface serverConnection = null;
        public static getDefaultConnection() {
            return serverConnection;
        public Object run(Object args) {
            WorkbenchAdvisor workbenchAdvisor = new ClientWorkbenchAdvisor();
            Display display = PlatformUI.createDisplay();
            if (authenticate(display)) {
                int returnCode = PlatformUI.createAndRunWorkbench(display,
                if (returnCode == PlatformUI.RETURN_RESTART) {
                    return IPlatformRunnable.EXIT_RESTART;
                } else {
                    return IPlatformRunnable.EXIT_OK;
            } else
                return IPlatformRunnable.EXIT_OK;
        private boolean authenticate(Display display) {
            Shell shell = new Shell(display);
            LoginDialog loginDialog = new LoginDialog(shell);
    	Client.serverConnection = loginDialog.serverConnection;
            return loginDialog.isAuthenticated;

The LoginDialog object performs the following functions:

  • Attempts to authenticate the user using the username/password pair that was entered.
  • If authentication is unsuccessful, the isAuthenticated field is set to false.
  • If authentication is successful, the RMI server returns a new RMI object stub back to the LoginDialog object.

After the login dialog authenticates the user, the main Clientclass then retrieves the RMI stub and makes it available to all other classes in the application via the Singleton pattern.


blog/implementing_login_in_rcp_applications.txt · Last modified: 2014/10/17 22:08 (external edit)