How do i open previous instance of my RCP application [message #769071] |
Wed, 21 December 2011 05:48  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.07430 seconds