private static void replaceReferences(PsiLocalVariable variable, String boxName) {
    List<PsiReferenceExpression> references = findReferences(variable);
    PsiElementFactory factory = JavaPsiFacade.getElementFactory(variable.getProject());
    PsiExpression expr = factory.createExpressionFromText(boxName + "." + variable.getName(), null);
    for (PsiReferenceExpression reference : references) {
      reference.replace(expr);
    }
  }
private static void replaceReferences(PsiLocalVariable variable, String boxName)