Search code examples
eclipse-pluginrefreshworkspace

Set Eclipse "Refresh using native hooks or polling" to true through java code?


Is there a way to set "Preferences -> General -> Workspace -> Refresh using native hooks or polling" to true through java code? I'm developing an eclipse plugin that changes the resources a lot and therefore, the projects are always out of sync.


Solution

  • Found the answer:

    IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode("org.eclipse.core.resources");
    prefs.putBoolean(ResourcesPlugin.PREF_AUTO_REFRESH, true);
    prefs.flush();
    

    Thanks all.