/** {@inheritDoc} */
  public boolean isValid() {

    if (mProjectConfig != null) {
      // check if all check configurations resolve
      List<FileSet> fileSets = mProjectConfig.getFileSets();
      for (FileSet fileset : fileSets) {
        ICheckConfiguration checkConfig = fileset.getCheckConfig();
        if (checkConfig != null) {
          try {
            checkConfig.getCheckstyleConfiguration();
          } catch (CheckstylePluginException e) {
            setErrorMessage(
                NLS.bind(
                    Messages.errorCannotResolveCheckLocation,
                    checkConfig.getLocation(),
                    checkConfig.getName()));
            return false;
          }
        }
      }
    }

    setErrorMessage(null);
    return true;
  }
  /** {@inheritDoc} */
  protected URL resolveLocation(ICheckConfiguration checkConfiguration) throws IOException {
    IResource configFileResource =
        ResourcesPlugin.getWorkspace().getRoot().findMember(checkConfiguration.getLocation());

    if (configFileResource != null) {
      return configFileResource.getLocation().toFile().toURI().toURL();
    } else {
      throw new FileNotFoundException(
          NLS.bind(
              Messages.ProjectConfigurationType_msgFileNotFound, checkConfiguration.getLocation()));
    }
  }
  /** {@inheritDoc} */
  public boolean isConfigurable(ICheckConfiguration checkConfiguration) {
    boolean isConfigurable = true;

    boolean isProtected =
        Boolean.valueOf(checkConfiguration.getAdditionalData().get(KEY_PROTECT_CONFIG))
            .booleanValue();
    isConfigurable = !isProtected;

    if (!isProtected) {

      // The configuration can be changed when the external configuration
      // file can is writable
      try {
        isConfigurable =
            FileUtils.toFile(checkConfiguration.getResolvedConfigurationFileURL()).canWrite();
      } catch (CheckstylePluginException e) {
        CheckstyleLog.log(e);
        isConfigurable = false;
      }
    }
    return isConfigurable;
  }