1 19 20 package org.netbeans.modules.settings.examples; 21 22 import java.util.Properties ; 23 24 28 public final class JavaCompilerSetting { 29 private final static String PROP_DEBUG = "debug"; private final static String PROP_DEPRECATION = "deprecation"; private final static String PROP_CLASS_PATH = "classPath"; private final static String PROP_EXEC_PATH = "path"; 34 35 private java.beans.PropertyChangeSupport propertyChangeSupport = new java.beans.PropertyChangeSupport (this); 36 37 private boolean debug; 38 private boolean deprecation; 39 private String classpath = ""; private String path = ""; 42 public JavaCompilerSetting() { 43 } 44 45 48 public void addPropertyChangeListener(java.beans.PropertyChangeListener l) { 49 propertyChangeSupport.addPropertyChangeListener(l); 50 } 51 52 55 public void removePropertyChangeListener(java.beans.PropertyChangeListener l) { 56 propertyChangeSupport.removePropertyChangeListener(l); 57 } 58 59 private void readProperties(Properties p) { 60 this.classpath = p.getProperty(PROP_CLASS_PATH); 61 this.path = p.getProperty(PROP_EXEC_PATH); 62 String bool = p.getProperty(PROP_DEBUG); 63 if (bool != null) 64 this.debug = Boolean.valueOf(bool).booleanValue(); 65 else 66 this.debug = false; 67 68 bool = p.getProperty(PROP_DEPRECATION); 69 if (bool != null) 70 this.deprecation = Boolean.valueOf(bool).booleanValue(); 71 else 72 this.deprecation = false; 73 } 74 75 private void writeProperties(Properties p) { 76 p.setProperty(PROP_CLASS_PATH, getClasspath()); 77 p.setProperty(PROP_EXEC_PATH, getPath()); 78 p.setProperty(PROP_DEPRECATION, String.valueOf(isDeprecation())); 79 p.setProperty(PROP_DEBUG, String.valueOf(isDebug())); 80 } 81 82 public boolean isDebug() { 83 return this.debug; 84 } 85 public void setDebug(boolean debug) { 86 boolean oldDebug = this.debug; 87 this.debug = debug; 88 propertyChangeSupport.firePropertyChange(PROP_DEBUG, oldDebug, debug); 89 } 90 public boolean isDeprecation() { 91 return this.deprecation; 92 } 93 public void setDeprecation(boolean deprecation) { 94 boolean oldDeprecation = this.deprecation; 95 this.deprecation = deprecation; 96 propertyChangeSupport.firePropertyChange(PROP_DEPRECATION, oldDeprecation, deprecation); 97 } 98 public String getClasspath() { 99 return this.classpath; 100 } 101 public void setClasspath(String classpath) { 102 String oldClasspath = this.classpath; 103 this.classpath = classpath; 104 propertyChangeSupport.firePropertyChange(PROP_CLASS_PATH, oldClasspath, classpath); 105 } 106 public String getPath() { 107 return this.path; 108 } 109 public void setPath(String path) { 110 String oldPath = this.path; 111 this.path = path; 112 propertyChangeSupport.firePropertyChange(PROP_EXEC_PATH, oldPath, path); 113 } 114 115 } 116 | Popular Tags |