private void ensureStateLoaded() {
    synchronized (myMappings) {
      List<PerFileMappingState> state = myDeferredMappings;
      if (state == null) {
        return;
      }

      myDeferredMappings = null;
      Map<String, T> valuesMap = new HashMap<>();
      for (T value : getAvailableValues()) {
        String key = value == null ? null : serialize(value);
        if (key != null) {
          valuesMap.put(key, value);
        }
      }
      myMappings.clear();
      for (PerFileMappingState entry : state) {
        String url = entry.getUrl();
        String valueStr = entry.getValue();
        if (valueStr == null) continue;
        VirtualFile file;
        if ("PROJECT".equals(url)) {
          file = null;
        }
        else {
          file = VirtualFileManager.getInstance().findFileByUrl(url);
          if (file == null) continue;
        }

        T value = valuesMap.get(valueStr);
        if (value != null) {
          if (file == null || !isDefaultMapping(file, value)) {
            myMappings.put(file, MappingValue.known(value));
          }
        }
        else {
          value = handleUnknownMapping(file, valueStr);
          if (value != null) {
            myMappings.put(file, MappingValue.unknown(value, valueStr));
          }
        }
      }
    }
  }
private void ensureStateLoaded()