1 19 20 package org.netbeans.modules.j2ee.clientproject.ui; 21 22 import org.openide.options.SystemOption; 23 import org.openide.util.NbBundle; 24 25 import java.io.File ; 26 27 30 public class FoldersListSettings extends SystemOption { 31 32 private static final long serialVersionUID = 2386225041150479082L; 33 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 private static final String AGREED_SET_JDK_14 = "agreeSetJdk14"; 46 private static final String AGREED_SET_SOURCE_LEVEL_14 = "agreeSetSourceLevel14"; 48 private static final String AGREED_SET_JDK_15 = "agreeSetJdk15"; 50 private static final String AGREED_SET_SOURCE_LEVEL_15 = "agreeSetSourceLevel15"; 52 private static final String SHOW_AGAIN_BROKEN_REF_ALERT = "showAgainBrokenRefAlert"; 54 private static final String SHOW_AGAIN_BROKEN_SERVER_ALERT = "showAgainBrokenServerAlert"; 56 private static final String LAST_USED_SERVER = "lastUsedServer"; 58 59 public static FoldersListSettings getDefault () { 60 return (FoldersListSettings) SystemOption.findObject (FoldersListSettings.class, true); 61 } 62 63 public String displayName() { 64 return NbBundle.getMessage(FoldersListSettings.class, "TXT_AppClientProjectFolderList"); 65 } 66 67 public int getNewProjectCount () { 68 Integer value = (Integer ) getProperty (NEW_PROJECT_COUNT); 69 return value == null ? 0 : value.intValue(); 70 } 71 72 public void setNewProjectCount (int count) { 73 this.putProperty(NEW_PROJECT_COUNT, new Integer (count),true); 74 } 75 76 public int getNewApplicationCount () { 77 Integer value = (Integer ) getProperty (NEW_APP_COUNT); 78 return value == null ? 0 : value.intValue(); 79 } 80 81 public void setNewApplicationCount (int count) { 82 this.putProperty(NEW_APP_COUNT, new Integer (count),true); 83 } 84 85 public int getNewLibraryCount () { 86 Integer value = (Integer ) getProperty (NEW_LIB_COUNT); 87 return value == null ? 0 : value.intValue(); 88 } 89 90 public void setNewLibraryCount (int count) { 91 this.putProperty(NEW_LIB_COUNT, new Integer (count),true); 92 } 93 94 public File getLastUsedClassPathFolder () { 95 String lucpr = (String ) this.getProperty (LAST_USED_CP_FOLDER); 96 if (lucpr == null) { 97 lucpr = System.getProperty("user.home"); } 99 return new File (lucpr); 100 } 101 102 public void setLastUsedClassPathFolder (File folder) { 103 assert folder != null : "ClassPath root can not be null"; 104 String path = folder.getAbsolutePath(); 105 this.putProperty(LAST_USED_CP_FOLDER, path, true); 106 } 107 108 public File getLastUsedArtifactFolder () { 109 String folder = (String ) this.getProperty (LAST_USED_ARTIFACT_FOLDER); 110 if (folder == null) { 111 folder = System.getProperty("user.home"); } 113 return new File (folder); 114 } 115 116 public void setLastUsedArtifactFolder (File folder) { 117 assert folder != null : "Folder can not be null"; 118 String path = folder.getAbsolutePath(); 119 this.putProperty (LAST_USED_ARTIFACT_FOLDER, path, true); 120 } 121 122 public boolean isAgreedSetJdk14() { 123 Boolean b = (Boolean )getProperty(AGREED_SET_JDK_14); 124 return b == null ? true : b.booleanValue(); 125 } 126 127 public void setAgreedSetJdk14(boolean agreed) { 128 this.putProperty(AGREED_SET_JDK_14, Boolean.valueOf(agreed), true); 129 } 130 131 public boolean isAgreedSetSourceLevel14() { 132 Boolean b = (Boolean )getProperty(AGREED_SET_SOURCE_LEVEL_14); 133 return b == null ? true : b.booleanValue(); 134 } 135 136 public void setAgreedSetSourceLevel14(boolean agreed) { 137 this.putProperty(AGREED_SET_SOURCE_LEVEL_14, Boolean.valueOf(agreed), true); 138 } 139 140 public boolean isAgreedSetJdk15() { 141 Boolean b = (Boolean )getProperty(AGREED_SET_JDK_15); 142 return b == null ? true : b.booleanValue(); 143 } 144 145 public void setAgreedSetJdk15(boolean agreed) { 146 this.putProperty(AGREED_SET_JDK_15, Boolean.valueOf(agreed), true); 147 } 148 149 public boolean isAgreedSetSourceLevel15() { 150 Boolean b = (Boolean )getProperty(AGREED_SET_SOURCE_LEVEL_15); 151 return b == null ? true : b.booleanValue(); 152 } 153 154 public void setAgreedSetSourceLevel15(boolean agreed) { 155 this.putProperty(AGREED_SET_SOURCE_LEVEL_15, Boolean.valueOf(agreed), true); 156 } 157 158 public boolean isShowAgainBrokenServerAlert() { 159 Boolean b = (Boolean )getProperty(SHOW_AGAIN_BROKEN_SERVER_ALERT); 160 return b == null ? true : b.booleanValue(); 161 } 162 163 public void setShowAgainBrokenServerAlert(boolean again) { 164 this.putProperty(SHOW_AGAIN_BROKEN_SERVER_ALERT, Boolean.valueOf(again), true); 165 } 166 167 public void setLastUsedServer(String serverInstanceID) { 168 putProperty(LAST_USED_SERVER, serverInstanceID, true); 169 } 170 171 public String getLastUsedServer() { 172 return (String ) getProperty(LAST_USED_SERVER); 173 } 174 } 175 | Popular Tags |