Source:
public Control createControl(CompositeRuler parentRuler, Composite parentControl) { fParentRuler= parentRuler; fCachedTextViewer= parentRuler.getTextViewer(); fCachedTextWidget= fCachedTextViewer.getTextWidget(); fCachedTextWidget.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { postRedraw(); } }); fCanvas= new Canvas(parentControl, SWT.NO_FOCUS) { public void addMouseListener(MouseListener listener) { if (listener == fMouseHandler) super.addMouseListener(listener); else { TypedListener typedListener= null; if (listener != null) typedListener= new TypedListener(listener); addListener(SWT.MouseDoubleClick, typedListener); } } }; fCanvas.setBackground(getBackground(fCanvas.getDisplay())); fCanvas.setForeground(fForeground); fCanvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { if (fCachedTextViewer != null) doubleBufferPaint(event.gc); } }); fCanvas.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { handleDispose(); fCachedTextViewer= null; fCachedTextWidget= null; } }); fMouseHandler= new MouseHandler(); fCanvas.addMouseListener(fMouseHandler); fCanvas.addMouseMoveListener(fMouseHandler); if (fCachedTextViewer != null) { fCachedTextViewer.addViewportListener(fInternalListener); fCachedTextViewer.addTextListener(fInternalListener); if (fFont == null) { if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed()) fFont= fCachedTextWidget.getFont(); } } if (fFont != null) fCanvas.setFont(fFont); updateNumberOfDigits(); computeIndentations(); return fCanvas; }

Target:
public Control createControl(CompositeRuler parentRuler, Composite parentControl) { fParentRuler= parentRuler; fCachedTextViewer= parentRuler.getTextViewer(); fCachedTextWidget= fCachedTextViewer.getTextWidget(); fCachedTextWidget.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { postRedraw(); } }); fCanvas= new Canvas(parentControl, SWT.NO_FOCUS ) { public void addMouseListener(MouseListener listener) { if (listener == fMouseHandler) super.addMouseListener(listener); else { TypedListener typedListener= null; if (listener != null) typedListener= new TypedListener(listener); addListener(SWT.MouseDoubleClick, typedListener); } } }; fCanvas.setBackground(getBackground(fCanvas.getDisplay())); fCanvas.setForeground(fForeground); fCanvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { if (fCachedTextViewer != null) doubleBufferPaint(event.gc); } }); fCanvas.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { handleDispose(); fCachedTextViewer= null; fCachedTextWidget= null; } }); fMouseHandler= new MouseHandler(); fCanvas.addMouseListener(fMouseHandler); fCanvas.addMouseMoveListener(fMouseHandler); fCanvas.addMouseWheelListener(fMouseHandler); if (fCachedTextViewer != null) { fCachedTextViewer.addViewportListener(fInternalListener); fCachedTextViewer.addTextListener(fInternalListener); if (fFont == null) { if (fCachedTextWidget != null && !fCachedTextWidget.isDisposed()) fFont= fCachedTextWidget.getFont(); } } if (fFont != null) fCanvas.setFont(fFont); updateNumberOfDigits(); computeIndentations(); return fCanvas; }