code: public static boolean isEditableRequest(ServletRequest req) {
  
          boolean result = false;
          if (CmsHistoryResourceHandler.isHistoryRequest(req) || CmsJspTagEnableAde.isDirectEditDisabled(req)) {
              // don't display direct edit buttons on an historical resource
              result = false;
          } else {
              CmsFlexController controller = CmsFlexController.getController(req);
              CmsObject cms = controller.getCmsObject();
              result = !cms.getRequestContext().getCurrentProject().isOnlineProject()
                  && !CmsResource.isTemporaryFileName(cms.getRequestContext().getUri());
  
          }
          return result;
      }
docs: Checks if the current request should be direct edit enabled.<p>
  
  @param req the servlet request
  
  @return <code>true</code> if the current request should be direct edit enabled