void (@Nullable JsonSchemaInfo selectedValue, @Nullable VirtualFile virtualFile, @NotNull Project project) { assert virtualFile != null: "override this method to do without a virtual file!"; JsonSchemaMappingsProjectConfiguration configuration = JsonSchemaMappingsProjectConfiguration.getInstance(project); VirtualFile projectBaseDir = project.getBaseDir(); UserDefinedJsonSchemaConfiguration mappingForFile = configuration.findMappingForFile(virtualFile); if (mappingForFile != null) { for (UserDefinedJsonSchemaConfiguration.Item pattern : mappingForFile.patterns) { if (Objects.equals(VfsUtil.findRelativeFile(projectBaseDir, pattern.getPathParts()), virtualFile) || virtualFile.getUrl().equals(UserDefinedJsonSchemaConfiguration.Item.neutralizePath(pattern.getPath()))) { mappingForFile.patterns.remove(pattern); if (mappingForFile.patterns.size() == 0 && mappingForFile.isApplicationDefined()) { configuration.removeConfiguration(mappingForFile); } else { mappingForFile.refreshPatterns(); } break; } } } if (selectedValue == null) return; String path = projectBaseDir == null ? null : VfsUtilCore.getRelativePath(virtualFile, projectBaseDir); if (path == null) { path = virtualFile.getUrl(); } UserDefinedJsonSchemaConfiguration existing = configuration.findMappingBySchemaInfo(selectedValue); UserDefinedJsonSchemaConfiguration.Item item = new UserDefinedJsonSchemaConfiguration.Item(path, false, false); if (existing != null) { if (!existing.patterns.contains(item)) { existing.patterns.add(item); existing.refreshPatterns(); } } else { configuration.addConfiguration(new UserDefinedJsonSchemaConfiguration(selectedValue.getDescription(), selectedValue.getSchemaVersion(), selectedValue.getUrl(project), true, Collections.singletonList(item))); } }