Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Reading prefs in plugin startup?

Your preferences should be in the dsf.gdb plug-in if it's using them. We ran into that with Codan recently.

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Marc Khouzam
> Sent: Tuesday, June 07, 2011 2:55 PM
> To: 'CDT General developers list.'
> Subject: [cdt-dev] Reading prefs in plugin startup?
> 
> Hi,
> 
> a question for the more experienced CDT folks.
> 
> I currently read a preference in the start() method of a plugin.
> I'm not sure I'm allowed to do this, as it is causing an initialization problem.
> Here is the scenario
> 
> 1- The dsf.gdb plugin calls pref.getBoolean("dsf.gdb.ui", nonStopPref)
> 2- The dsf.gdb.UI plugin has to be started to get that preference, and will
> need to call the preferenceInitializer
> 3- But dsf.gdb.ui.start() actually calls pref.getBoolean("dsf.gdb.ui",
> tracingPref) At this time, the prefInitializer has not been called yet, I assume
> because it is waiting for the plugin startup to be finished, so I get the wrong
> preference value (it does not try to call the prefInitializer itself).
> 
> I thought about putting the call to the preference store into a job so it will
> allow the plugin to finish its startup.  However I think that can lead to a race
> condition because that new job is on another thread and could still be run
> before the prefInitializer is run (the start() of a plugin is not on the UI
> thread).
> 
> Am I not supposed to read preferences in the plugin.start() method?
> 
> Thanks
> 
> Marc
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top