use of net.codemirror.lib.CodeMirror.GutterClickHandler in project gerrit by GerritCodeReview.
the class DiffScreen method onGutterClick.
private GutterClickHandler onGutterClick(final CodeMirror cm) {
return new GutterClickHandler() {
@Override
public void handle(CodeMirror instance, final int line, final String gutterClass, NativeEvent clickEvent) {
if (Element.as(clickEvent.getEventTarget()).hasClassName(getLineNumberClassName()) && clickEvent.getButton() == NativeEvent.BUTTON_LEFT && !clickEvent.getMetaKey() && !clickEvent.getAltKey() && !clickEvent.getCtrlKey() && !clickEvent.getShiftKey()) {
cm.setCursor(Pos.create(line));
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
getCommentManager().newDraftOnGutterClick(cm, gutterClass, line + 1);
}
});
}
}
};
}
Aggregations