KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > apisupport > project > ui > ModuleUISettings


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.apisupport.project.ui;
21 import java.util.prefs.Preferences JavaDoc;
22 import org.openide.util.NbPreferences;
23
24 /**
25  * Storage for settings used by a module's UI (wizards, properties, ...)
26  *
27  * @author Martin Krauskopf, Jesse Glick
28  */

29 public class ModuleUISettings {
30
31     private static final String JavaDoc LAST_CHOSEN_LIBRARY_LOCATION = "lastChosenLibraryLocation"; // NOI18N
32
private static final String JavaDoc LAST_USED_NB_PLATFORM_LOCATION = "lastUsedNbPlatformLocation"; // NOI18N
33
private static final String JavaDoc NEW_MODULE_COUNTER = "newModuleCounter"; //NOI18N
34
private static final String JavaDoc NEW_SUITE_COUNTER = "newSuiteCounter"; //NOI18N
35
private static final String JavaDoc CONFIRM_RELOAD_IN_IDE = "confirmReloadInIDE"; // NOI18N
36
private static final String JavaDoc LAST_USED_PLATFORM_ID = "lastUsedPlatformID"; // NOI18N
37
private static final String JavaDoc HARNESSES_UPGRADED = "harnessesUpgraded"; // NOI18N
38

39     public static ModuleUISettings getDefault() {
40         return new ModuleUISettings(); // stateless
41
}
42
43     private Preferences JavaDoc prefs() {
44         return NbPreferences.forModule(ModuleUISettings.class);
45     }
46
47     public int getNewModuleCounter() {
48         return prefs().getInt(NEW_MODULE_COUNTER, 0);
49     }
50
51     public void setNewModuleCounter(int count) {
52         prefs().putInt(NEW_MODULE_COUNTER, count);
53     }
54
55     public int getNewSuiteCounter() {
56         return prefs().getInt(NEW_SUITE_COUNTER, 0);
57     }
58
59     public void setNewSuiteCounter(int count) {
60         prefs().putInt(NEW_SUITE_COUNTER, count);
61     }
62
63     public String JavaDoc getLastUsedNbPlatformLocation() {
64         return prefs().get(LAST_USED_NB_PLATFORM_LOCATION, System.getProperty("user.home")); // NOI18N
65
}
66
67     public void setLastUsedNbPlatformLocation(String JavaDoc location) {
68         assert location != null : "Location can not be null"; // NOI18N
69
prefs().put(LAST_USED_NB_PLATFORM_LOCATION, location);
70     }
71
72     public boolean getConfirmReloadInIDE() {
73         return prefs().getBoolean(CONFIRM_RELOAD_IN_IDE, true);
74     }
75
76     public void setConfirmReloadInIDE(boolean b) {
77         prefs().putBoolean(CONFIRM_RELOAD_IN_IDE, b);
78     }
79
80     public String JavaDoc getLastChosenLibraryLocation() {
81         return prefs().get(LAST_CHOSEN_LIBRARY_LOCATION, System.getProperty("user.home")); // NOI18N
82
}
83
84     public void setLastChosenLibraryLocation(String JavaDoc location) {
85         assert location != null : "Location can not be null"; // NOI18N
86
prefs().put(LAST_CHOSEN_LIBRARY_LOCATION, location);
87     }
88
89     public String JavaDoc getLastUsedPlatformID() {
90         return prefs().get(LAST_USED_PLATFORM_ID, "default"); // NOI18N
91
}
92
93     public void setLastUsedPlatformID(String JavaDoc id) {
94         assert id != null : "Platform ID can not be null"; // NOI18N
95
prefs().put(LAST_USED_PLATFORM_ID, id);
96     }
97
98     public boolean getHarnessesUpgraded() {
99         return prefs().getBoolean(HARNESSES_UPGRADED, false);
100     }
101
102     public void setHarnessesUpgraded(boolean b) {
103         prefs().putBoolean(HARNESSES_UPGRADED, b);
104     }
105
106 }
107
Popular Tags