Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Import Preferences
Import Preferences [message #504100] Thu, 17 December 2009 04: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 #504154 is a reply to message #504100] Thu, 17 December 2009 13: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:director installs automatically all optional bundles of a IU
Next Topic:Import Preferences
Goto Forum:
  


Current Time: Sun Sep 21 02:20:18 GMT 2014

Powered by FUDForum. Page generated in 0.01682 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software