use of net.sf.eclipsecs.core.config.configtypes.MultiPropertyResolver in project eclipse-cs by checkstyle.
the class CheckConfigurationTester method getUnresolvedProperties.
/**
* Tests a configuration if there are unresolved properties.
*
* @return the list of unresolved properties as ResolvableProperty values.
* @throws CheckstylePluginException
* most likely the configuration file could not be found
*/
public List<ResolvableProperty> getUnresolvedProperties() throws CheckstylePluginException {
CheckstyleConfigurationFile configFile = mCheckConfiguration.getCheckstyleConfiguration();
PropertyResolver resolver = configFile.getPropertyResolver();
// context
if (mContextProject != null && resolver instanceof IContextAware) {
((IContextAware) resolver).setProjectContext(mContextProject);
}
MissingPropertyCollector collector = new MissingPropertyCollector();
if (resolver instanceof MultiPropertyResolver) {
((MultiPropertyResolver) resolver).addPropertyResolver(collector);
} else {
MultiPropertyResolver multiResolver = new MultiPropertyResolver();
multiResolver.addPropertyResolver(resolver);
multiResolver.addPropertyResolver(collector);
resolver = multiResolver;
}
InputSource in = null;
try {
in = configFile.getCheckConfigFileInputSource();
ConfigurationLoader.loadConfiguration(in, resolver, false);
} catch (CheckstyleException e) {
CheckstylePluginException.rethrow(e);
} finally {
Closeables.closeQuietly(in.getByteStream());
}
return collector.getUnresolvedProperties();
}
Aggregations