Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to programmatically add and remove JREs?
How to programmatically add and remove JREs? [message #243156] Mon, 23 April 2007 14:21 Go to next message
Eclipse UserFriend
Originally posted by: gbrall85.web.de

Hello,

I'm working on a plugin for Eclipse 3.2 that manages a list of install
locations of a speficic software, whereas each of these locations
contains a JRE, for which I've defined a new VMInstallType.

Now I'm looking for a way to synchronize this list with the JDT plugin's
list of "Installed JREs". Manually adding and removing of VMInstalls of
my VMInstallType works.

My current solution is:
- call MyVMInstallType.disposeVMInstall(String id) to remove a JRE
- create a VMStandin instance, setting the appropriate values and
calling convertToRealVM() to add a JRE.
Finally, I call JavaRuntime.saveVMConfiguration().

The problem I encounter is that often (sometimes it works..) my changes
to the JRE list are not reflected in the "Installed JREs" preference
page. (They seem to be overwritten. I've been watching the associated
preference file - the VMInstalls are created and appear in the XML
string. However, when I close the Preferences Dialog, the old
configuration is restored.)

Is there a way to add/remove VMInstalls so that changes are immediately
reflected in the JRE list?

Any hints would be greatly appreciated,
thanks in advance,

Julian
Re: How to programmatically add and remove JREs? [message #243277 is a reply to message #243156] Sat, 28 April 2007 08:40 Go to previous messageGo to next message
Eclipse UserFriend
Does perssing "Apply" on your page always work?

In such case I would guess that the JRE preferences page possibly overrides
your changes. Try scheduling JRE change as a job that will run after the
window closes.

Genady Beryozkin
http://www.genady.net/

Julian Oppermann wrote:
> Hello,
>
> I'm working on a plugin for Eclipse 3.2 that manages a list of install
> locations of a speficic software, whereas each of these locations
> contains a JRE, for which I've defined a new VMInstallType.
>
> Now I'm looking for a way to synchronize this list with the JDT
> plugin's list of "Installed JREs". Manually adding and removing of
> VMInstalls of my VMInstallType works.
>
> My current solution is:
> - call MyVMInstallType.disposeVMInstall(String id) to remove a JRE
> - create a VMStandin instance, setting the appropriate values and
> calling convertToRealVM() to add a JRE.
> Finally, I call JavaRuntime.saveVMConfiguration().
>
> The problem I encounter is that often (sometimes it works..) my
> changes to the JRE list are not reflected in the "Installed JREs"
> preference page. (They seem to be overwritten. I've been watching the
> associated preference file - the VMInstalls are created and appear in
> the XML string. However, when I close the Preferences Dialog, the old
> configuration is restored.)
>
> Is there a way to add/remove VMInstalls so that changes are
> immediately reflected in the JRE list?
>
> Any hints would be greatly appreciated,
> thanks in advance,
>
> Julian
Re: How to programmatically add and remove JREs? [message #243282 is a reply to message #243277] Sun, 29 April 2007 11:51 Go to previous message
Eclipse UserFriend
Originally posted by: gbrall85.web.de

Genady schrieb:
> Does perssing "Apply" on your page always work?
>
> In such case I would guess that the JRE preferences page possibly overrides
> your changes. Try scheduling JRE change as a job that will run after the
> window closes.
Thank you, that works reliably.
I've registered an IJobChangeListener that calls my synchronizing method
when the job that updates JDT's JRE list fires its "done" event. The
only drawback is that I have to use a String from the LaunchingMessages
class that is marked as "internal".
Anyway, would that be a "good" practise or do you know a more elegant
way to notice when the Preferences dialog closes?

Best regards,
Julian

>
> Genady Beryozkin
> http://www.genady.net/
>
> Julian Oppermann wrote:
>> Hello,
>>
>> I'm working on a plugin for Eclipse 3.2 that manages a list of install
>> locations of a speficic software, whereas each of these locations
>> contains a JRE, for which I've defined a new VMInstallType.
>>
>> Now I'm looking for a way to synchronize this list with the JDT
>> plugin's list of "Installed JREs". Manually adding and removing of
>> VMInstalls of my VMInstallType works.
>>
>> My current solution is:
>> - call MyVMInstallType.disposeVMInstall(String id) to remove a JRE
>> - create a VMStandin instance, setting the appropriate values and
>> calling convertToRealVM() to add a JRE.
>> Finally, I call JavaRuntime.saveVMConfiguration().
>>
>> The problem I encounter is that often (sometimes it works..) my
>> changes to the JRE list are not reflected in the "Installed JREs"
>> preference page. (They seem to be overwritten. I've been watching the
>> associated preference file - the VMInstalls are created and appear in
>> the XML string. However, when I close the Preferences Dialog, the old
>> configuration is restored.)
>>
>> Is there a way to add/remove VMInstalls so that changes are
>> immediately reflected in the JRE list?
>>
>> Any hints would be greatly appreciated,
>> thanks in advance,
>>
>> Julian
Previous Topic:Launch freezes
Next Topic:Eclipse Autoraise Policy
Goto Forum:
  


Current Time: Sun May 11 23:27:13 EDT 2025

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

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

Back to the top