try {
final EclipseCheckstyleConfigManager csPluginNature =
EclipseCheckstyleConfigManager.newInstance(project);
// construct a new working copy
final ProjectConfigurationWorkingCopy pcWorkingCopy =
new ProjectConfigurationWorkingCopy(
ProjectConfigurationFactory.getConfiguration(project));
pcWorkingCopy.setUseSimpleConfig(false);
pcWorkingCopy
.setSyncFormatter(Activator
.getDefault()
.getPreferenceStore()
.getBoolean(
CheckstyleEclipseConstants.ECLIPSE_CS_GENERATE_FORMATTER_SETTINGS));
pcWorkingCopy.getFileSets().clear();
for (final MavenPluginConfigurationTranslator mavenCheckstyleConfig : mavenCheckstyleConfigs) {
if (mavenCheckstyleConfig.isActive()) {
this.buildCheckstyleConfiguration(pcWorkingCopy,
mavenCheckstyleConfig);
// Add the builder and nature
csPluginNature.configure(monitor);
} else {
csPluginNature.deconfigure(monitor);
}
}
// persist the checkconfig
if (pcWorkingCopy.isDirty()) {
pcWorkingCopy.store();
}
} catch (CheckstylePluginException ex) {
// MavenLogger.log("CheckstylePluginException", ex);
}