1 11 package org.eclipse.core.runtime.preferences; 12 13 import java.util.EventObject ; 14 import org.osgi.service.prefs.BackingStoreException; 15 import org.osgi.service.prefs.Preferences; 16 17 28 public interface IEclipsePreferences extends Preferences { 29 30 38 public final class NodeChangeEvent extends EventObject { 39 42 private static final long serialVersionUID = 1L; 43 44 private Preferences child; 45 46 52 public NodeChangeEvent(Preferences parent, Preferences child) { 53 super(parent); 54 this.child = child; 55 } 56 57 63 public Preferences getParent() { 64 return (Preferences) getSource(); 65 } 66 67 77 public Preferences getChild() { 78 return child; 79 } 80 } 81 82 90 public interface INodeChangeListener { 91 92 101 public void added(NodeChangeEvent event); 102 103 112 public void removed(NodeChangeEvent event); 113 } 114 115 122 public final class PreferenceChangeEvent extends EventObject { 123 126 private static final long serialVersionUID = 1L; 127 128 private String key; 129 private Object newValue; 130 private Object oldValue; 131 132 144 public PreferenceChangeEvent(Object node, String key, Object oldValue, Object newValue) { 145 super(node); 146 if (key == null || !(node instanceof Preferences)) 147 throw new IllegalArgumentException (); 148 this.key = key; 149 this.newValue = newValue; 150 this.oldValue = oldValue; 151 } 152 153 159 public Preferences getNode() { 160 return (Preferences) source; 161 } 162 163 169 public String getKey() { 170 return key; 171 } 172 173 180 public Object getNewValue() { 181 return newValue; 182 } 183 184 191 public Object getOldValue() { 192 return oldValue; 193 } 194 } 195 196 204 public interface IPreferenceChangeListener { 205 206 216 public void preferenceChange(PreferenceChangeEvent event); 217 } 218 219 229 public void addNodeChangeListener(INodeChangeListener listener); 230 231 241 public void removeNodeChangeListener(INodeChangeListener listener); 242 243 253 public void addPreferenceChangeListener(IPreferenceChangeListener listener); 254 255 265 public void removePreferenceChangeListener(IPreferenceChangeListener listener); 266 267 286 public void removeNode() throws BackingStoreException; 287 288 304 public Preferences node(String path); 305 306 315 public void accept(IPreferenceNodeVisitor visitor) throws BackingStoreException; 316 } 317 | Popular Tags |