KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbjarproject > ui > FoldersListSettings


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.ejbjarproject.ui;
21
22 import java.io.File JavaDoc;
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 JavaDoc LAST_EXTERNAL_SOURCE_ROOT = "srcRoot"; //NOI18N
32

33     private static final String JavaDoc NEW_PROJECT_COUNT = "newProjectCount"; //NOI18N
34

35     private static final String JavaDoc LAST_USED_CP_FOLDER = "lastUsedClassPathFolder"; //NOI18N
36

37     private static final String JavaDoc SHOW_AGAIN_BROKEN_REF_ALERT = "showAgainBrokenRefAlert"; //NOI18N
38

39     private static final String JavaDoc SHOW_AGAIN_BROKEN_SERVER_ALERT = "showAgainBrokenServerAlert"; //NOI18N
40

41     private static final String JavaDoc LAST_USED_ARTIFACT_FOLDER = "lastUsedArtifactFolder"; //NOI18N
42

43     private static final String JavaDoc LAST_USED_SOURCE_ROOT_FOLDER = "lastUsedSourceRootFolder"; //NOI18N
44

45     private static final String JavaDoc AGREED_SET_JDK_14 = "agreeSetJdk14"; // NOI18N
46

47     private static final String JavaDoc AGREED_SET_SOURCE_LEVEL_14 = "agreeSetSourceLevel14"; // NOI18N
48

49     private static final String JavaDoc AGREED_SET_JDK_15 = "agreeSetJdk15"; // NOI18N
50

51     private static final String JavaDoc AGREED_SET_SOURCE_LEVEL_15 = "agreeSetSourceLevel15"; // NOI18N
52

53     private static final String JavaDoc LAST_USED_SERVER = "lastUsedServer"; // NOI18N
54

55     public String JavaDoc displayName() {
56         return NbBundle.getMessage (FoldersListSettings.class, "TXT_EjbJarProjectFolderList"); //NOI18N
57
}
58
59     public String JavaDoc getLastExternalSourceRoot () {
60         return (String JavaDoc) getProperty(LAST_EXTERNAL_SOURCE_ROOT);
61     }
62
63     public void setLastExternalSourceRoot (String JavaDoc path) {
64         putProperty (LAST_EXTERNAL_SOURCE_ROOT, path, true);
65     }
66
67     public int getNewProjectCount () {
68         Integer JavaDoc value = (Integer JavaDoc) 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 JavaDoc(count),true);
74     }
75     
76     public boolean isShowAgainBrokenRefAlert() {
77         Boolean JavaDoc b = (Boolean JavaDoc)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 JavaDoc b = (Boolean JavaDoc)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 JavaDoc getLastUsedSourceRootFolder () {
99         String JavaDoc folder = (String JavaDoc) this.getProperty (LAST_USED_SOURCE_ROOT_FOLDER);
100         if (folder == null) {
101             folder = System.getProperty("user.home"); //NOI18N
102
}
103         return new File JavaDoc (folder);
104     }
105
106     public void setLastUsedSourceRootFolder (File JavaDoc folder) {
107         assert folder != null : "Folder can not be null";
108         String JavaDoc path = folder.getAbsolutePath();
109         this.putProperty (LAST_USED_SOURCE_ROOT_FOLDER, path, true);
110     }
111     
112     public File JavaDoc getLastUsedArtifactFolder () {
113         String JavaDoc folder = (String JavaDoc) this.getProperty (LAST_USED_ARTIFACT_FOLDER);
114         if (folder == null) {
115             folder = System.getProperty("user.home"); //NOI18N
116
}
117         return new File JavaDoc (folder);
118     }
119
120     public void setLastUsedArtifactFolder (File JavaDoc folder) {
121         assert folder != null : "Folder can not be null";
122         String JavaDoc path = folder.getAbsolutePath();
123         this.putProperty (LAST_USED_ARTIFACT_FOLDER, path, true);
124     }
125
126     public File JavaDoc getLastUsedClassPathFolder () {
127         String JavaDoc lucpr = (String JavaDoc) this.getProperty (LAST_USED_CP_FOLDER);
128         if (lucpr == null) {
129             lucpr = System.getProperty("user.home"); //NOI18N
130
}
131         return new File JavaDoc (lucpr);
132     }
133
134     public void setLastUsedClassPathFolder (File JavaDoc folder) {
135         assert folder != null : "ClassPath root can not be null";
136         String JavaDoc path = folder.getAbsolutePath();
137         this.putProperty(LAST_USED_CP_FOLDER, path, true);
138     }
139     
140     public boolean isAgreedSetJdk14() {
141         Boolean JavaDoc b = (Boolean JavaDoc)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 JavaDoc b = (Boolean JavaDoc)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 JavaDoc b = (Boolean JavaDoc)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 JavaDoc b = (Boolean JavaDoc)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 JavaDoc serverInstanceID) {
177         putProperty(LAST_USED_SERVER, serverInstanceID, true);
178     }
179
180     public String JavaDoc getLastUsedServer() {
181         return (String JavaDoc) getProperty(LAST_USED_SERVER);
182     }
183 }
184
Popular Tags