Search in sources :

Example 1 with SelectWordHandler

use of com.intellij.codeInsight.editorActions.SelectWordHandler in project intellij-community by JetBrains.

the class CodeInsightTestUtil method doWordSelectionTestOnDirectory.

public static void doWordSelectionTestOnDirectory(@NotNull final CodeInsightTestFixture fixture, @TestDataFile @NotNull final String directoryName, @NotNull final String filesExtension) {
    final SelectWordHandler action = new SelectWordHandler(null);
    fixture.copyDirectoryToProject(directoryName, directoryName);
    fixture.configureByFile(directoryName + "/before." + filesExtension);
    int i = 1;
    while (true) {
        final String fileName = directoryName + "/after" + i + "." + filesExtension;
        if (new File(fixture.getTestDataPath() + "/" + fileName).exists()) {
            action.execute(fixture.getEditor(), DataManager.getInstance().getDataContext(fixture.getEditor().getComponent()));
            fixture.checkResultByFile(fileName);
            i++;
        } else {
            break;
        }
    }
    assertTrue("At least one 'after'-file required", i > 1);
}
Also used : SelectWordHandler(com.intellij.codeInsight.editorActions.SelectWordHandler) TestDataFile(com.intellij.testFramework.TestDataFile) PsiFile(com.intellij.psi.PsiFile) File(java.io.File)

Example 2 with SelectWordHandler

use of com.intellij.codeInsight.editorActions.SelectWordHandler in project intellij-plugins by JetBrains.

the class DartSelectWordTest method doTest.

private void doTest(@NotNull final String before, @NotNull final String... after) {
    myFixture.configureByText("file.dart", before);
    final DataContext dataContext = DataManager.getInstance().getDataContext(myFixture.getEditor().getComponent());
    final SelectWordHandler handler = new SelectWordHandler(null);
    for (String text : after) {
        handler.execute(myFixture.getEditor(), myFixture.getEditor().getCaretModel().getCurrentCaret(), dataContext);
        myFixture.checkResult(text);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) SelectWordHandler(com.intellij.codeInsight.editorActions.SelectWordHandler)

Example 3 with SelectWordHandler

use of com.intellij.codeInsight.editorActions.SelectWordHandler in project intellij-community by JetBrains.

the class CodeInsightTestUtil method doWordSelectionTest.

public static void doWordSelectionTest(@NotNull final CodeInsightTestFixture fixture, @TestDataFile @NotNull final String before, @TestDataFile final String... after) {
    assert after != null && after.length > 0;
    fixture.configureByFile(before);
    final SelectWordHandler action = new SelectWordHandler(null);
    final DataContext dataContext = DataManager.getInstance().getDataContext(fixture.getEditor().getComponent());
    for (String file : after) {
        action.execute(fixture.getEditor(), dataContext);
        fixture.checkResultByFile(file, false);
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) SelectWordHandler(com.intellij.codeInsight.editorActions.SelectWordHandler)

Aggregations

SelectWordHandler (com.intellij.codeInsight.editorActions.SelectWordHandler)3 DataContext (com.intellij.openapi.actionSystem.DataContext)2 PsiFile (com.intellij.psi.PsiFile)1 TestDataFile (com.intellij.testFramework.TestDataFile)1 File (java.io.File)1