Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Restoring Default Preferences for all preferences
Restoring Default Preferences for all preferences [message #1269924] Wed, 12 March 2014 06:17 Go to next message
El Arbi Aboussoror is currently offline El Arbi Aboussoror
Messages: 90
Registered: June 2010
Member
Hi,

I'm wondering how to programmatically restore the default settings for all the preferences available in a product. I'm a bit confused with scopes and stores Sad

I tried this:

  public static void restoreAllPreferencesToDefault() throws BackingStoreException {
    IEclipsePreferences rootNode = PreferencesService.getDefault().getRootNode();
    clearAll(rootNode);
  }

  private static void clearAll(Preferences node) throws BackingStoreException {
    node.clear();
    String[] names = node.childrenNames();
    for (String name : names) {
      clearAll(node.node(name));
    }
  }


But I'm not sure it solves the problem correctly ??
Re: Restoring Default Preferences for all preferences [message #1289312 is a reply to message #1269924] Wed, 09 April 2014 03:57 Go to previous message
Hussein MHANNA is currently offline Hussein MHANNA
Messages: 29
Registered: February 2014
Location: LAVAL
Junior Member
Hi,

You can restore the default value of a preferences by using : PlatformUI.getPreferenceStore().setToDefault(YOUR_PREFERENCE_NAME);

Hussein


ALL4TEC
Previous Topic:No 'Project Explorer' entry in 'Show in' menu
Next Topic:"Failed to create the Java Virtual Machine."..huh?
Goto Forum:
  


Current Time: Fri Jul 25 14:31:27 EDT 2014

Powered by FUDForum. Page generated in 0.02641 seconds