@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);
        }
      }
    }
 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());
     }
   }
 }