use of org.fest.swing.core.MouseButton in project intellij-community by JetBrains.
the class EditorFixture method moveToAndClick.
/**
* Moves the caret to the given caret offset (0-based).
*
* @param offset the character offset.
*/
public EditorFixture moveToAndClick(final int offset, MouseButton button) {
assertThat(offset).isGreaterThanOrEqualTo(0);
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
FileEditorManager manager = FileEditorManager.getInstance(myFrame.getProject());
Editor editor = manager.getSelectedTextEditor();
assert editor != null;
VisualPosition visualPosition = editor.offsetToVisualPosition(offset);
Point point = editor.visualPositionToXY(visualPosition);
Component editorComponent = robot.finder().find(editor.getComponent(), component -> component instanceof EditorComponentImpl);
robot.click(editorComponent, point, button, 1);
}
});
return this;
}
Aggregations