@Nullable public ExcludesConfigurationState getActualState() { ensureOldSettingsLoaded(); if (myExcludedFiles.isEmpty() && myExcludedFrameworks.isEmpty()) { return null; } final ExcludesConfigurationState state = new ExcludesConfigurationState(); state.getFrameworkTypes().addAll(myExcludedFrameworks); Collections.sort(state.getFrameworkTypes(), String.CASE_INSENSITIVE_ORDER); for (String typeId : myExcludedFiles.keySet()) { final VirtualFilePointerContainer container = myExcludedFiles.get(typeId); for (String url : container.getUrls()) { state.getFiles().add(new ExcludedFileState(url, typeId)); } } Collections.sort( state.getFiles(), new Comparator<ExcludedFileState>() { @Override public int compare(ExcludedFileState o1, ExcludedFileState o2) { return StringUtil.comparePairs( o1.getFrameworkType(), o1.getUrl(), o2.getFrameworkType(), o2.getUrl(), true); } }); return state; }
private void doLoadState(@Nullable ExcludesConfigurationState state) { myExcludedFrameworks.clear(); for (VirtualFilePointerContainer container : myExcludedFiles.values()) { container.clear(); } if (state != null) { myExcludedFrameworks.addAll(state.getFrameworkTypes()); for (ExcludedFileState fileState : state.getFiles()) { myExcludedFiles.get(fileState.getFrameworkType()).add(fileState.getUrl()); } } }