1 19 20 package org.netbeans.modules.ruby.rubyproject.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.ruby.rubyproject.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 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_RubyProjectFolderList"); 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 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 |