I'm using eclipse-cs plugin version 4.4.2.
I have configured it with project-specific settings, adding a custom, project-relative checkstyle.xml file to Local Check Configurations.
After some refactoring, the file has changed its location and now I cannot fix it in the configuration dialog, since it doesn't register any action as change to configuration and the "OK" button remains inactive (greyed out) in the "Properties for PROJECT_NAME" window.
There are additional symptoms. The complete list of those:
1) When I enter the project properties window and go to the "Checkstyle" section, I immediately get a warning dialog "Checkstyle-Plugin warning: Location /PROJECT_NAME/build-tools/src/main/resources/PACKAGE/PATH/checkstyle.xml can't be resolved. Reason: Could not find /PROJECT_NAME/build-tools/src/main/resources/PACKAGE/PATH/checkstyle.xml". When I try to switch tabs in the Checkstyle section, I get the same warning over and over again.
2) The Eclipse workspace log shows the following:
!ENTRY com.atlassw.tools.eclipse.checkstyle 4 4 2009-01-28 12:02:12.453
!MESSAGE Could not find /PROJECT_NAME/build-tools/src/main/resources/PACKAGE/PATH/checkstyle.xml
!STACK 0
com.atlassw.tools.eclipse.checkstyle.util.CheckstylePluginException: Could not find /PROJECT_NAME/build-tools/src/main/resources/PACKAGE/PATH/checkstyle.xml
at com.atlassw.tools.eclipse.checkstyle.util.CheckstylePluginException.rethrow(CheckstylePluginException.java:95)
at com.atlassw.tools.eclipse.checkstyle.util.CheckstylePluginException.rethrow(CheckstylePluginException.java:107)
at com.atlassw.tools.eclipse.checkstyle.config.configtypes.ConfigurationType.getCheckstyleConfiguration(ConfigurationType.java:212)
at com.atlassw.tools.eclipse.checkstyle.config.CheckConfiguration.getCheckstyleConfiguration(CheckConfiguration.java:205)
at com.atlassw.tools.eclipse.checkstyle.builder.CheckerFactory.getCacheKey(CheckerFactory.java:224)
at com.atlassw.tools.eclipse.checkstyle.builder.CheckerFactory.createChecker(CheckerFactory.java:123)
at com.atlassw.tools.eclipse.checkstyle.builder.Auditor.runAudit(Auditor.java:180)
at com.atlassw.tools.eclipse.checkstyle.builder.CheckstyleBuilder.handleBuildSelection(CheckstyleBuilder.java:343)
at com.atlassw.tools.eclipse.checkstyle.builder.RunCheckstyleOnFilesJob.runInWorkspace(RunCheckstyleOnFilesJob.java:103)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.io.FileNotFoundException: Could not find /PROJECT_NAME/build-tools/src/main/resources/PACKAGE/PATH/checkstyle.xml
at com.atlassw.tools.eclipse.checkstyle.config.configtypes.ProjectConfigurationType.resolveLocation(ProjectConfigurationType.java:63)
at com.atlassw.tools.eclipse.checkstyle.config.configtypes.ConfigurationType.getCheckstyleConfiguration(ConfigurationType.java:188)
... 8 more
3) Project-specific settings for Checkstyle cannot be modified in any aspect (including attempts to fix the custom file location), because the "OK" button remains inactive regardless of perfomed changes.
I've found out that one can work around this problematic situation by closing Eclipse, fixing the path to the xml file in the ".checkstyle" file in the project directory (the <local-check-config> element) and starting Eclipse again.
One can also empty out the <fileset-config> element by eliminating any <fileset> and <local-check-config> elements - this will result in a default project-specific configuration for Checkstyle, which one can then be customised from scratch. The emptied ".checkstyle" file would look like this:
<fileset-config file-format-version="1.2.0" simple-config="true"> </fileset-config>Just don't try to delete the ".checkstyle" configuration file instead of fixing its contents, since Eclipse will try to load the .checkstyle settings anyway and you will get the following NPE when entering project properties:
!ENTRY org.eclipse.jface 4 2 2009-01-28 12:28:13.218
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NullPointerException
at org.eclipse.jface.dialogs.DialogPage.getShell(DialogPage.java:293)
at com.atlassw.tools.eclipse.checkstyle.properties.CheckstylePropertyPage.setElement(CheckstylePropertyPage.java:182)
at org.eclipse.ui.internal.dialogs.RegistryPageContributor.createPage(RegistryPageContributor.java:137)
at org.eclipse.ui.internal.dialogs.PropertyPageNode.createPage(PropertyPageNode.java:56)
at org.eclipse.jface.preference.PreferenceDialog.createPage(PreferenceDialog.java:1306)
at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.createPage(FilteredPreferenceDialog.java:369)
...
Even removing CheckstyleNature from <natures> and CheckstyleBuilder from <buildSpec> in ".project" didn't stop Eclipse from trying to read ".checkstyle". So it seems you have to fix the configuration by hand, removing it won't do. BTW, if you know where else from does Eclipse know that it needs to load Checkstyle configuration from ".checkstyle", please, share the information. It would simplify the workaround for this bug a bit.
I've made some code changes so that such problems (moving a checkstyle configuration file) can be easier handled.
Now only a error message is displayed in the property page header - but you won't be able to leave/ok the the page unless the path of the check configuration is corrected or another check configuration (e.g. a builtin standard config) is selected.
To correct the path you are (now?) able to switch to the local configs tab and correct the properties of the check configuration in question.
The changes will be in 5.0.0 beta2