void (@NotNull String importerName) { final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) { @Override public boolean isFileSelectable(@Nullable VirtualFile file) { return file != null && FileTypeRegistry.getInstance().isFileOfType(file, StdFileTypes.XML); } }; descriptor.setDescription(AnalysisBundle.message("inspections.settings.profile.file.chooser.description")); FileChooser.chooseFile(descriptor, myProject, null, file -> { if (file != null) { try { InspectionProfileImpl profile = importInspectionProfile(JDOMUtil.load(file.getInputStream()), myAppProfileManager, myProject); if (profile == null) { Messages.showErrorDialog(myProject, AnalysisBundle.message("inspections.settings.invalid.format.warning", file.getName()), CommonBundle.getErrorTitle()); return; } final SingleInspectionProfilePanel existed = InspectionProfileSchemesPanel.this.getModel().getProfilePanel(profile); if (existed != null) { if (Messages.showOkCancelDialog(myProject, AnalysisBundle .message("inspections.settings.profile.already.exists.dialog.message", profile.getName()), AnalysisBundle.message("inspections.settings.overwrite.warning.title"), AnalysisBundle.message("inspections.settings.overwrite.action.text"), CommonBundle.getCancelButtonText(), Messages.getInformationIcon()) != Messages.OK) { return; } getModel().removeScheme(existed.getProfile()); } InspectionProfileModifiableModel model = new InspectionProfileModifiableModel(profile); model.setModified(true); addProfile(model); selectScheme(model); } catch (JDOMException | InvalidDataException | IOException e) { LOG.error(e); } } }); }