import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.LineBackgroundEvent;
import org.eclipse.swt.custom.LineBackgroundListener;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;

public class Sample extends Composite {

	private StyledText styledText = null;

	public Sample(Composite parent, int style) {
		super(parent, style);
		initialize();
	}

	private void initialize() {
		styledText = new StyledText(this, SWT.NONE);
		styledText.setBounds(new Rectangle(10, 15, 432, 320));  // Generated
		
		styledText.addLineBackgroundListener(new LineBackgroundListener() {
			public void lineGetBackground(LineBackgroundEvent event) {
				String txt = event.lineText;
				int indexOf = txt.indexOf("actionBars");
				
//				Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN)
				if(txt.indexOf("actionBars") != -1) {
					event.lineBackground = Display.getCurrent().getSystemColor(SWT.COLOR_BLUE);
					
				}
				//System.out.println("[line]" + event.lineOffset + "-" + event.lineText);
				/*
				if(styledText.getLineAtOffset(event.lineOffset) == 1) {
					System.out.println("라인을 바뀌었습니다[" + event.lineOffset + "]");
	//				event.lineBackground = this.getDisplay().getSystemColor(SWT.COLOR_YELLOW);
				}
				*/
			}
		});

		setSize(new Point(454, 344));
		setLayout(null);
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
