private static boolean statementCanBePlacedAlong(PsiElement element) {
    if (element instanceof JspTemplateStatement) {
      PsiElement neighbour = element.getPrevSibling();
      // we can place statement inside scriptlet only
      return neighbour != null && !(neighbour instanceof JspTemplateStatement);
    }
    PsiElement parent = element.getParent();
    if (element instanceof PsiBlockStatement && !(parent instanceof PsiCodeBlock)) return false;
    if (parent instanceof JspClassLevelDeclarationStatement) return false;
    if (statementsCanBeMovedWithin(parent)) return true;
    if (parent instanceof PsiIfStatement &&
        (element == ((PsiIfStatement)parent).getThenBranch() || element == ((PsiIfStatement)parent).getElseBranch())) {
      return true;
    }
    if (parent instanceof PsiWhileStatement && element == ((PsiWhileStatement)parent).getBody()) {
      return true;
    }
    if (parent instanceof PsiDoWhileStatement && element == ((PsiDoWhileStatement)parent).getBody()) {
      return true;
    }
    // know nothing about that
    return false;
  }
private static boolean statementCanBePlacedAlong(PsiElement element)