Search in sources :

Example 16 with PropertiesException

use of net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException in project pmd-eclipse-plugin by pmd.

the class ProjectPropertiesImpl method setRuleSetFile.

/**
 * @see net.sourceforge.pmd.eclipse.runtime.properties.IProjectProperties#setRuleSetFile(String)
 */
public void setRuleSetFile(String ruleSetFile) throws PropertiesException {
    LOG.debug("Set rule set file for project " + project.getName() + ": " + ruleSetFile);
    needRebuild |= this.ruleSetFile == null || !this.ruleSetFile.equals(ruleSetFile);
    this.ruleSetFile = ruleSetFile;
    if (ruleSetStoredInProject) {
        if (!isRuleSetFileExist()) {
            // TODO: NLS
            throw new PropertiesException("The project ruleset file cannot be found for project " + project.getName());
        }
        File f = getResolvedRuleSetFile();
        if (f != null) {
            projectRuleFileLastModified = f.lastModified();
        }
    }
}
Also used : PropertiesException(net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException) IFile(org.eclipse.core.resources.IFile) File(java.io.File)

Example 17 with PropertiesException

use of net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException in project pmd-eclipse-plugin by pmd.

the class ProjectPropertiesImpl method setProjectRuleSet.

/**
 * @see net.sourceforge.pmd.eclipse.runtime.properties.IProjectProperties#setProjectRuleSet(net.sourceforge.pmd.RuleSet)
 */
public void setProjectRuleSet(final RuleSet projectRuleSet) throws PropertiesException {
    LOG.debug("Set a rule set for project " + this.project.getName());
    if (projectRuleSet == null) {
        // TODO: NLS
        throw new PropertiesException("Setting a project rule set to null");
    }
    this.needRebuild |= !this.projectRuleSet.getRules().equals(projectRuleSet.getRules());
    this.projectRuleSet = projectRuleSet;
    if (this.ruleSetStoredInProject) {
        File f = getResolvedRuleSetFile();
        if (f != null) {
            projectRuleFileLastModified = f.lastModified();
        }
    }
}
Also used : PropertiesException(net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException) IFile(org.eclipse.core.resources.IFile) File(java.io.File)

Aggregations

PropertiesException (net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException)17 CoreException (org.eclipse.core.runtime.CoreException)10 IFile (org.eclipse.core.resources.IFile)9 File (java.io.File)6 IProjectProperties (net.sourceforge.pmd.eclipse.runtime.properties.IProjectProperties)6 CommandException (name.herlin.command.CommandException)5 RuleSet (net.sourceforge.pmd.RuleSet)3 IProject (org.eclipse.core.resources.IProject)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 BufferedReader (java.io.BufferedReader)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 Timer (name.herlin.command.Timer)1 PMDException (net.sourceforge.pmd.PMDException)1 Report (net.sourceforge.pmd.Report)1 ConfigurationError (net.sourceforge.pmd.Report.ConfigurationError)1 ProcessingError (net.sourceforge.pmd.Report.ProcessingError)1 RuleContext (net.sourceforge.pmd.RuleContext)1