Bug 137947 - Changes to ECLIPSE_HOME is not persisted
Summary: Changes to ECLIPSE_HOME is not persisted
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-21 10:32 EDT by Feng Xiang CLA
Modified: 2009-08-30 02:22 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Feng Xiang CLA 2006-04-21 10:32:42 EDT
Detail Description:                                                   
1.Go to Window > Preferences > Java > Build Path > Classpath Variables                                 
2.Select a variable and click on edit         
3.After making change to the value of a variable, for example
 ECLIPSE_HOME, Click OK.
4.Restart Eclipse, the modified value get reset back to the default value
Comment 1 Olivier Thomann CLA 2006-04-21 12:06:09 EDT
Reproduced with N0421-0010.
Comment 2 Olivier Thomann CLA 2006-04-21 13:54:29 EDT
This seems to be an issue only with ECLIPSE_HOME.
In fact the EclipseHomeInitializer resets the values for each session.
Moving to PDE/UI for comment.
If this value cannot be changed, the variable should be set as reserved and not editable.
Comment 3 Olivier Thomann CLA 2006-04-21 13:56:17 EDT
See the implementation in org.eclipse.pde.internal.core.EclipseHomeInitializer
Comment 4 Feng Xiang CLA 2006-04-21 14:06:46 EDT
It's not just ECLIPSE_HOME that doesn't persist the change but all the default classpath variables. I'm running IBM Rational Application Developer(which is built on top of Eclipse 3.0.2) and there's about 37 default classpath variables.
 
Should the creators of these variables mark them as reserved manually or can Eclipse be smart enough to determine all the default variables and mark them automatically?
Comment 5 Wassim Melhem CLA 2006-04-23 22:27:02 EDT
JDT/UI currently hardcodes "(reserved)" for the JRE* variables.

It should do so generically for all variables contributed via the classpathVariableInitializer extension.
Comment 6 Martin Aeschlimann CLA 2006-04-24 14:21:19 EDT
Hm, not sure if that wouldn't be breaking. Maybe some variables with inigtializers can handle or even want to allow user changes.

It would be better if jdt.core introduces this concept of non-modifiable variables .

Moving to jdt.core for comments.
Comment 7 Wassim Melhem CLA 2006-04-24 14:33:00 EDT
I'd be fine if a new (optional) attribute was added the classpathVariableInitializer and classpathContainerInitializer schema (e.g. an attribute named 'reserved' with a default value of false).

PDE could also benefit from this attribute for the PDE container, since it's a read-only and we don't want people to try to modify it via the UI.
Comment 8 Martin Aeschlimann CLA 2006-04-24 16:51:55 EDT
For containers, you mean more than ClasspathContainerInitializer.canUpdateClasspathContainer ?

Comment 9 Wassim Melhem CLA 2006-04-24 18:06:07 EDT
ClasspathContainerInitializer.canUpdateClasspathContainer is good enough for me, but it does not seem to be good enough for JDT/UI.  
The Edit... button is enabled when the PDE container is selected in the Java Build path property page (bug 77364).  Bottom line is we need a mechanism to not allow anybody to mess with the PDE container via the UI.
Comment 10 Philipe Mulet CLA 2006-04-25 10:06:44 EDT
Not for 3.2. BTW, pls clarify why the container support doesn't work. We could add similar support for variables.
Comment 11 Wassim Melhem CLA 2006-04-25 10:12:02 EDT
assuming the question in comment 10 is for me:

currently the PDE container returns false for canUpdateClasspathContainer(), however, in the UI, the Edit... button is always enabled and allows the user to attempt to make modificiations to the container.  Then when Finish is pressed, PDE ignores all those changes as our container is meant to be read-only.

The Edit button should have been disabled in the first place.  Additionally, the container could have the word 'reserved' in the label.
Comment 12 Olivier Thomann CLA 2006-04-25 10:16:07 EDT
(In reply to comment #11)
> The Edit button should have been disabled in the first place.  Additionally,
> the container could have the word 'reserved' in the label.
This is exactly what I meant in comment 2.
If the Edit button is enabled, then it should be possible to change the value. If the container is meant to be read-only, it must be clear from the UI that this is a read-only container.

Comment 13 Olivier Thomann CLA 2006-04-25 10:17:43 EDT
The question would be. Why the Edit button state is not consistent with the return value of canUpdateClasspathContainer() call?
This looks like a bug.
Comment 14 Martin Aeschlimann CLA 2006-04-25 10:21:37 EDT
I think it's ok to show the container configure page so the page can give some
explanations about the container. I agree 'Edit..' is not the right term here.
But PDE could for example add text (or a link) to say that dependencies are
configured in the .manifest file.

Can you elaborate about the changes that a user can make and are thrown away? I don't think this is possible.

I wouldn't change anything here. Bug 77364 seems unrelated to me.
Comment 15 Olivier Thomann CLA 2006-04-25 10:29:36 EDT
Very simple.
1. Go to Window > Preferences > Java > Build Path > Classpath Variables          
2. Select ECLIPSE_HOME and click on Edit...
3. In my case, it shows:
D:/eclipse/N0425/eclipse
4. Now I change it for:
D:/eclipse/N0424/eclipse
And I click OK.
5. Back to the classpath variable preference page, I can see the new value for the ECLIPSE_HOME entry.
6. At this point if I select it again and click OK, I see the new value in the text field.
7. Click OK to close the classpath variable preference page.
8. Open that preference page again and I can still see the new value.
9. Exit and restart.
10. The old value is back which is consistent with the implementation of this container.

I can always reproduce. I am using 0425-0010 build.
Comment 16 Martin Aeschlimann CLA 2006-04-25 10:36:13 EDT
Olivier, I meant modifications to a classpath container (not variable) that are thrown away.

canUpdateClasspathContainer only releates to the container entries (children).
if (canUpdateClasspathContainer is false) we won't let the user configure the children.
The container wizard page is under the contributors control. PDE just shows information there, but doesn't allow modifictaion, JUnit (new container, just added) lets you specify the JUnit version, but it is also now allowing any children changes.
Comment 17 Philipe Mulet CLA 2006-04-25 12:47:26 EDT
#canUpdateClasspathContainer() is meant to control read-only-ness, not just nested entries; i.e. the contract is that if it says it can be updated, then the change will be reflected after a call to #requestClasspathContainerUpdate().

The doc isn't super clear, but this is the idea. We can clarify the doc if needed.

* Returns <code>true</code> if this container initializer can be requested to perform updates 
* on its own container values. If so, then an update request will be performed using
* <code>ClasspathContainerInitializer#requestClasspathContainerUpdate</code>/

Currently, it feels the UI is inconsistent and bypasses the contract of #canUpdateClasspathContainer().

Would be a JDT/UI bug to me.
Comment 18 Martin Aeschlimann CLA 2006-04-25 13:03:07 EDT
Yes, the API is not very clear. 'container values'...

A better, clearer API, more finegrained for example, would be nice to have.
Maybe a container wants to allow that the 'javadoc' attribute can be modified, but not the 'source'. 

In JUnit I want to allow reconfiguring the path, but not the children.

The UI has been for that for quite a while now. Interpreting the updating rules  stricter will break other containers. There's also no real benefit in that.
As mentioned, no harm is done at the moment. I still doubt that there is a scenario where the UI allows the user to make changes on a read-only container.
Comment 19 Philipe Mulet CLA 2006-04-26 05:16:27 EDT
The reason for #canUpdateClasspathContainer() is precisely to drive UI enablement. The fact you ignore it is your problem.
I do not see finer granularity occurring, i.e. you are not going to show me 5 different buttons for each individual property...

Anyhow, post 3.2
Comment 20 Martin Aeschlimann CLA 2006-04-26 05:28:46 EDT
Again: it is not ignored. We are blocking the editing of all 'values' of the read-only container.
But we allow the read-only container to show it's configuration page, where he can completly _replace_ the container. PDE doesn't even want replace, JUnit wants it.

We don't need 5 buttons for all the properties, one is enough as we show all properties in the tree: select the one you want to modify and press 'edit'.
Now either you can either change all properties of a container child or none. That's something we should improve in 3.3. 
Comment 21 Krzysztof Daniel CLA 2007-01-22 06:49:15 EST
Martin,

I am afraid I do not understand your idea very well. 

Could you please give more details about what should be improved?
Comment 22 Martin Aeschlimann CLA 2007-02-12 05:55:27 EST
bug 168077 is the request for an improved #canUpdateClasspathContainer()
Comment 23 Denis Roy CLA 2009-08-30 02:22:49 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.