001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: package org.netbeans.modules.sql.project.ui;
021:
022: import org.openide.util.NbBundle;
023: import org.openide.util.NbPreferences;
024:
025: /**
026: * DOCUMENT ME!
027: *
028: * @author
029: * @version
030: */
031: public class FoldersListSettings {
032: /**
033: * DOCUMENT ME!
034: */
035: private static final String LAST_EXTERNAL_SOURCE_ROOT = "srcRoot"; // NOI18N
036: private static final String NEW_PROJECT_COUNT = "newProjectCount"; // NOI18N
037: private static final String SHOW_AGAIN_BROKEN_REF_ALERT = "showAgainBrokenRefAlert"; // NOI18N
038:
039: private static FoldersListSettings INSTANCE = new FoldersListSettings();
040:
041: private FoldersListSettings() {
042: }
043:
044: /**
045: * DOCUMENT ME!
046: *
047: * @return DOCUMENT ME!
048: */
049: public String displayName() {
050: return NbBundle.getMessage(FoldersListSettings.class,
051: "TXT_WebProjectFolderList"); // NOI18N
052: }
053:
054: /**
055: * DOCUMENT ME!
056: *
057: * @return DOCUMENT ME!
058: */
059: public String getLastExternalSourceRoot() {
060: return NbPreferences.forModule(FoldersListSettings.class).get(
061: LAST_EXTERNAL_SOURCE_ROOT, null);
062: }
063:
064: /**
065: * DOCUMENT ME!
066: *
067: * @param path DOCUMENT ME!
068: */
069: public void setLastExternalSourceRoot(String path) {
070: if (path != null) {
071: NbPreferences.forModule(FoldersListSettings.class).put(
072: LAST_EXTERNAL_SOURCE_ROOT, path);
073: } else {
074: NbPreferences.forModule(FoldersListSettings.class).remove(
075: LAST_EXTERNAL_SOURCE_ROOT);
076: }
077: }
078:
079: /**
080: * DOCUMENT ME!
081: *
082: * @return DOCUMENT ME!
083: */
084: public int getNewProjectCount() {
085: return NbPreferences.forModule(FoldersListSettings.class)
086: .getInt(NEW_PROJECT_COUNT, 0);
087: }
088:
089: /**
090: * DOCUMENT ME!
091: *
092: * @param count DOCUMENT ME!
093: */
094: public void setNewProjectCount(int count) {
095: NbPreferences.forModule(FoldersListSettings.class).putInt(
096: NEW_PROJECT_COUNT, count);
097: }
098:
099: /**
100: * DOCUMENT ME!
101: *
102: * @return DOCUMENT ME!
103: */
104: public boolean isShowAgainBrokenRefAlert() {
105: return NbPreferences.forModule(FoldersListSettings.class)
106: .getBoolean(SHOW_AGAIN_BROKEN_REF_ALERT, true);
107: }
108:
109: /**
110: * DOCUMENT ME!
111: *
112: * @param again DOCUMENT ME!
113: */
114: public void setShowAgainBrokenRefAlert(boolean again) {
115: NbPreferences.forModule(FoldersListSettings.class).putBoolean(
116: SHOW_AGAIN_BROKEN_REF_ALERT, again);
117: }
118:
119: /**
120: * DOCUMENT ME!
121: *
122: * @return DOCUMENT ME!
123: */
124: public static FoldersListSettings getDefault() {
125: return INSTANCE;
126: }
127: }
|