static boolean isJavaFxTemplateAvailable(DataContext dataContext, Set<? extends JpsModuleSourceRootType<?>> requiredRootTypes) {
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
    final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
    if (project == null || view == null) {
      return false;
    }

    final PsiDirectory[] directories = view.getDirectories();
    if (directories.length == 0) {
      return false;
    }

    Module module = ModuleUtilCore.findModuleForFile(directories[0].getVirtualFile(), project);
    if (!hasJavaFxDependency(module)) {
      return false;
    }

    final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
    return Arrays.stream(directories)
      .map(PsiDirectory::getVirtualFile)
      .anyMatch(virtualFile -> index.isUnderSourceRootOfType(virtualFile, requiredRootTypes));
  }
static boolean isJavaFxTemplateAvailable(DataContext dataContext, Set<? extends JpsModuleSourceRootType<?>> requiredRootTypes)