use of com.intellij.openapi.editor.impl.EditorComponentImpl 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;
}
use of com.intellij.openapi.editor.impl.EditorComponentImpl in project intellij-community by JetBrains.
the class AbstractValueHint method showHint.
protected boolean showHint(final JComponent component) {
myInsideShow = true;
if (myCurrentHint != null) {
myCurrentHint.hide();
}
myCurrentHint = new LightweightHint(component) {
@Override
protected boolean canAutoHideOn(TooltipEvent event) {
InputEvent inputEvent = event.getInputEvent();
if (inputEvent instanceof MouseEvent) {
Component comp = inputEvent.getComponent();
if (comp instanceof EditorComponentImpl) {
EditorImpl editor = ((EditorComponentImpl) comp).getEditor();
return !isInsideCurrentRange(editor, ((MouseEvent) inputEvent).getPoint());
}
}
return true;
}
};
myCurrentHint.addHintListener(new HintListener() {
@Override
public void hintHidden(EventObject event) {
if (myHideRunnable != null && !myInsideShow) {
myHideRunnable.run();
}
onHintHidden();
}
});
// editor may be disposed before later invokator process this action
if (myEditor.isDisposed() || myEditor.getComponent().getRootPane() == null) {
return false;
}
Point p = HintManagerImpl.getHintPosition(myCurrentHint, myEditor, myEditor.xyToLogicalPosition(myPoint), HintManager.UNDER);
HintHint hint = HintManagerImpl.createHintHint(myEditor, p, myCurrentHint, HintManager.UNDER, true);
hint.setShowImmediately(true);
HintManagerImpl.getInstanceImpl().showEditorHint(myCurrentHint, myEditor, p, HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING, 0, false, hint);
myInsideShow = false;
return true;
}
Aggregations