use of org.intellij.lang.xpath.xslt.refactoring.RefactoringOptions in project intellij-community by JetBrains.
the class Xslt2RefactoringTest method doExtractFunction.
private void doExtractFunction() throws Throwable {
myFixture.configureByFile(getTestFileName() + ".xsl");
final Editor editor = myFixture.getEditor();
assertTrue("Selection required", editor.getSelectionModel().hasSelection());
editor.getCaretModel().moveToOffset(editor.getSelectionModel().getSelectionStart());
final XsltExtractFunctionAction action = new XsltExtractFunctionAction() {
@Override
protected RefactoringOptions getSettings(XPathExpression expression, Set<XPathExpression> matchingExpressions) {
return new RefactoringOptions() {
@Override
public boolean isCanceled() {
return false;
}
@Override
public String getName() {
return "f:foo";
}
};
}
};
final PsiFile file = InjectedLanguageUtil.findInjectedPsiNoCommit(myFixture.getFile(), editor.getCaretModel().getOffset());
final Editor editorWindow = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, file);
assertTrue(editorWindow instanceof EditorWindow);
action.invoke(myFixture.getProject(), editorWindow, file, null);
myFixture.checkResultByFile(getTestFileName() + "_after.xsl");
}
Aggregations