Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to block second instance of Eclipse
How to block second instance of Eclipse [message #501344] Tue, 01 December 2009 21:54 Go to next message
fatih  is currently offline fatih Friend
Messages: 6
Registered: November 2009
Junior Member
Hi all,

I have an application which constitutes of a number of plugins. It is not a stand alone RCP application. It needs an Eclipse to run.

If an user tries to run second instance of the Eclipse, I don't want to allow running of second instance and I want to pass an argument to current running eclipse instance.

Actually, I had implemented this partly with help of a library which is called JUnique (http://www.sauronsoftware.it/projects/junique/index.php). This idea was proposed of one of forum users (Heiko Ahlig). http:// www.eclipse.org/forums/index.php?t=msg&goto=496696&S =f98be159047098eb47526288dbdf5968#msg_496696

But, I have still problem. When I try to run second instance of Eclipse, it starts to load and splash screen is visible for some seconds. Then, second instance sends messages to current one and kills itself. I don't want to make second instance visible at all. The user should not notice the second instance is loading and running.
The issue is related with loading of plugins. I want to make a check that if there any eclipse is already running before any plugin starts to load even eclipse platform.

How can I handle it?
Re: How to block second instance of Eclipse [message #501373 is a reply to message #501344] Wed, 02 December 2009 00:40 Go to previous messageGo to next message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
fatih wrote:
> Hi all,
>
> I have an application which constitutes of a number of plugins. It is
> not a stand alone RCP application. It needs an Eclipse to run.
> If an user tries to run second instance of the Eclipse, I don't want to
> allow running of second instance and I want to pass an argument to
> current running eclipse instance.
> Actually, I had implemented this partly with help of a library which is
> called JUnique
> (http://www.sauronsoftware.it/projects/junique/index.php). This idea was
> proposed of one of forum users (Heiko Ahlig).
> http://www.eclipse.org/forums/index.php?t=msg&goto=49669 6&S=f98be159047098eb47526288dbdf5968#msg_496696
>
>
> But, I have still problem. When I try to run second instance of Eclipse,
> it starts to load and splash screen is visible for some seconds. Then,
> second instance sends messages to current one and kills itself. I don't
> want to make second instance visible at all. The user should not notice
> the second instance is loading and running.
> The issue is related with loading of plugins. I want to make a check
> that if there any eclipse is already running before any plugin starts to
> load even eclipse platform.
>
> How can I handle it?

So, if I installed your plugins, my copy of Eclipse would no longer let me do
the things that I use it to do? That doesn't seem very friendly, nor very
modular. Perhaps it would make more sense to work on having a shared data
model, so that multiple running Eclipse instances would display the same data
(for the subset of Eclipse data that your plugins control)? Then your plugins
would not interfere with other uses of Eclipse.

Anyway, if you want to catch other Eclipse instances before they've even put up
a splash screen, one possible solution would be for you to write your own
launcher (based on the Eclipse launcher code, of course). You'd presumably end
up with an executable called something other than eclipse.exe, but it sounds
like that's what you want anyway.
Re: How to block second instance of Eclipse [message #501582 is a reply to message #501373] Wed, 02 December 2009 21:41 Go to previous messageGo to next message
fatih  is currently offline fatih Friend
Messages: 6
Registered: November 2009
Junior Member
Hi Walter,

You can do the things that you use to do with Eclipse.
I try to make more clear.

I am generating specific links for my application. Let's assume that these link are published in a website. Whenever the user clicks the link, which launches the user's default browser to handle the request. The browser knows that it cannot natively open this URL, so it consults with the Windows registry to determine how the action should be delegated.The registry looks up the myprotocol://... protocol and knows that there is an another application which is Eclipse+my plugin in this case.
When I click a link, Eclipse will be opened. This is the simple case. If my Eclipse is already running and I click a link, second instance of Eclipse should not be ran. Therefore, I want to notify that eclipse is already running and I should send the clicked link to current running eclipse instance. I should do this check early startup of Eclipse.

Firefox tabs are an example of what I want. If Firefox is not running and you click a link in a document, firefox(default browser) starts to run. But, if Firefox is already running before you click a link and then you click a link, firefox adds a new tab. Second instance of firefox is not running.

I will match my special link with a specific Eclipse.exe in operating system. If user click my special link, predefined eclipse.exe will run. If you have two installed Eclipse in your computer, others are not affected.

I don't understand exactly how share data model can help me. Could you make that point more clear?

I am checking your launcer idea. But I think it is not so simple??



Walter Harley wrote on Tue, 01 December 2009 19:40
fatih wrote:
> Hi all,
>
> I have an application which constitutes of a number of plugins. It is
> not a stand alone RCP application. It needs an Eclipse to run.
> If an user tries to run second instance of the Eclipse, I don't want to
> allow running of second instance and I want to pass an argument to
> current running eclipse instance.
> Actually, I had implemented this partly with help of a library which is
> called JUnique
> (http://www.sauronsoftware.it/projects/junique/index.php). This idea was
> proposed of one of forum users (Heiko Ahlig).
> http://www.eclipse.org/forums/index.php?t=msg&goto=49669 6&S=f98be159047098eb47526288dbdf5968#msg_496696
>
>
> But, I have still problem. When I try to run second instance of Eclipse,
> it starts to load and splash screen is visible for some seconds. Then,
> second instance sends messages to current one and kills itself. I don't
> want to make second instance visible at all. The user should not notice
> the second instance is loading and running.
> The issue is related with loading of plugins. I want to make a check
> that if there any eclipse is already running before any plugin starts to
> load even eclipse platform.
>
> How can I handle it?

So, if I installed your plugins, my copy of Eclipse would no longer let me do
the things that I use it to do? That doesn't seem very friendly, nor very
modular. Perhaps it would make more sense to work on having a shared data
model, so that multiple running Eclipse instances would display the same data
(for the subset of Eclipse data that your plugins control)? Then your plugins
would not interfere with other uses of Eclipse.

Anyway, if you want to catch other Eclipse instances before they've even put up
a splash screen, one possible solution would be for you to write your own
launcher (based on the Eclipse launcher code, of course). You'd presumably end
up with an executable called something other than eclipse.exe, but it sounds
like that's what you want anyway.

Re: How to block second instance of Eclipse [message #501621 is a reply to message #501582] Thu, 03 December 2009 07:52 Go to previous message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"fatih" <fatih__ulusoy@hotmail.com> wrote in message
news:hf6mug$a5o$1@build.eclipse.org...
> Hi Walter,
>
> You can do the things that you use to do with Eclipse.
> I try to make more clear.
>
> I am generating specific links for my application. Let's assume that these
> link are published in a website. Whenever the user clicks the link, which
> launches the user's default browser to handle the request. The browser
> knows that it cannot natively open this URL, so it consults with the
> Windows registry to determine how the action should be delegated.The
> registry looks up the myprotocol://.. protocol and knows that there is an
> another application which is Eclipse+my plugin in this case. When I click
> a link, Eclipse will be opened. This is the simple case. If my Eclipse is
> already running and I click a link, second instance of Eclipse should not
> be ran. Therefore, I want to notify that eclipse is already running and I
> should send the clicked link to current running eclipse instance. I should
> do this check early startup of Eclipse.
>
> Firefox tabs are an example of what I want. If Firefox is not running and
> you click a link in a document, firefox(default browser) starts to run.
> But, if Firefox is already running before you click a link and then you
> click a link, firefox adds a new tab. Second instance of firefox is not
> running.
>
> I will match my special link with a specific Eclipse.exe in operating
> system. If user click my special link, predefined eclipse.exe will run. If
> you have two installed Eclipse in your computer, others are not affected.
>
> I don't understand exactly how share data model can help me. Could you
> make that point more clear?
>
> I am checking your launcer idea. But I think it is not so simple??


Interesting. Yes, I see where you're coming from on that; thanks for the
clarification.

The launcher idea actually is pretty simple, although it might require you
to edit (and compile) some C, which in turn means you'd need to provide a
different version of the product for each platform, which is inconvenient.
You might be able to do it within the Java portion of the launcher, though,
in which case it would probably be pretty easy.

Fundamentally the problem that you have is that about the first thing that
the Eclipse launcher does is to put up the splash screen, and that's what
you're trying to prevent. So I don't think there's anything you can do
inside a plug-in that will avoid this, because it's already happened by the
time that the plug-in would be loaded. That's why I'm suggesting that you
should be looking at the launcher instead.

I think you're right that the shared data model is not the right approach in
this case. Just to be clear about what I was suggesting, though, the idea
was that you could have multiple Eclipse workspaces open that share the same
data for a subset of their documents, presumably by overriding the document
model for that particular document type and using something like ECF (the
Eclipse Communication Framework) to communicate between instances.
Previous Topic:The bundle could not be resolved in RCP-RAP application
Next Topic:Problem deleting IProject
Goto Forum:
  


Current Time: Tue Mar 19 08:56:18 GMT 2024

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

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

Back to the top