Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2005 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at Contributors: IBM Corporation - Initial implementation /
package org.eclipse.ant.internal.ui.editor.text;
import  org.eclipse.swt.SWT;
public abstract class AbstractAntEditorScanner extends RuleBasedScanner {
	protected void adaptToColorChange(PropertyChangeEvent eventToken token) {
		RGB rgbnull;
		Object valueevent.getNewValue();
		if (value instanceof RGB) {
			rgb= (RGB) value;
else if (value instanceof String) {
			rgb= StringConverter.asRGB((Stringvalue);
		if (rgb != null) {
			token.setData(new TextAttribute(ColorManager.getDefault().getColor(rgb), attr.getBackground(), attr.getStyle()));
	protected void adaptToStyleChange(PropertyChangeEvent eventToken tokenint styleAttribute) {
	 	if (token == null) {
		boolean eventValuefalse;
		Object valueevent.getNewValue();
		if (value instanceof Boolean) {
			eventValue= ((Booleanvalue).booleanValue();
else if (..equals(value)) {
		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 TextAttribute createTextAttribute(String colorIDString boldKeyString italicKey) {
		Color colornull;
		if (colorID != null) {
			color= AntUIPlugin.getPreferenceColor(colorID);
		int stylestore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL;
		if (store.getBoolean(italicKey)) {
			style |= SWT.ITALIC;
		return new TextAttribute(colornullstyle);
New to GrepCode? Check out our FAQ X