@Override
  protected boolean startsOnTheSameElements(Editor editor,
                                            RefactoringActionHandler handler,
                                            PsiElement[] elements) {
    if (elements.length == 0 && handler instanceof IntroduceConstantHandler) {
      PsiVariable variable = getVariable();
      if (variable != null) {
        PsiReference reference = TargetElementUtil.findReference(editor);
        if (reference instanceof PsiReferenceExpression &&
            reference.resolve() == null &&
            Comparing.strEqual(variable.getName(), ((PsiReferenceExpression)reference).getReferenceName())) {
          return true;
        }
      }
    }
    return elements.length == 1 && startsOnTheSameElement(handler, elements[0]);
  }
@Override
  protected boolean startsOnTheSameElements(Editor editor,
                                            RefactoringActionHandler handler,
                                            PsiElement[] elements)