use of com.intellij.refactoring.rename.RenameWrongRefHandler in project intellij-community by JetBrains.
the class RenameLocalTest method doRenameWrongRef.
private void doRenameWrongRef(final String newName) throws Exception {
final String name = getTestName(false);
configureByFile(BASE_PATH + name + ".java");
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
new RenameWrongRefHandler().invoke(getProject(), getEditor(), getFile(), null);
final TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
assert state != null;
final TextRange range = state.getCurrentVariableRange();
assert range != null;
new WriteCommandAction.Simple(getProject()) {
@Override
protected void run() throws Throwable {
getEditor().getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), newName);
}
}.execute().throwException();
state.gotoEnd(false);
checkResultByFile(BASE_PATH + name + "_after.java");
}
Aggregations