1 19 20 package org.netbeans.modules.java.j2seproject.ui; 21 22 import org.openide.util.NbBundle; 23 24 import java.io.File ; 25 import java.util.prefs.Preferences ; 26 import org.netbeans.modules.java.j2seproject.ui.FoldersListSettings; 27 import org.openide.util.NbPreferences; 28 29 32 public class FoldersListSettings { 33 private static final FoldersListSettings INSTANCE = new FoldersListSettings(); 34 private static final String NEW_PROJECT_COUNT = "newProjectCount"; 36 private static final String NEW_APP_COUNT = "newApplicationCount"; 38 private static final String NEW_LIB_COUNT = "newLibraryCount"; 40 private static final String LAST_USED_CP_FOLDER = "lastUsedClassPathFolder"; 42 private static final String LAST_USED_ARTIFACT_FOLDER = "lastUsedArtifactFolder"; 44 45 public static FoldersListSettings getDefault () { 46 return INSTANCE; 47 } 48 49 private static Preferences getPreferences() { 50 return NbPreferences.forModule(FoldersListSettings.class); 51 } 52 53 public String displayName() { 54 return NbBundle.getMessage(FoldersListSettings.class, "TXT_J2SEProjectFolderList"); 55 } 56 57 public int getNewProjectCount () { 58 return getPreferences().getInt(NEW_PROJECT_COUNT, 0); 59 } 60 61 public void setNewProjectCount (int count) { 62 getPreferences().putInt(NEW_PROJECT_COUNT, count); 63 } 64 65 public int getNewApplicationCount () { 66 return getPreferences().getInt(NEW_APP_COUNT, 0); 67 } 68 69 public void setNewApplicationCount (int count) { 70 getPreferences().putInt(NEW_APP_COUNT, count); 71 } 72 73 public int getNewLibraryCount () { 74 return getPreferences().getInt(NEW_LIB_COUNT, 0); 75 } 76 77 public void setNewLibraryCount (int count) { 78 getPreferences().putInt(NEW_LIB_COUNT, count); 79 } 80 81 public File getLastUsedClassPathFolder () { 82 return new File (getPreferences().get(LAST_USED_CP_FOLDER, System.getProperty("user.home"))); 83 } 84 85 public void setLastUsedClassPathFolder (File folder) { 86 assert folder != null : "ClassPath root can not be null"; 87 String path = folder.getAbsolutePath(); 88 getPreferences().put(LAST_USED_CP_FOLDER, path); 89 } 90 91 public File getLastUsedArtifactFolder () { 92 return new File (getPreferences().get(LAST_USED_ARTIFACT_FOLDER, System.getProperty("user.home"))); 93 } 94 95 public void setLastUsedArtifactFolder (File folder) { 96 assert folder != null : "Folder can not be null"; 97 String path = folder.getAbsolutePath(); 98 getPreferences().put(LAST_USED_ARTIFACT_FOLDER, path); 99 } 100 } 101 | Popular Tags |