1 19 20 package org.netbeans.modules.j2ee.ejbjarproject.ui; 21 22 import java.io.File ; 23 import org.openide.options.SystemOption; 24 import org.openide.util.NbBundle; 25 26 27 public class FoldersListSettings extends SystemOption { 28 29 static final long serialVersionUID = -4905094097265543014L; 30 31 private static final String LAST_EXTERNAL_SOURCE_ROOT = "srcRoot"; 33 private static final String NEW_PROJECT_COUNT = "newProjectCount"; 35 private static final String LAST_USED_CP_FOLDER = "lastUsedClassPathFolder"; 37 private static final String SHOW_AGAIN_BROKEN_REF_ALERT = "showAgainBrokenRefAlert"; 39 private static final String SHOW_AGAIN_BROKEN_SERVER_ALERT = "showAgainBrokenServerAlert"; 41 private static final String LAST_USED_ARTIFACT_FOLDER = "lastUsedArtifactFolder"; 43 private static final String LAST_USED_SOURCE_ROOT_FOLDER = "lastUsedSourceRootFolder"; 45 private static final String AGREED_SET_JDK_14 = "agreeSetJdk14"; 47 private static final String AGREED_SET_SOURCE_LEVEL_14 = "agreeSetSourceLevel14"; 49 private static final String AGREED_SET_JDK_15 = "agreeSetJdk15"; 51 private static final String AGREED_SET_SOURCE_LEVEL_15 = "agreeSetSourceLevel15"; 53 private static final String LAST_USED_SERVER = "lastUsedServer"; 55 public String displayName() { 56 return NbBundle.getMessage (FoldersListSettings.class, "TXT_EjbJarProjectFolderList"); } 58 59 public String getLastExternalSourceRoot () { 60 return (String ) getProperty(LAST_EXTERNAL_SOURCE_ROOT); 61 } 62 63 public void setLastExternalSourceRoot (String path) { 64 putProperty (LAST_EXTERNAL_SOURCE_ROOT, path, true); 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 boolean isShowAgainBrokenRefAlert() { 77 Boolean b = (Boolean )getProperty(SHOW_AGAIN_BROKEN_REF_ALERT); 78 return b == null ? true : b.booleanValue(); 79 } 80 81 public void setShowAgainBrokenRefAlert(boolean again) { 82 this.putProperty(SHOW_AGAIN_BROKEN_REF_ALERT, Boolean.valueOf(again), true); 83 } 84 85 public boolean isShowAgainBrokenServerAlert() { 86 Boolean b = (Boolean )getProperty(SHOW_AGAIN_BROKEN_SERVER_ALERT); 87 return b == null ? true : b.booleanValue(); 88 } 89 90 public void setShowAgainBrokenServerAlert(boolean again) { 91 this.putProperty(SHOW_AGAIN_BROKEN_SERVER_ALERT, Boolean.valueOf(again), true); 92 } 93 94 public static FoldersListSettings getDefault () { 95 return (FoldersListSettings) SystemOption.findObject (FoldersListSettings.class, true); 96 } 97 98 public File getLastUsedSourceRootFolder () { 99 String folder = (String ) this.getProperty (LAST_USED_SOURCE_ROOT_FOLDER); 100 if (folder == null) { 101 folder = System.getProperty("user.home"); } 103 return new File (folder); 104 } 105 106 public void setLastUsedSourceRootFolder (File folder) { 107 assert folder != null : "Folder can not be null"; 108 String path = folder.getAbsolutePath(); 109 this.putProperty (LAST_USED_SOURCE_ROOT_FOLDER, path, true); 110 } 111 112 public File getLastUsedArtifactFolder () { 113 String folder = (String ) this.getProperty (LAST_USED_ARTIFACT_FOLDER); 114 if (folder == null) { 115 folder = System.getProperty("user.home"); } 117 return new File (folder); 118 } 119 120 public void setLastUsedArtifactFolder (File folder) { 121 assert folder != null : "Folder can not be null"; 122 String path = folder.getAbsolutePath(); 123 this.putProperty (LAST_USED_ARTIFACT_FOLDER, path, true); 124 } 125 126 public File getLastUsedClassPathFolder () { 127 String lucpr = (String ) this.getProperty (LAST_USED_CP_FOLDER); 128 if (lucpr == null) { 129 lucpr = System.getProperty("user.home"); } 131 return new File (lucpr); 132 } 133 134 public void setLastUsedClassPathFolder (File folder) { 135 assert folder != null : "ClassPath root can not be null"; 136 String path = folder.getAbsolutePath(); 137 this.putProperty(LAST_USED_CP_FOLDER, path, true); 138 } 139 140 public boolean isAgreedSetJdk14() { 141 Boolean b = (Boolean )getProperty(AGREED_SET_JDK_14); 142 return b == null ? true : b.booleanValue(); 143 } 144 145 public void setAgreedSetJdk14(boolean agreed) { 146 this.putProperty(AGREED_SET_JDK_14, Boolean.valueOf(agreed), true); 147 } 148 149 public boolean isAgreedSetSourceLevel14() { 150 Boolean b = (Boolean )getProperty(AGREED_SET_SOURCE_LEVEL_14); 151 return b == null ? true : b.booleanValue(); 152 } 153 154 public void setAgreedSetSourceLevel14(boolean agreed) { 155 this.putProperty(AGREED_SET_SOURCE_LEVEL_14, Boolean.valueOf(agreed), true); 156 } 157 158 public boolean isAgreedSetJdk15() { 159 Boolean b = (Boolean )getProperty(AGREED_SET_JDK_15); 160 return b == null ? true : b.booleanValue(); 161 } 162 163 public void setAgreedSetJdk15(boolean agreed) { 164 this.putProperty(AGREED_SET_JDK_15, Boolean.valueOf(agreed), true); 165 } 166 167 public boolean isAgreedSetSourceLevel15() { 168 Boolean b = (Boolean )getProperty(AGREED_SET_SOURCE_LEVEL_15); 169 return b == null ? true : b.booleanValue(); 170 } 171 172 public void setAgreedSetSourceLevel15(boolean agreed) { 173 this.putProperty(AGREED_SET_SOURCE_LEVEL_15, Boolean.valueOf(agreed), true); 174 } 175 176 public void setLastUsedServer(String serverInstanceID) { 177 putProperty(LAST_USED_SERVER, serverInstanceID, true); 178 } 179 180 public String getLastUsedServer() { 181 return (String ) getProperty(LAST_USED_SERVER); 182 } 183 } 184 | Popular Tags |