Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [SOLVED] How to make sure that a plug-in starts running on a headless Eclipse instance?
icon10.gif  [SOLVED] How to make sure that a plug-in starts running on a headless Eclipse instance? [message #975211] Wed, 07 November 2012 17:49 Go to next message
Kivanc Muslu is currently offline Kivanc Muslu
Messages: 153
Registered: November 2010
Senior Member
Hi all,

I am writing a plug-in that spawns another headless Eclipse running on a different workspace. While spawning the headless Eclipse, I run the following process:

Runtime.getRuntime().exec(new String[] {
                                                        "<Eclipse executable path>",
                                                        "-data",
                                                        "<headless workspace>",
                                                        "-nosplash", "-application",
                                                        "<identifier for the application I'd like to run on the headless instance>"});


This works great, the application that I run on the headless (implements IAppilcation) loads immediately and two Eclipse instances can communicate through the network.

I would like to do the following though: For extensibility purposes, I want to be able to run arbitrary applications (or plug-ins) that are built for this headless Eclipse. The easiest way to do it would be (1) add the application ids to the exec() above (2) built the applications within the above application that is being run. However, for modularity purposes, both are not good.

I thought about defining a new plug-in that when loads checks the workspace it is working and if the workspace is equal to the headless workspace (which will be unique), starts running (returns otherwise). However, I am having problems on ensuring that this plug-in is loaded on the headless Eclipse instance.

I know three ways to load plug-ins in Eclipse so far:
1. IActivator: does not work for me as my plug-in does not make any contributions to the headless Eclipse and hence never activated.
2. IStartup: does not work either since as far as I understand, IStartup plug-in are only called if there is a UI (the headless Eclipse does not have a UI).
3. IApplication: does not work due to the reasons stated above (basically the names are dynamically generated).

Can I make a small tweak in any of the above loading mechanisms to fit into my needs? Is there any other loading mechanism for headless Eclipses that will make sure that a plug-in gets loaded (similar to IStartup for normal Eclipse) even if its services is not needed yet?

Thanks in advance, best regards,

[Updated on: Sun, 20 October 2013 21:01]

Report message to a moderator

Re: How to make sure that a plug-in starts running on a headless Eclipse instance? [message #975839 is a reply to message #975211] Thu, 08 November 2012 05:32 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Kivanc,<br>
<br>
Does it help to use a bundle activation policy?  I think you can
specify "eager" instead of "lazy":<br>
<blockquote>Bundle-ActivationPolicy: lazy<br>
</blockquote>
<br>
<div class="moz-cite-prefix">On 07/11/2012 6:49 PM, Kivanc Muslu
wrote:<br>
</div>
<blockquote cite="mid:k7e6v2$dhl$1@xxxxxxxxe.org" type="cite">Hi
all,
<br>
<br>
I am writing a plug-in that spawns another headless Eclipse
running on a different workspace. While spawning the headless
Eclipse, I run the following process: <br>
<br>
Runtime.getRuntime().exec(new String[] {
<br>
                                                      
"&lt;Eclipse executable path&gt;",
<br>
                                                       "-data",
<br>
                                                      
"&lt;headless workspace&gt;",
<br>
                                                      
"-nosplash", "-application",
<br>
                                                      
"&lt;identifier for the application I'd like to run on the
headless instance&gt;"});
<br>
<br>
<br>
This works great, the application that I run on the headless
(implements IAppilcation) loads immediately and two Eclipse
instances can communicate through the network. <br>
I would like to do the following though: For extensibility
purposes, I want to be able to run arbitrary applications (or
plug-ins) that are built for this headless Eclipse. The easiest
way to do it would be (1) add the application ids to the exec()
above (2) built the applications within the above application that
is being run. However, for modularity purposes, both are not good.
<br>
<br>
I thought about defining a new plug-in that when loads checks the
workspace it is working and if the workspace is equal to the
headless workspace (which will be unique), starts running (returns
otherwise). However, I am having problems on ensuring that this
plug-in is loaded on the headless Eclipse instance. <br>
I know three ways to load plug-ins in Eclipse so far:
<br>
1. IActivator: does not work for me as my plug-in does not make
any contributions to the headless Eclipse and hence never
activated.
<br>
2. IStartup: does not work either since as far as I understand,
IStartup plug-in are only called if there is a UI (the headless
Eclipse does not have a UI).
<br>
3. IApplication: does not work due to the reasons stated above
(basically the names are dynamically generated).
<br>
<br>
Can I make a small tweak in any of the above loading mechanisms to
fit into my needs? Is there any other loading mechanism for
headless Eclipses that will make sure that a plug-in gets loaded
(similar to IStartup for normal Eclipse) even if its services is
not needed yet?
<br>
<br>
Thanks in advance, best regards, </blockquote>
<br>
</body>
</html>
Re: How to make sure that a plug-in starts running on a headless Eclipse instance? [message #1147362 is a reply to message #975839] Sun, 20 October 2013 21:01 Go to previous message
Kivanc Muslu is currently offline Kivanc Muslu
Messages: 153
Registered: November 2010
Senior Member
Sorry for the late reply.

The way I tackled this problem is the following:
In my IApplication (that is being run on the headless Eclipse), I have defined an extension point, where other plug-ins can extend my plug-in. My IApplication, looks for the extending plug-ins and runs them in a separate thread and manages their life cycle throughout.

It was more work than I wished it would be, but so far it works quite well and (I believe) also goes along with Eclipse philosophy.
Previous Topic:Create Menu for Outline View and Select Word in the File
Next Topic:Refresh (F5) Handler Association with Editor
Goto Forum:
  


Current Time: Fri Sep 19 16:07:07 GMT 2014

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

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