Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Allow only one product instance by workspace
Allow only one product instance by workspace [message #895243] Thu, 12 July 2012 09:04 Go to next message
Rui Domingues is currently offline Rui Domingues
Messages: 193
Registered: October 2010
Senior Member
Hi everyone
I don't know if it's here the right place to submit this question.

I'm developing an eclipse product, and I don't want to allow multiple instances runnings of the product, once I don't want them sharing the same worksspace.

How can I ensure that no other instance will be running besides the first one?

At this moment, I can run the product twice and they share the workspace, and it becomes a mess, because I need to clean the workspace on startup our shuting down.

Thanks in advance.
Rui Domingues
Re: Allow only one product instance by workspace [message #895292 is a reply to message #895243] Thu, 12 July 2012 11:48 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

See org.eclipse.core.runtime.Platform.getInstanceLocation() and org.eclipse.osgi.service.datalocation.Location.lock()

PW


Re: Allow only one product instance by workspace [message #895512 is a reply to message #895292] Fri, 13 July 2012 11:08 Go to previous messageGo to next message
Rui Domingues is currently offline Rui Domingues
Messages: 193
Registered: October 2010
Senior Member
Thanks a lot.
I was struggling with this issue.
If you don't care, can I ask if it is possible to set programmatically the workspace before application startup, or during startup.

Now I'm working in
Application->IApplication 

(method
start(IApplicationContext context
))
to check if it is lock or not.

I've been searching and I think it is not possible...
Re: Allow only one product instance by workspace [message #895880 is a reply to message #895512] Mon, 16 July 2012 12:38 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Check out the -data option in http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html&cp=2_1_3_0

You can set @noDefault and then set your instance location (but you must do it early in your IApplication#start(*) method.

See org.eclipse.ui.internal.ide.application.IDEApplication.checkInstanceLocation(Shell, Map) in http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java for an example of how the IDE deals with the noDefault case.

PW


Previous Topic:Error after upgrading from Indigo to Juno
Next Topic:Have functional but non-updatable platform
Goto Forum:
  


Current Time: Wed Oct 22 03:31:20 GMT 2014

Powered by FUDForum. Page generated in 0.02410 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software