本文整理了Java中org.eclipse.jface.text.rules.Token.getData()
方法的一些代码示例,展示了Token.getData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Token.getData()
方法的具体详情如下:
包路径:org.eclipse.jface.text.rules.Token
类名称:Token
方法名:getData
暂无
代码示例来源:origin: org.eclipse.mylyn.wikitext/ui
@Override
public TextAttribute getData() {
return (TextAttribute) super.getData();
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
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));
}
}
/**
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
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));
}
}
/**
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
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));
}
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui
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));
}
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
protected void adaptToColorChange(PropertyChangeEvent event, Token token) {
TextAttribute attr = (TextAttribute) token.getData();
token.setData(new TextAttribute(fColorManager.getColor(event.getProperty()), attr.getBackground(), attr.getStyle()));
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
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));
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui
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()));
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
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()));
}
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
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()));
}
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
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()));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!