Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How do i open previous instance of my RCP application
How do i open previous instance of my RCP application [message #769071] Wed, 21 December 2011 05:48 Go to next message
raghav Missing name is currently offline raghav Missing name
Messages: 18
Registered: May 2011
Junior Member

I'm trying to make my RCP application as a single instance run,
for that i tried implementing a socket technique despite of file LOCK technique,and I'm almost done, my application behavior is such that,it can show information message saying that "there is already an instance running" and it exits , despite of this how can i make the previous running instance bring to front(maximize).
Re: How do i open previous instance of my RCP application [message #769255 is a reply to message #769071] Wed, 21 December 2011 11:55 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You want to use org.eclipse.osgi.service.datalocation.Location.lock(), it's what we do in the SDK. You can get the instance location from your Activator using something like:

public Location getInstanceLocation() {
    if (locationTracker == null) {
        Filter filter = null;
        try {
            filter = context.createFilter(Location.INSTANCE_FILTER);
        } catch (InvalidSyntaxException e) {
            // ignore this. It should never happen as we have tested the
            // above format.
        }
        locationTracker = new ServiceTracker(context, filter, null);
        locationTracker.open();
    }
    return (Location) locationTracker.getService();
}



PW


Previous Topic:Get the absolute path of Eclipse RCP exe ?
Next Topic:Add a propertyPage inside another propertyPage, how?
Goto Forum:
  


Current Time: Tue Jul 29 23:11:30 EDT 2014

Powered by FUDForum. Page generated in 0.01543 seconds