private static void setXPathInjected(final PsiFile file) {
          final Boolean flag = file.getUserData(XML_FILE_WITH_XPATH_INJECTTION);

          // This is a very ugly hack, but it is required to make the implicit usages provider recognize namespace declarations used from
          // within injected XPath fragments during IDEA startup. Otherwise, the namespace declarations may be marked as unused until the
          // first edit in the file.
          // Another (possibly perferred) solution might be to make org.intellij.lang.xpath.xslt.impl.XsltImplicitUsagesProvider run
          // unconditionally or - even better - pull its functionality into the platform.
          if (flag == null) {
            ApplicationManager.getApplication().invokeLater(() -> {
              if (file.getUserData(XML_FILE_WITH_XPATH_INJECTTION) == null) {
                file.putUserData(XML_FILE_WITH_XPATH_INJECTTION, Boolean.TRUE);
                // TODO workaround for highlighting tests
                if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
                  DaemonCodeAnalyzer.getInstance(file.getProject()).restart(file);
                }
              }
            });
          }
        }
private static void setXPathInjected(final PsiFile file)