1 19 20 package org.netbeans.core.startup.preferences; 21 22 import java.util.prefs.Preferences ; 23 import org.netbeans.Util; 24 import org.netbeans.modules.openide.util.PreferencesProvider; 25 26 29 public class PreferencesProviderImpl implements PreferencesProvider { 30 31 public PreferencesProviderImpl() { 32 } 33 34 public Preferences preferencesForModule(Class cls) { 35 String absolutePath = null; 36 ClassLoader cl = cls.getClassLoader(); 37 if (cl instanceof Util.ModuleProvider) { 38 absolutePath = ((Util.ModuleProvider) cl).getModule().getCodeNameBase(); 39 } else { 40 absolutePath = cls.getName().replaceFirst("(^|\\.)[^.]+$", ""); } 42 assert absolutePath != null; 43 return preferencesRoot().node(absolutePath.replace('.','/')); } 45 46 public Preferences preferencesRoot() { 47 return NbPreferences.userRootImpl(); 48 } 49 } | Popular Tags |