KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > clientproject > 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.clientproject.ui;
21
22 import org.openide.options.SystemOption;
23 import org.openide.util.NbBundle;
24
25 import java.io.File JavaDoc;
26
27 /**
28  * Misnamed storage of information application to the new j2seproject wizard.
29  */

30 public class FoldersListSettings extends SystemOption {
31
32     private static final long serialVersionUID = 2386225041150479082L;
33
34     private static final String JavaDoc NEW_PROJECT_COUNT = "newProjectCount"; //NOI18N
35

36     private static final String JavaDoc NEW_APP_COUNT = "newApplicationCount"; //NOI18N
37

38     private static final String JavaDoc NEW_LIB_COUNT = "newLibraryCount"; //NOI18N
39

40     private static final String JavaDoc LAST_USED_CP_FOLDER = "lastUsedClassPathFolder"; //NOI18N
41

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

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

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

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

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

52     private static final String JavaDoc SHOW_AGAIN_BROKEN_REF_ALERT = "showAgainBrokenRefAlert"; //NOI18N
53

54     private static final String JavaDoc SHOW_AGAIN_BROKEN_SERVER_ALERT = "showAgainBrokenServerAlert"; //NOI18N
55

56     private static final String JavaDoc LAST_USED_SERVER = "lastUsedServer"; // NOI18N
57

58
59     public static FoldersListSettings getDefault () {
60         return (FoldersListSettings) SystemOption.findObject (FoldersListSettings.class, true);
61     }
62     
63     public String JavaDoc displayName() {
64         return NbBundle.getMessage(FoldersListSettings.class, "TXT_AppClientProjectFolderList");
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 int getNewApplicationCount () {
77         Integer JavaDoc value = (Integer JavaDoc) 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 JavaDoc(count),true);
83     }
84     
85     public int getNewLibraryCount () {
86         Integer JavaDoc value = (Integer JavaDoc) 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 JavaDoc(count),true);
92     }
93
94     public File JavaDoc getLastUsedClassPathFolder () {
95         String JavaDoc lucpr = (String JavaDoc) this.getProperty (LAST_USED_CP_FOLDER);
96         if (lucpr == null) {
97             lucpr = System.getProperty("user.home"); //NOI18N
98
}
99         return new File JavaDoc (lucpr);
100     }
101
102     public void setLastUsedClassPathFolder (File JavaDoc folder) {
103         assert folder != null : "ClassPath root can not be null";
104         String JavaDoc path = folder.getAbsolutePath();
105         this.putProperty(LAST_USED_CP_FOLDER, path, true);
106     }
107
108     public File JavaDoc getLastUsedArtifactFolder () {
109         String JavaDoc folder = (String JavaDoc) this.getProperty (LAST_USED_ARTIFACT_FOLDER);
110         if (folder == null) {
111             folder = System.getProperty("user.home"); //NOI18N
112
}
113         return new File JavaDoc (folder);
114     }
115
116     public void setLastUsedArtifactFolder (File JavaDoc folder) {
117         assert folder != null : "Folder can not be null";
118         String JavaDoc path = folder.getAbsolutePath();
119         this.putProperty (LAST_USED_ARTIFACT_FOLDER, path, true);
120     }
121
122     public boolean isAgreedSetJdk14() {
123         Boolean JavaDoc b = (Boolean JavaDoc)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 JavaDoc b = (Boolean JavaDoc)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 JavaDoc b = (Boolean JavaDoc)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 JavaDoc b = (Boolean JavaDoc)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 JavaDoc b = (Boolean JavaDoc)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 JavaDoc serverInstanceID) {
168         putProperty(LAST_USED_SERVER, serverInstanceID, true);
169     }
170
171     public String JavaDoc getLastUsedServer() {
172         return (String JavaDoc) getProperty(LAST_USED_SERVER);
173     }
174 }
175
Popular Tags