void (@NotNull PsiElement expression, @NotNull Editor editor) { // for advanced stuff use ((PsiJavaCodeReferenceElement)expression).advancedResolve(true).getElement(); JavaIntroduceVariableHandlerBase handler = (JavaIntroduceVariableHandlerBase)LanguageRefactoringSupport.INSTANCE.forLanguage(JavaLanguage.INSTANCE) .getIntroduceVariableHandler(); assert handler != null; handler.invoke(expression.getProject(), editor, (PsiExpression)expression); }