Search in sources :

Example 1 with MouseButton

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;
}
Also used : GuiTask(org.fest.swing.edt.GuiTask) Condition(org.fest.swing.timing.Condition) GuiQuery(org.fest.swing.edt.GuiQuery) KeymapManager(com.intellij.openapi.keymap.KeymapManager) ComponentDriver(org.fest.swing.driver.ComponentDriver) HighlightInfo(com.intellij.codeInsight.daemon.impl.HighlightInfo) VirtualFile(com.intellij.openapi.vfs.VirtualFile) HighlightSeverity(com.intellij.lang.annotation.HighlightSeverity) com.intellij.openapi.editor(com.intellij.openapi.editor) GenericTypeMatcher(org.fest.swing.core.GenericTypeMatcher) MouseButton(org.fest.swing.core.MouseButton) GuiActionRunner.execute(org.fest.swing.edt.GuiActionRunner.execute) Strings.quote(org.fest.util.Strings.quote) Keymap(com.intellij.openapi.keymap.Keymap) ArrayList(java.util.ArrayList) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) Reflection.method(org.fest.reflect.core.Reflection.method) Assertions.assertThat(org.fest.assertions.Assertions.assertThat) Project(com.intellij.openapi.project.Project) TextHitInfo(java.awt.font.TextHitInfo) OpenFileDescriptor(com.intellij.openapi.fileEditor.OpenFileDescriptor) JBList(com.intellij.ui.components.JBList) FocusManager(javax.swing.FocusManager) GuiTestUtil(com.intellij.testGuiFramework.framework.GuiTestUtil) TextRange(com.intellij.openapi.util.TextRange) AttributedString(java.text.AttributedString) KeyEvent(java.awt.event.KeyEvent) FileEditor(com.intellij.openapi.fileEditor.FileEditor) java.awt(java.awt) com.intellij.openapi.actionSystem(com.intellij.openapi.actionSystem) DialogFixture(org.fest.swing.fixture.DialogFixture) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) InputMethodEvent(java.awt.event.InputMethodEvent) AttributedCharacterIterator(java.text.AttributedCharacterIterator) GuiTask(org.fest.swing.edt.GuiTask) Pause.pause(org.fest.swing.timing.Pause.pause) EditorComponentImpl(com.intellij.openapi.editor.impl.EditorComponentImpl) Robot(org.fest.swing.core.Robot) NotNull(org.jetbrains.annotations.NotNull) Assert(org.junit.Assert) Ref(com.intellij.openapi.util.Ref) javax.swing(javax.swing) FileEditorManager(com.intellij.openapi.fileEditor.FileEditorManager) EditorComponentImpl(com.intellij.openapi.editor.impl.EditorComponentImpl) FileEditor(com.intellij.openapi.fileEditor.FileEditor)

Aggregations

HighlightInfo (com.intellij.codeInsight.daemon.impl.HighlightInfo)1 HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)1 com.intellij.openapi.actionSystem (com.intellij.openapi.actionSystem)1 com.intellij.openapi.editor (com.intellij.openapi.editor)1 EditorComponentImpl (com.intellij.openapi.editor.impl.EditorComponentImpl)1 FileEditor (com.intellij.openapi.fileEditor.FileEditor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 Keymap (com.intellij.openapi.keymap.Keymap)1 KeymapManager (com.intellij.openapi.keymap.KeymapManager)1 Project (com.intellij.openapi.project.Project)1 Ref (com.intellij.openapi.util.Ref)1 TextRange (com.intellij.openapi.util.TextRange)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 GuiTestUtil (com.intellij.testGuiFramework.framework.GuiTestUtil)1 JBList (com.intellij.ui.components.JBList)1 java.awt (java.awt)1 InputMethodEvent (java.awt.event.InputMethodEvent)1 KeyEvent (java.awt.event.KeyEvent)1 TextHitInfo (java.awt.font.TextHitInfo)1