void () { assert myVirtualFile != null: "override this method to do without a virtual file!"; ShowSettingsUtil.getInstance().showSettingsDialog(myProject, JsonSchemaMappingsConfigurable.class, (configurable) -> { // For some reason, JsonSchemaMappingsConfigurable.reset is called right after this callback, leading to resetting the customization. // Workaround: move this logic inside JsonSchemaMappingsConfigurable.reset. configurable.setInitializer(() -> { JsonSchemaMappingsProjectConfiguration mappings = JsonSchemaMappingsProjectConfiguration.getInstance(myProject); UserDefinedJsonSchemaConfiguration configuration = mappings.findMappingForFile(myVirtualFile); if (configuration == null) { configuration = configurable.addProjectSchema(); String relativePath = VfsUtilCore.getRelativePath(myVirtualFile, myProject.getBaseDir()); configuration.patterns.add(new UserDefinedJsonSchemaConfiguration.Item( relativePath == null ? myVirtualFile.getUrl() : relativePath, false, false)); } configurable.selectInTree(configuration); }); }); }