1 11 package org.eclipse.ui.internal.preferences; 12 13 16 public abstract class AbstractBooleanListener extends AbstractPropertyListener { 17 18 private IDynamicPropertyMap map; 19 private boolean defaultValue; 20 private String propertyId; 21 22 public AbstractBooleanListener() { 23 } 24 25 public void attach(IDynamicPropertyMap map, String propertyId, boolean defaultValue) { 26 this.defaultValue = defaultValue; 27 this.propertyId = propertyId; 28 if (this.map != null) { 29 this.map.removeListener(this); 30 } 31 32 this.map = map; 33 34 if (this.map != null) { 35 this.map.addListener(new String []{propertyId}, this); 36 } 37 } 38 39 42 protected void update() { 43 handleValue(PropertyUtil.get(map, propertyId, defaultValue)); 44 } 45 46 50 protected abstract void handleValue(boolean b); 51 52 53 } 54 | Popular Tags |