public static boolean isWritable(ASTNode thisElement) {
    PsiFile file = getContainingFile(thisElement);
    return file == null || file.isWritable();
  }
public static boolean isWritable(ASTNode thisElement)