@Override
    public void actionPerformed(AnActionEvent e) {
      if (myElement != null) {
        final PsiElement element = myElement.getElement();
        final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
        final PsiElement originalElement = DocumentationManager.getOriginalElement(element);
        boolean processed = false;
        if (provider instanceof CompositeDocumentationProvider) {
          for (final DocumentationProvider documentationProvider :
              ((CompositeDocumentationProvider) provider).getProviders()) {
            if (documentationProvider instanceof ExternalDocumentationHandler
                && ((ExternalDocumentationHandler) documentationProvider)
                    .handleExternal(element, originalElement)) {
              processed = true;
              break;
            }
          }
        }

        if (!processed) {
          final List<String> urls = provider.getUrlFor(element, originalElement);
          assert urls != null : provider;
          assert !urls.isEmpty() : provider;
          ExternalJavaDocAction.showExternalJavadoc(urls);
        }
      }
    }
  private void setDataInternal(
      SmartPsiElementPointer element, String text, final Rectangle viewRect, boolean skip) {
    boolean justShown = false;

    myElement = element;

    if (!myIsShown && myHint != null) {
      myEditorPane.setText(text);
      applyFontSize();
      myManager.showHint(myHint);
      myIsShown = justShown = true;
    }

    if (!justShown) {
      myEditorPane.setText(text);
      applyFontSize();
    }

    if (!skip) {
      myText = text;
    }

    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            myEditorPane.scrollRectToVisible(viewRect);
          }
        });
  }
 public void update(AnActionEvent e) {
   final Presentation presentation = e.getPresentation();
   presentation.setEnabled(false);
   if (myElement != null) {
     final PsiElement element = myElement.getElement();
     final DocumentationProvider provider = DocumentationManager.getProviderFromElement(element);
     final PsiElement originalElement = DocumentationManager.getOriginalElement(element);
     if (provider instanceof ExternalDocumentationProvider) {
       presentation.setEnabled(
           element != null
               && ((ExternalDocumentationProvider) provider)
                   .hasDocumentationFor(element, originalElement));
     } else {
       final List<String> urls = provider.getUrlFor(element, originalElement);
       presentation.setEnabled(element != null && urls != null && !urls.isEmpty());
     }
   }
 }