private void adaptToEnablementChange(Highlighting highlighting, PropertyChangeEvent event) {
   Object value = event.getNewValue();
   boolean eventValue;
   if (value instanceof Boolean) eventValue = ((Boolean) value).booleanValue();
   else if (IPreferenceStore.TRUE.equals(value)) eventValue = true;
   else eventValue = false;
   highlighting.setEnabled(eventValue);
 }
  private void adaptToTextStyleChange(
      Highlighting highlighting, PropertyChangeEvent event, int styleAttribute) {
    boolean eventValue = false;
    Object value = event.getNewValue();
    if (value instanceof Boolean) eventValue = ((Boolean) value).booleanValue();
    else if (IPreferenceStore.TRUE.equals(value)) eventValue = true;

    TextAttribute oldAttr = highlighting.getTextAttribute();
    boolean activeValue = (oldAttr.getStyle() & styleAttribute) == styleAttribute;

    if (activeValue != eventValue)
      highlighting.setTextAttribute(
          new TextAttribute(
              oldAttr.getForeground(),
              oldAttr.getBackground(),
              eventValue
                  ? oldAttr.getStyle() | styleAttribute
                  : oldAttr.getStyle() & ~styleAttribute));
  }