use of org.infernus.idea.checkstyle.model.ConfigurationLocation in project checkstyle-idea by jshiell.
the class CheckStyleConfigurableTest method mockPluginConfigurationManager.
private PluginConfigurationManager mockPluginConfigurationManager(@NotNull final Project project) {
final ConfigurationLocationFactory mockLocFactory = new ConfigurationLocationFactory();
final SortedSet<ConfigurationLocation> mockLocations = buildMockLocations(project, mockLocFactory);
final PluginConfiguration mockConfigDto = PluginConfigurationBuilder.testInstance("7.1.2").withLocations(mockLocations).withThirdPartyClassPath(Arrays.asList("cp1", "cp2")).withActiveLocation(mockLocations.first()).build();
PluginConfigurationManager mockConfig = mock(PluginConfigurationManager.class);
when(mockConfig.getCurrent()).thenReturn(mockConfigDto);
return mockConfig;
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocation in project watchdog by TestRoots.
the class CheckStyleStartup method addMessagesForActiveConfiguration.
// TODO (TimvdLippe): update the messages when the configuration changes
private void addMessagesForActiveConfiguration(CheckstyleProjectService service) {
final CheckStylePlugin checkStylePlugin = project.getComponent(CheckStylePlugin.class);
final ConfigurationLocation activeConfigLocation = checkStylePlugin.configurationManager().getCurrent().getActiveLocation();
if (activeConfigLocation == null) {
return;
}
service.getCheckstyleInstance().peruseConfiguration(service.getCheckstyleInstance().loadConfiguration(activeConfigLocation, true, new HashMap<>()), module -> addMessagesForActiveConfiguration(activeConfigLocation.getDescription(), module));
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocation in project checkstyle-idea by jshiell.
the class PluginConfigurationBuilder method defaultConfiguration.
public static PluginConfigurationBuilder defaultConfiguration(final Project project) {
final String csDefaultVersion = new VersionListReader().getDefaultVersion();
final SortedSet<ConfigurationLocation> defaultLocations = new TreeSet<>();
defaultLocations.add(configurationLocationFactory(project).create(BundledConfig.SUN_CHECKS, project));
defaultLocations.add(configurationLocationFactory(project).create(BundledConfig.GOOGLE_CHECKS, project));
final boolean copyLibs = OS.isWindows();
return new PluginConfigurationBuilder(csDefaultVersion, ScanScope.getDefaultValue(), false, copyLibs, defaultLocations, Collections.emptyList(), null, false, CheckStylePlugin.version());
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocation in project checkstyle-idea by jshiell.
the class ProjectConfigurationState method ensureBundledConfigs.
private void ensureBundledConfigs(@NotNull final List<ConfigurationLocation> configurationLocations) {
final ConfigurationLocation sunChecks = configurationLocationFactory().create(BundledConfig.SUN_CHECKS, project);
final ConfigurationLocation googleChecks = configurationLocationFactory().create(BundledConfig.GOOGLE_CHECKS, project);
if (!configurationLocations.contains(sunChecks)) {
configurationLocations.add(sunChecks);
}
if (!configurationLocations.contains(googleChecks)) {
configurationLocations.add(googleChecks);
}
}
use of org.infernus.idea.checkstyle.model.ConfigurationLocation in project checkstyle-idea by jshiell.
the class ConfigurationsTest method createClassUnderTest.
private TabWidthAndBaseDirProvider createClassUnderTest(final Configuration pConfig) throws IOException {
final Module module = mock(Module.class);
final ConfigurationLocation configurationLocation = mock(ConfigurationLocation.class);
final CodeStyleSettings codeStyleSettings = mock(CodeStyleSettings.class);
when(configurationLocation.resolveAssociatedFile(eq("aFileToResolve"), eq(module), any(ClassLoader.class))).thenReturn("aResolvedFile");
when(configurationLocation.resolveAssociatedFile(eq("triggersAnIoException"), eq(module), any(ClassLoader.class))).thenThrow(new IOException("aTriggeredIoException"));
when(codeStyleSettings.getTabSize(JavaFileType.INSTANCE)).thenReturn(CODE_STYLE_TAB_SIZE);
return new Configurations(module, pConfig) {
@NotNull
@Override
CodeStyleSettings currentCodeStyleSettings() {
return codeStyleSettings;
}
};
}
Aggregations