public void updateDescriptors(@NotNull MultiMap<ConfigFileMetaData, ConfigFileInfo> descriptorMap) {
    Set<ConfigFile> toDelete = configFiles.isEmpty() ? Collections.emptySet() : new HashSet<>(configFiles.values());
    Set<ConfigFile> added = null;

    for (Map.Entry<ConfigFileMetaData, Collection<ConfigFileInfo>> entry : descriptorMap.entrySet()) {
      ConfigFileMetaData metaData = entry.getKey();
      Set<ConfigFileInfo> newDescriptors = new HashSet<>(entry.getValue());

      if (configFiles.containsKey(metaData)) {
        for (ConfigFile descriptor : configFiles.get(metaData)) {
          if (newDescriptors.remove(descriptor.getInfo()) && !toDelete.isEmpty()) {
            toDelete.remove(descriptor);
          }
        }
      }

      for (ConfigFileInfo configuration : newDescriptors) {
        ConfigFileImpl configFile = new ConfigFileImpl(this, configuration);
        Disposer.register(this, configFile);
        configFiles.putValue(metaData, configFile);
        if (added == null) {
          added = new HashSet<>();
        }
        added.add(configFile);
      }
    }

    for (ConfigFile descriptor : toDelete) {
      configFiles.remove(descriptor.getMetaData(), descriptor);
      Disposer.dispose(descriptor);
    }

    myCachedConfigFiles = null;
    if (added != null) {
      for (ConfigFile configFile : added) {
        incModificationCount();
        myDispatcher.getMulticaster().configFileAdded(configFile);
      }
    }
    for (ConfigFile configFile : toDelete) {
      incModificationCount();
      myDispatcher.getMulticaster().configFileRemoved(configFile);
    }
  }
public void updateDescriptors(@NotNull MultiMap<ConfigFileMetaData, ConfigFileInfo> descriptorMap)