package com.intellij.javaee;

import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.xml.Html5SchemaProvider;

/**
 * @author Eugene.Kudelevsky
 */
public class DefaultHtmlDoctypeInitialConfigurator {

  public DefaultHtmlDoctypeInitialConfigurator(ProjectManager projectManager,
                                               PropertiesComponent propertiesComponent) {
    if (!propertiesComponent.getBoolean("DefaultHtmlDoctype.MigrateToHtml5", false)) {
      propertiesComponent.setValue("DefaultHtmlDoctype.MigrateToHtml5", Boolean.TRUE.toString());
      ExternalResourceManagerEx.getInstanceEx()
        .setDefaultHtmlDoctype(Html5SchemaProvider.getHtml5SchemaLocation(), projectManager.getDefaultProject());
    }
  }
}

@@ -125,16 +125,158 @@
 anager;%0A
+import com.intellij.openapi.vfs.VfsUtilCore;%0Aimport com.intellij.openapi.vfs.VirtualFile;%0Aimport com.intellij.openapi.vfs.VirtualFileManager;%0A
 import c
@@ -312,16 +312,16 @@
 ovider;%0A
-
 %0A/**%0A * 
@@ -402,16 +402,55 @@
 urator %7B
+%0A  public static final int VERSION = 1;
 %0A%0A  publ
@@ -844,16 +844,16 @@
 nceEx()%0A
-
         
@@ -964,14 +964,493 @@
 ;%0A    %7D%0A
+    if (propertiesComponent.getOrInitInt(%22DefaultHtmlDoctype.Refreshed%22, 0) %3C VERSION) %7B%0A      propertiesComponent.setValue(%22DefaultHtmlDoctype.Refreshed%22, Integer.toString(VERSION));%0A      final String schemaUrl = VfsUtilCore.pathToUrl(Html5SchemaProvider.getHtml5SchemaLocation());%0A      final VirtualFile schemaFile = VirtualFileManager.getInstance().findFileByUrl(schemaUrl);%0A      if (schemaFile != null) %7B%0A        schemaFile.getParent().refresh(false, true);%0A      %7D%0A    %7D%0A
   %7D%0A%7D%0A

refresh html5 schema #IDEA-122531 fixed