Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Import Preferences
Import Preferences [message #603815] Wed, 16 December 2009 23:12 Go to next message
Cosmin is currently offline Cosmin
Messages: 23
Registered: October 2009
Junior Member
Hello,

I have a plugin that implements IStartup, and I would like to import some standard preferences on eclipse start.

Here is the code I'm using based on examples from org.eclipse.core.runtime.Preferences :

public final void importDefaultPrefs(String path) {
IPreferencesService prefService = org.eclipse.core.runtime.Platform
.getPreferencesService();
//IPreferencesService prefService = org.eclipse.core.internal.preferences.PreferencesService
// .getDefault();
try {
//Preferences.importPreferences(new Path(path));
prefService.importPreferences(new FileInputStream(new File(path)));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (CoreException e) {
e.printStackTrace();
}
}

But on Eclipse startup I get this error :
Error notifying a preference change listener. Check the log for details.Invalid thread access.
Any idea what I have done wrong or overlooked?

Regards, Cosmin
Re: Import Preferences [message #603819 is a reply to message #603815] Thu, 17 December 2009 08:45 Go to previous message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
On 17/12/09 9:42 AM, Cosmin wrote:
> But on Eclipse startup I get this error : Error notifying a preference
> change listener. Check the log for details.Invalid thread access. Any
> idea what I have done wrong or overlooked?

Probably one of the listener is trying to access the UI when fired. Do
you have any stack traces?

--
- Prakash
Platform UI Team, IBM

Blog <http://blog.eclipse-tips.com>
Twitter <http://www.twitter.com/Eclipse_Tips>
Previous Topic:Import Preferences
Next Topic:Trouble with headless build since Eclipse 3.5
Goto Forum:
  


Current Time: Fri Jul 25 05:05:03 EDT 2014

Powered by FUDForum. Page generated in 0.03615 seconds