@Override public TextAttribute getData() { return (TextAttribute) super.getData(); }
private void adaptToStyleChange(Token token, 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; Object data= token.getData(); if (data instanceof TextAttribute) { TextAttribute oldAttr= (TextAttribute) data; boolean activeValue= (oldAttr.getStyle() & styleAttribute) == styleAttribute; if (activeValue != eventValue) token.setData(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(), eventValue ? oldAttr.getStyle() | styleAttribute : oldAttr.getStyle() & ~styleAttribute)); } } /**
private void adaptToStyleChange(Token token, 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; Object data= token.getData(); if (data instanceof TextAttribute) { TextAttribute oldAttr= (TextAttribute) data; boolean activeValue= (oldAttr.getStyle() & styleAttribute) == styleAttribute; if (activeValue != eventValue) token.setData(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(), eventValue ? oldAttr.getStyle() | styleAttribute : oldAttr.getStyle() & ~styleAttribute)); } } /**
private void adaptToStyleChange(Token token, 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; Object data= token.getData(); if (data instanceof TextAttribute) { TextAttribute oldAttr= (TextAttribute) data; boolean activeValue= (oldAttr.getStyle() & styleAttribute) == styleAttribute; if (activeValue != eventValue) token.setData(new TextAttribute(oldAttr.getForeground(), oldAttr.getBackground(), eventValue ? oldAttr.getStyle() | styleAttribute : oldAttr.getStyle() & ~styleAttribute)); } } /**
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) { if (token == null) { return; } boolean eventValue = false; Object value = event.getNewValue(); if (value instanceof Boolean) { eventValue = ((Boolean) value).booleanValue(); } else if (IPreferenceStore.TRUE.equals(value)) { eventValue = true; } TextAttribute attr = (TextAttribute) token.getData(); boolean activeValue = (attr.getStyle() & styleAttribute) == styleAttribute; if (activeValue != eventValue) { token.setData(new TextAttribute(attr.getForeground(), attr.getBackground(), eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute)); } }
protected void adaptToColorChange(PropertyChangeEvent event, Token token) { TextAttribute attr = (TextAttribute) token.getData(); token.setData(new TextAttribute(fColorManager.getColor(event.getProperty()), attr.getBackground(), attr.getStyle())); }
protected void adaptToStyleChange(PropertyChangeEvent event, Token token, int styleAttribute) { if (token == null) return; boolean eventValue = false; Object value = event.getNewValue(); if (value instanceof Boolean) eventValue = ((Boolean) value).booleanValue(); TextAttribute attr = (TextAttribute) token.getData(); boolean activeValue = (attr.getStyle() & styleAttribute) == styleAttribute; if (activeValue != eventValue) { Color foreground = attr.getForeground(); Color background = attr.getBackground(); int style = eventValue ? attr.getStyle() | styleAttribute : attr.getStyle() & ~styleAttribute; token.setData(new TextAttribute(foreground, background, style)); } }
protected void adaptToColorChange(PropertyChangeEvent event, Token token) { RGB rgb = null; Object value = event.getNewValue(); if (value instanceof RGB) { rgb = (RGB) value; } else if (value instanceof String) { rgb = StringConverter.asRGB((String) value); } if (rgb != null) { TextAttribute attr = (TextAttribute) token.getData(); token.setData(new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle())); } }
private void adaptToColorChange(Token token, PropertyChangeEvent event) { RGB rgb= null; Object value= event.getNewValue(); if (value instanceof RGB) rgb= (RGB) value; else if (value instanceof String) rgb= StringConverter.asRGB((String) value); if (rgb != null) { String property= event.getProperty(); Color color= fColorManager.getColor(property); if ((color == null || !rgb.equals(color.getRGB())) && fColorManager instanceof IColorManagerExtension) { IColorManagerExtension ext= (IColorManagerExtension) fColorManager; ext.unbindColor(property); ext.bindColor(property, rgb); color= fColorManager.getColor(property); } Object data= token.getData(); if (data instanceof TextAttribute) { TextAttribute oldAttr= (TextAttribute) data; token.setData(new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle())); } } }
private void adaptToColorChange(Token token, PropertyChangeEvent event) { RGB rgb= null; Object value= event.getNewValue(); if (value instanceof RGB) rgb= (RGB) value; else if (value instanceof String) rgb= StringConverter.asRGB((String) value); if (rgb != null) { String property= event.getProperty(); Color color= fColorManager.getColor(property); if ((color == null || !rgb.equals(color.getRGB())) && fColorManager instanceof IColorManagerExtension) { IColorManagerExtension ext= (IColorManagerExtension) fColorManager; ext.unbindColor(property); ext.bindColor(property, rgb); color= fColorManager.getColor(property); } Object data= token.getData(); if (data instanceof TextAttribute) { TextAttribute oldAttr= (TextAttribute) data; token.setData(new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle())); } } }
private void adaptToColorChange(Token token, PropertyChangeEvent event) { RGB rgb= null; Object value= event.getNewValue(); if (value instanceof RGB) rgb= (RGB) value; else if (value instanceof String) rgb= StringConverter.asRGB((String) value); if (rgb != null) { String property= event.getProperty(); Color color= fColorManager.getColor(property); if ((color == null || !rgb.equals(color.getRGB())) && fColorManager instanceof IColorManagerExtension) { IColorManagerExtension ext= (IColorManagerExtension) fColorManager; ext.unbindColor(property); ext.bindColor(property, rgb); color= fColorManager.getColor(property); } Object data= token.getData(); if (data instanceof TextAttribute) { TextAttribute oldAttr= (TextAttribute) data; token.setData(new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle())); } } }