code: public static void enableAdeTagAction(PageContext context) throws JspException {
  
          ServletRequest req = context.getRequest();
          if (CmsHistoryResourceHandler.isHistoryRequest(req)) {
              // don't display advanced direct edit buttons on an historical resource
              return;
          }
  
          CmsFlexController controller = CmsFlexController.getController(req);
          CmsObject cms = controller.getCmsObject();
  
          if (cms.getRequestContext().getCurrentProject().isOnlineProject()) {
              // advanced direct edit is never enabled in the online project
              return;
          }
  
          if (CmsResource.isTemporaryFileName(cms.getRequestContext().getUri())) {
              // don't display advanced direct edit buttons if a temporary file is displayed
              return;
          }
          updateDirectEditFlagInSession(req);
          if (isDirectEditDisabled(req)) {
              try {
                  String buttonLeft = null;
                  Integer left = (Integer)((HttpServletRequest)req).getSession().getAttribute(
                      CmsGwtConstants.PARAM_BUTTON_LEFT);
  
                  if (left != null) {
                      buttonLeft = left.toString() + "px";
                  } else {
                      buttonLeft = "20%";
                  }
                  String titleMessage = Messages.get().getBundle(
                      OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)).key(Messages.GUI_TOOLBAR_ENABLE_EDIT_MODE_0);
                  context.getOut().print(getPreviewInclude(buttonLeft, titleMessage));
              } catch (IOException e) {
                  throw new JspException(e);
              }
          } else {
  
              I_CmsDirectEditProvider eb = new CmsAdvancedDirectEditProvider();
              eb.init(cms, CmsDirectEditMode.TRUE, "");
              CmsJspTagEditable.setDirectEditProvider(context, eb);
  
              try {
                  CmsContainerpageActionElement actionEl = new CmsContainerpageActionElement(
                      context,
                      (HttpServletRequest)req,
                      (HttpServletResponse)context.getResponse());
                  context.getOut().print(actionEl.exportAll());
              } catch (Exception e) {
                  throw new JspException(e);
              }
          }
      }
docs: Enable-ade action method.<p>
  
  @param context the current JSP page context
  
  @throws JspException in case something goes wrong