use of net.sf.eclipsecs.core.config.CheckConfiguration in project eclipse-cs by checkstyle.
the class ProjectConfigurationFactory method getLocalCheckConfigs.
@SuppressWarnings("unchecked")
private static List<ICheckConfiguration> getLocalCheckConfigs(Element root, IProject project) {
List<ICheckConfiguration> configurations = new ArrayList<>();
List<Element> configElements = root.elements(XMLTags.CHECK_CONFIG_TAG);
for (Element configEl : configElements) {
final String name = configEl.attributeValue(XMLTags.NAME_TAG);
final String description = configEl.attributeValue(XMLTags.DESCRIPTION_TAG);
String location = configEl.attributeValue(XMLTags.LOCATION_TAG);
String type = configEl.attributeValue(XMLTags.TYPE_TAG);
IConfigurationType configType = ConfigurationTypes.getByInternalName(type);
if (configType instanceof ProjectConfigurationType) {
// RFE 1420212
// treat config files relative to *THIS* project
IWorkspaceRoot workspaceRoot = project.getWorkspace().getRoot();
// test if the location contains the project name
if (workspaceRoot.findMember(location) == null) {
location = project.getFullPath().append(location).toString();
}
}
// get resolvable properties
List<ResolvableProperty> props = new ArrayList<>();
List<Element> propertiesElements = configEl.elements(XMLTags.PROPERTY_TAG);
for (Element propsEl : propertiesElements) {
ResolvableProperty prop = new ResolvableProperty(propsEl.attributeValue(XMLTags.NAME_TAG), propsEl.attributeValue(XMLTags.VALUE_TAG));
props.add(prop);
}
// get additional data
Map<String, String> additionalData = new HashMap<>();
List<Element> dataElements = configEl.elements(XMLTags.ADDITIONAL_DATA_TAG);
for (Element dataEl : dataElements) {
additionalData.put(dataEl.attributeValue(XMLTags.NAME_TAG), dataEl.attributeValue(XMLTags.VALUE_TAG));
}
ICheckConfiguration checkConfig = new CheckConfiguration(name, location, description, configType, false, props, additionalData);
configurations.add(checkConfig);
}
return configurations;
}
Aggregations