@Override
  protected void doInvoke(final @NotNull PsiFile file, final int offset, final @NotNull String uri, final Editor editor)
    throws IncorrectOperationException {
    final String url = findUrl(file, offset, uri);
    final Project project = file.getProject();

    ProgressManager.getInstance().run(new Task.Backgroundable(project, XmlBundle.message(
      "xml.intention.fetch.progress.fetching.resource")) {
      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        while (true) {
          try {
            HttpConfigurable.getInstance().prepareURL(url);
            fetchDtd(project, uri, url, indicator);
            ApplicationManager.getApplication().invokeLater(() -> DaemonCodeAnalyzer.getInstance(project).restart(file));
            return;
          }
          catch (IOException ex) {
            LOG.info(ex);
            @SuppressWarnings("InstanceofCatchParameter")
            String problemUrl = ex instanceof FetchingResourceIOException ? ((FetchingResourceIOException)ex).url : url;
            String message = XmlBundle.message("xml.intention.fetch.error.fetching.title");

            if (!url.equals(problemUrl)) {
              message = XmlBundle.message("xml.intention.fetch.error.fetching.dependent.resource");
            }

            if (!IOExceptionDialog.showErrorDialog(message, XmlBundle.message("xml.intention.fetch.error.fetching.resource", problemUrl))) {
              break; // cancel fetching
            }
          }
        }
      }
    });
  }
@Override
  protected void doInvoke(final @NotNull PsiFile file, final int offset, final @NotNull String uri, final Editor editor)