use of com.intellij.openapi.diff.impl.util.FocusDiffSide in project intellij-community by JetBrains.
the class DiffWalkerAction method update.
public void update(AnActionEvent event) {
FocusDiffSide side = DiffUtil.getFocusDiffSide(event.getDataContext());
Presentation presentation = event.getPresentation();
if (side == null) {
presentation.setEnabled(false);
} else {
presentation.setEnabled(getLineNumberToGo(side) >= 0 || event.getInputEvent() instanceof KeyEvent);
}
}
use of com.intellij.openapi.diff.impl.util.FocusDiffSide in project intellij-community by JetBrains.
the class DiffWalkerAction method actionPerformed.
public void actionPerformed(AnActionEvent event) {
FocusDiffSide side = DiffUtil.getFocusDiffSide(event.getDataContext());
if (side == null)
return;
int line = getLineNumberToGo(side);
Editor editor = side.getEditor();
if (line >= 0 && editor != null) {
LogicalPosition pos = new LogicalPosition(line, 0);
editor.getCaretModel().removeSecondaryCarets();
editor.getCaretModel().moveToLogicalPosition(pos);
editor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
}
}
Aggregations