@Nullable
@Override
public CodeStyleScheme importScheme(@NotNull final Project project,
@NotNull final VirtualFile selectedFile,
@NotNull final CodeStyleScheme currentScheme,
@NotNull final SchemeFactory<CodeStyleScheme> schemeFactory)
throws SchemeImportException {
try {
CodeStyleScheme targetScheme = currentScheme;
if (currentScheme.isDefault()) {
targetScheme = schemeFactory.createNewScheme(currentScheme.getName());
}
CheckstyleInternalObject configuration = loadConfiguration(project, selectedFile);
if (configuration != null) {
importConfiguration(checkstyleProjectService(project), configuration, targetScheme.getCodeStyleSettings());
return targetScheme;
}
} catch (Exception e) {
LOG.warn("Failed to import style", e);
throw new SchemeImportException(e);
}
return null;
}