1 19 20 package org.netbeans.modules.java.project; 21 22 import java.beans.PropertyChangeListener ; 23 import java.beans.PropertyChangeSupport ; 24 import java.util.prefs.Preferences ; 25 import org.openide.util.NbPreferences; 26 27 31 public class JavaProjectSettings { 32 33 private JavaProjectSettings() {} 34 35 private static final PropertyChangeSupport pcs = new PropertyChangeSupport (JavaProjectSettings.class); 36 37 40 public static final int TYPE_PACKAGE_VIEW = 0; 41 42 45 public static final int TYPE_TREE = 1; 46 47 public static final String PROP_PACKAGE_VIEW_TYPE = "packageViewType"; private static final String PROP_SHOW_AGAIN_BROKEN_REF_ALERT = "showAgainBrokenRefAlert"; 50 private static Preferences prefs() { 51 return NbPreferences.forModule(JavaProjectSettings.class); 52 } 53 54 58 public static int getPackageViewType() { 59 return prefs().getInt(PROP_PACKAGE_VIEW_TYPE, TYPE_PACKAGE_VIEW); 60 } 61 62 66 public static void setPackageViewType(int type) { 67 int currentType = getPackageViewType(); 68 if (currentType != type) { 69 prefs().putInt(PROP_PACKAGE_VIEW_TYPE, type); 70 pcs.firePropertyChange(PROP_PACKAGE_VIEW_TYPE, currentType, type); 71 } 72 } 73 74 public static boolean isShowAgainBrokenRefAlert() { 75 return prefs().getBoolean(PROP_SHOW_AGAIN_BROKEN_REF_ALERT, true); 76 } 77 78 public static void setShowAgainBrokenRefAlert(boolean again) { 79 prefs().putBoolean(PROP_SHOW_AGAIN_BROKEN_REF_ALERT, again); 80 } 81 82 public static void addPropertyChangeListener(PropertyChangeListener l) { 83 pcs.addPropertyChangeListener(l); 84 } 85 86 public static void removePropertyChangeListener(PropertyChangeListener l) { 87 pcs.removePropertyChangeListener(l); 88 } 89 90 } 91 | Popular Tags |