1 19 20 package org.netbeans.modules.apisupport.project.ui; 21 import java.util.prefs.Preferences ; 22 import org.openide.util.NbPreferences; 23 24 29 public class ModuleUISettings { 30 31 private static final String LAST_CHOSEN_LIBRARY_LOCATION = "lastChosenLibraryLocation"; private static final String LAST_USED_NB_PLATFORM_LOCATION = "lastUsedNbPlatformLocation"; private static final String NEW_MODULE_COUNTER = "newModuleCounter"; private static final String NEW_SUITE_COUNTER = "newSuiteCounter"; private static final String CONFIRM_RELOAD_IN_IDE = "confirmReloadInIDE"; private static final String LAST_USED_PLATFORM_ID = "lastUsedPlatformID"; private static final String HARNESSES_UPGRADED = "harnessesUpgraded"; 39 public static ModuleUISettings getDefault() { 40 return new ModuleUISettings(); } 42 43 private Preferences prefs() { 44 return NbPreferences.forModule(ModuleUISettings.class); 45 } 46 47 public int getNewModuleCounter() { 48 return prefs().getInt(NEW_MODULE_COUNTER, 0); 49 } 50 51 public void setNewModuleCounter(int count) { 52 prefs().putInt(NEW_MODULE_COUNTER, count); 53 } 54 55 public int getNewSuiteCounter() { 56 return prefs().getInt(NEW_SUITE_COUNTER, 0); 57 } 58 59 public void setNewSuiteCounter(int count) { 60 prefs().putInt(NEW_SUITE_COUNTER, count); 61 } 62 63 public String getLastUsedNbPlatformLocation() { 64 return prefs().get(LAST_USED_NB_PLATFORM_LOCATION, System.getProperty("user.home")); } 66 67 public void setLastUsedNbPlatformLocation(String location) { 68 assert location != null : "Location can not be null"; prefs().put(LAST_USED_NB_PLATFORM_LOCATION, location); 70 } 71 72 public boolean getConfirmReloadInIDE() { 73 return prefs().getBoolean(CONFIRM_RELOAD_IN_IDE, true); 74 } 75 76 public void setConfirmReloadInIDE(boolean b) { 77 prefs().putBoolean(CONFIRM_RELOAD_IN_IDE, b); 78 } 79 80 public String getLastChosenLibraryLocation() { 81 return prefs().get(LAST_CHOSEN_LIBRARY_LOCATION, System.getProperty("user.home")); } 83 84 public void setLastChosenLibraryLocation(String location) { 85 assert location != null : "Location can not be null"; prefs().put(LAST_CHOSEN_LIBRARY_LOCATION, location); 87 } 88 89 public String getLastUsedPlatformID() { 90 return prefs().get(LAST_USED_PLATFORM_ID, "default"); } 92 93 public void setLastUsedPlatformID(String id) { 94 assert id != null : "Platform ID can not be null"; prefs().put(LAST_USED_PLATFORM_ID, id); 96 } 97 98 public boolean getHarnessesUpgraded() { 99 return prefs().getBoolean(HARNESSES_UPGRADED, false); 100 } 101 102 public void setHarnessesUpgraded(boolean b) { 103 prefs().putBoolean(HARNESSES_UPGRADED, b); 104 } 105 106 } 107 | Popular Tags |