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

Bug 284557

Summary: Default Launchers preference settings are not imported
Product: [Eclipse Project] Platform Reporter: Mario Pierro <mario.pierro>
Component: DebugAssignee: Pawel Piech <pawel.1.piech>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse, Michael_Rennie, pawel.1.piech, tparker
Version: 3.5Flags: pawel.1.piech: review+
Michael_Rennie: review+
darin.eclipse: review+
Target Milestone: 3.6 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
Updated fix. none

Description Mario Pierro CLA 2009-07-24 07:15:04 EDT
Build ID: 20090619-0625

Steps To Reproduce:
1. Start the eclipse-cpp-galileo-win32 distribution on a blank workspace

2. Set a default launcher for preference for C/C++ Application in Window > Preferences > Run/Debug > Launching > Default Launchers > C/C++ Application > Debug > GDB (DSF) Create Process Launcher

4. Export all preferences via File > Export > General > Preferences

5. Start Eclipse again, on a different, blank workspace

6. Import the preferences stored previously (File > Import > General > Preferences)

7. Verify that the default launcher settings have not been restored


More information:
The Default Launcher setting is not restored also when reading its default value from a product configuration file.
Comment 1 Pawel Piech CLA 2009-08-03 18:00:02 EDT
I'll investigate this bug later in the week.  (I changed how the launcher preferences are stored in 3.5)
Comment 2 Darin Wright CLA 2010-05-18 12:22:19 EDT
Created attachment 168962 [details]
patch

Adds a preference modify listener to reset preferred delegates when debug preferences are imported. This will cause preferred delegates to be re-initialized from the preferences. 

Note that the import merges settings, so an imported preferred delegate will replace anything, but we do not *clear* settings when no preferred delegate is imported (the old preference remains). It's harder to clear and questionable as to whether we need/want to.
Comment 3 Michael Rennie CLA 2010-05-18 13:19:43 EDT
works alright, +1
Comment 4 Pawel Piech CLA 2010-05-19 12:24:16 EDT
Created attachment 169147 [details]
Updated fix.

When testing, the import export still wasn't working for me.  I found that if I exported and then imported right away, then the preferences were as before I changed them.  

It turns out that the preferences were written out by the launch manager only on shutdown.  So when I set the preferences and exported, my settings I just made were not actually being exported.  This fix adds a call to persist the delegate preference on each ILaunchConfigurationType.setPreferedDelegate().  

The only remaining problem I can see is that I had to also reset the legacy preference whenever any launch config type preferred delegate was set.  This shouldn't be a problem in practice, because setPreferredDelegate() is called only from the preference page.  But if someone else were to call this public method, it's possible that the legacy preference setting could be lost before the new ones are fully applied.
Comment 5 Pawel Piech CLA 2010-05-19 12:24:38 EDT
I think it's good to commit with the additional changes.
Comment 6 Darin Wright CLA 2010-05-19 14:28:50 EDT
+1 from myself. I was exporting and importing into different workspaces, so I did not see this in my scenario.

Applied/Fixed.
Comment 7 Darin Wright CLA 2010-05-21 10:30:47 EDT
Verified.