docs: @SuppressWarnings("checkstyle:npathcomplexity")
  	public static void setSREInstalls(ISREInstall[] sres, IProgressMonitor monitor) throws CoreException {
  		final SubMonitor mon = SubMonitor.convert(monitor,
  				io.sarl.eclipse.runtime.Messages.SARLRuntime_0,
  				sres.length * 2 + ALL_SRE_INSTALLS.size());
  		initializeSREs();
  		final String oldDefaultId;
  		String newDefaultId;
  		final List<ISREInstall> newElements = new ArrayList<>();
  		final Map<String, ISREInstall> allKeys;
  		LOCK.lock();
  		try {
  			oldDefaultId = getDefaultSREId();
  			newDefaultId = oldDefaultId;
  			allKeys = new TreeMap<>(ALL_SRE_INSTALLS);
  			for (final ISREInstall sre : sres) {
  				if (allKeys.remove(sre.getId()) == null) {
  					newElements.add(sre);
  					ALL_SRE_INSTALLS.put(sre.getId(), sre);
  				}
  				mon.worked(1);
  			}
  			for (final ISREInstall sre : allKeys.values()) {
  				ALL_SRE_INSTALLS.remove(sre.getId());
  				platformSREInstalls.remove(sre.getId());
  				mon.worked(1);
  			}
  			if (oldDefaultId != null && !ALL_SRE_INSTALLS.containsKey(oldDefaultId)) {
  				newDefaultId = null;
  			}
  		} finally {
  			LOCK.unlock();
  		}
  		boolean changed = false;
  		mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_1);
  		if (oldDefaultId != null && newDefaultId == null) {
  			changed = true;
  			setDefaultSREInstall(null, monitor);
  		}
  		mon.worked(1);
  		mon.subTask(io.sarl.eclipse.runtime.Messages.SARLRuntime_2);
  		for (final ISREInstall sre : allKeys.values()) {
  			changed = true;
  			fireSRERemoved(sre);
  		}
  		for (final ISREInstall sre : newElements) {
  			changed = true;
  			fireSREAdded(sre);
  		}
  		mon.worked(1);
  		if (changed) {
  			saveSREConfiguration(mon.newChild(sres.length - 2));
  		}
  	}