Search in sources :

Example 6 with CodeInsightTestFixtureImpl

use of com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl in project intellij-plugins by JetBrains.

the class DartExtractMethodRefactoringTest method createRefactoring.

@NotNull
private ServerExtractMethodRefactoring createRefactoring(String filePath) {
    ((CodeInsightTestFixtureImpl) myFixture).canChangeDocumentDuringHighlighting(true);
    final PsiFile psiFile = myFixture.configureByFile(filePath);
    // make sure server is warmed up
    myFixture.doHighlighting();
    // find the Element to rename
    final SelectionModel selectionModel = getEditor().getSelectionModel();
    int offset = selectionModel.getSelectionStart();
    final int length = selectionModel.getSelectionEnd() - offset;
    return new ServerExtractMethodRefactoring(getProject(), psiFile.getVirtualFile(), offset, length);
}
Also used : CodeInsightTestFixtureImpl(com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl) ServerExtractMethodRefactoring(com.jetbrains.lang.dart.ide.refactoring.ServerExtractMethodRefactoring) SelectionModel(com.intellij.openapi.editor.SelectionModel) PsiFile(com.intellij.psi.PsiFile) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

CodeInsightTestFixtureImpl (com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl)6 PsiFile (com.intellij.psi.PsiFile)4 NotNull (org.jetbrains.annotations.NotNull)4 SelectionModel (com.intellij.openapi.editor.SelectionModel)2 IOException (java.io.IOException)2 CodeInsightSettings (com.intellij.codeInsight.CodeInsightSettings)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ServerExtractLocalVariableRefactoring (com.jetbrains.lang.dart.ide.refactoring.ServerExtractLocalVariableRefactoring)1 ServerExtractMethodRefactoring (com.jetbrains.lang.dart.ide.refactoring.ServerExtractMethodRefactoring)1 ServerInlineLocalRefactoring (com.jetbrains.lang.dart.ide.refactoring.ServerInlineLocalRefactoring)1 ServerInlineMethodRefactoring (com.jetbrains.lang.dart.ide.refactoring.ServerInlineMethodRefactoring)1 File (java.io.File)1