private static PsiStatement copyElement(PsiStatement e) throws IncorrectOperationException {
      // We cannot call el.copy() for 'else' since it sets context to parent 'if'.
      // This causes copy to be invalidated after parent 'if' is removed by setElseBranch method.
      PsiElementFactory factory = JavaPsiFacade.getElementFactory(e.getProject());
      return factory.createStatementFromText(e.getText(), null);
    }
private static PsiStatement copyElement(PsiStatement e)