I have some java code that I want to convert to Xtend. The Java code is:
public void createPartControl(Composite parent) {
final Canvas clock = new Canvas(parent, SWT.None);
clock.addPaintListener(this::drawClock);
}
private void drawClock(PaintEvent e) {
e.gc.drawArc(e.x, e.y, e.width - 1, e.height - 1, 0, 360);
}
My attempt at Xtend code is:
override createPartControl(Composite parent) {
val clock = new Canvas(parent, SWT.None);
clock.addPaintListener(this::drawClock);
}
private def drawClock(PaintEvent e) {
e.gc.drawArc(e.x, e.y, e.width - 1, e.height - 1, 0, 360);
}
The problem is that the expression this::drawClock
is not valid in Xtend. Specifically it says that this
cannot be resolved to a type. How do I achieve the same result using Xtend.