I'd like to make an RCP application that only opens once.
If you open it again, it focuses (ideally passing through the arguments supplied) on the original window.
My use-case involves multiple concurrent users (with their own user accounts) on the same computer, so I don't think the route of opening a port would work.
I'm using RCP4 - a lot of the existing stuff I've seen online is RCP3 or older.
there is a library available here: http://www.sauronsoftware.it/projects/junique/
The JUnique library can be used to prevent a user to run at the same time more instances of the same Java application.
An example of how it is used here:
public static void main(String[] args) {
String appId = "myapplicationid";
boolean alreadyRunning;
try {
JUnique.acquireLock(appId);
alreadyRunning = false;
} catch (AlreadyLockedException e) {
alreadyRunning = true;
}
if (!alreadyRunning) {
// Start sequence here
}
}