code: public static String getNoPreviewReason(CmsObject cms, CmsResource resource) {
  
          Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
          String noPreviewReason = null;
          if (resource.getState().isDeleted() && !(resource instanceof I_CmsHistoryResource)) {
              noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_DELETED_0);
          } else if (resource.isFolder()) {
              noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_FOLDER_0);
          } else {
              String siteRoot = OpenCms.getSiteManager().getSiteRoot(resource.getRootPath());
              // previewing only resources that are in the same site or don't have a site root at all
              if ((siteRoot != null) && !siteRoot.equals(cms.getRequestContext().getSiteRoot())) {
                  noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_OTHER_SITE_0);
              } else if (resource.getTypeId() == CmsResourceTypeBinary.getStaticTypeId()) {
                  String mimeType = OpenCms.getResourceManager().getMimeType(resource.getName(), null, "empty");
                  if (!m_previewMimeTypes.contains(mimeType)) {
                      noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_WRONG_MIME_TYPE_0);
                  }
              }
          }
          return noPreviewReason;
      }
docs: Returns the no preview reason if there is any.<p>
  
  @param cms the current cms context
  @param resource the resource to check
  
  @return the no preview reason if there is any