Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313741

Summary: [Net] ui.net can cause the instance location to be set to default too early
Product: [Eclipse Project] Platform Reporter: Thomas Watson <tjwatson>
Component: RuntimeAssignee: DJ Houghton <dj.houghton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dj.houghton, mober.at+eclipse, pawel.pogorzelski1
Version: 3.6Flags: tjwatson: review-
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Patch_v01
none
Plugin.savePluginPreferences patch none

Description Thomas Watson CLA 2010-05-20 10:43:23 EDT
See bug306816 comment 24

The bundle org.eclipse.ui.net uses an activator that extends AbstractUIPlugin.  The issue here is that the AbstractUIPlugin is using legacy preferences in the stop(BundleContext context) method to save the preference store.  

First of all, I don't believe ui.net stores anything in the instance preference store so saving the preference store should not be necessary.  This ends up loading the legacy preferences to get loaded and the instance area to be set to the default location if it was not already set.  To solve this immediate issue could we consider overriding AbstractUIPlugin.savePreferenceStore() to do nothing?

I admit that will only solve this one usage of AbstractUIPlugin and the usage of legacy preferences.  

DJ, I think we have another preference bug(s) that complain about preferences causing the setting of the instance area too soon.  Perhaps this is a dup of that bug if it exists?
Comment 1 Thomas Watson CLA 2010-05-20 10:45:47 EDT
Moving to Platform->Team.  But could come back to UI if something needs to be done in AbstractUIPlugin.
Comment 2 DJ Houghton CLA 2010-05-20 10:57:55 EDT
Yes there have been previous bugs like this before but I can't find them right now. I think that there was one in Platform/UI that me and Tod (or Andrew E) worked on years ago.

This is one related to the team.net bundles. bug 218013
Comment 3 Pawel Pogorzelski CLA 2010-05-25 07:39:11 EDT
Created attachment 169810 [details]
Patch_v01
Comment 4 Thomas Watson CLA 2010-05-25 11:10:42 EDT
Even though I suggested the possible fix, I don't think it is the correct thing to do in this case.  

I discussed this with DJ and we think the better and more general solution is to avoid doing any work to save preferences if the instance area is not set in org.eclipse.core.runtime.Plugin.savePluginPreferences().  This way we are not only fixing ui.net but any bundle that has an activator that extends AbstractUIPlugin.

I will attach a patch.
Comment 5 Thomas Watson CLA 2010-05-25 11:11:41 EDT
Created attachment 169842 [details]
Plugin.savePluginPreferences patch
Comment 6 Pawel Pogorzelski CLA 2010-05-25 11:24:55 EDT
(In reply to comment #4)
> I discussed this with DJ and we think the better and more general solution is
> to avoid doing any work to save preferences if the instance area is not set in
> org.eclipse.core.runtime.Plugin.savePluginPreferences().

Agreed. Moving to Runtime.
Comment 7 DJ Houghton CLA 2010-06-22 11:03:52 EDT
Patch released to HEAD.