typos & minor optimizations
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6674 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd
@ -222,7 +222,7 @@ public abstract class AbstractDefaultCommand extends AbstractProcessableCommand
|
||||
}
|
||||
|
||||
/**
|
||||
* deletegate method for monitor.isCanceled()
|
||||
* delegate method for monitor.isCanceled()
|
||||
* @see org.eclipse.core.runtime.IProgressMonitor#isCanceled
|
||||
*/
|
||||
protected boolean isCanceled() {
|
||||
|
@ -48,6 +48,7 @@ import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
|
||||
import net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences;
|
||||
import net.sourceforge.pmd.eclipse.runtime.properties.IProjectProperties;
|
||||
import net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException;
|
||||
import net.sourceforge.pmd.util.NumericConstants;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
@ -335,7 +336,7 @@ public class BaseVisitor {
|
||||
} else {
|
||||
Integer counter = violationsCounter.get(violation.getRule());
|
||||
if (counter == null) {
|
||||
counter = new Integer(0);
|
||||
counter = NumericConstants.ZERO;
|
||||
violationsCounter.put(violation.getRule(), counter);
|
||||
}
|
||||
|
||||
@ -352,7 +353,7 @@ public class BaseVisitor {
|
||||
markerSet.add(getMarkerInfo(violation, fTask ? PMDRuntimeConstants.PMD_TASKMARKER : PMDRuntimeConstants.PMD_MARKER));
|
||||
}
|
||||
*/
|
||||
violationsCounter.put(violation.getRule(), new Integer(counter.intValue() + 1));
|
||||
violationsCounter.put(violation.getRule(), Integer.valueOf(counter.intValue() + 1));
|
||||
|
||||
log.debug("Adding a violation for rule " + violation.getRule().getName() + " at line " + violation.getBeginLine());
|
||||
} else {
|
||||
@ -448,38 +449,38 @@ public class BaseVisitor {
|
||||
values.add(violation.getDescription());
|
||||
|
||||
attributeNames.add(IMarker.LINE_NUMBER);
|
||||
values.add(new Integer(violation.getBeginLine()));
|
||||
values.add(Integer.valueOf(violation.getBeginLine()));
|
||||
|
||||
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_LINE2);
|
||||
values.add(new Integer(violation.getEndLine()));
|
||||
values.add(Integer.valueOf(violation.getEndLine()));
|
||||
|
||||
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_RULENAME);
|
||||
values.add(violation.getRule().getName());
|
||||
|
||||
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_PRIORITY);
|
||||
values.add(new Integer(violation.getRule().getPriority().getPriority()));
|
||||
values.add(Integer.valueOf(violation.getRule().getPriority().getPriority()));
|
||||
|
||||
switch (violation.getRule().getPriority().getPriority()) {
|
||||
case 1:
|
||||
attributeNames.add(IMarker.PRIORITY);
|
||||
values.add(new Integer(IMarker.PRIORITY_HIGH));
|
||||
values.add(Integer.valueOf(IMarker.PRIORITY_HIGH));
|
||||
case 2:
|
||||
attributeNames.add(IMarker.SEVERITY);
|
||||
values.add(new Integer(IMarker.SEVERITY_ERROR));
|
||||
values.add(Integer.valueOf(IMarker.SEVERITY_ERROR));
|
||||
break;
|
||||
|
||||
case 5:
|
||||
attributeNames.add(IMarker.SEVERITY);
|
||||
values.add(new Integer(IMarker.SEVERITY_INFO));
|
||||
values.add(Integer.valueOf(IMarker.SEVERITY_INFO));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
attributeNames.add(IMarker.PRIORITY);
|
||||
values.add(new Integer(IMarker.PRIORITY_HIGH));
|
||||
values.add(Integer.valueOf(IMarker.PRIORITY_HIGH));
|
||||
case 4:
|
||||
default:
|
||||
attributeNames.add(IMarker.SEVERITY);
|
||||
values.add(new Integer(IMarker.SEVERITY_WARNING));
|
||||
values.add(Integer.valueOf(IMarker.SEVERITY_WARNING));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -105,9 +105,9 @@ public class DetectCutAndPasteCmd extends AbstractDefaultCommand {
|
||||
final List<File> files = findFiles();
|
||||
|
||||
if (files.size() == 0) {
|
||||
PMDPlugin.getDefault().logInformation("No files found to specified language.");
|
||||
PMDPlugin.getDefault().logInformation("No files found for specified language.");
|
||||
} else {
|
||||
PMDPlugin.getDefault().logInformation("Found " + files.size() + " files to the specified language. Performing CPD.");
|
||||
PMDPlugin.getDefault().logInformation("Found " + files.size() + " files for the specified language. Performing CPD.");
|
||||
}
|
||||
setStepsCount(files.size());
|
||||
beginTask("Finding suspect Cut And Paste", getStepsCount()*2);
|
||||
|
@ -77,7 +77,7 @@ public class RenderReportCmd extends AbstractDefaultCommand {
|
||||
/**
|
||||
* Table containing the renderers indexed by the file name.
|
||||
*/
|
||||
private HashMap<String, Renderer> renderers = new HashMap<String, Renderer>();
|
||||
private Map<String, Renderer> renderers = new HashMap<String, Renderer>();
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
|
@ -120,7 +120,7 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
this.pmdDuration = 0;
|
||||
|
||||
// Lancer PMD
|
||||
if (this.resources.size() == 0) {
|
||||
if (this.resources.isEmpty()) {
|
||||
beginTask("PMD Checking...", getStepsCount());
|
||||
processResourceDelta();
|
||||
} else {
|
||||
@ -251,7 +251,7 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
final IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
|
||||
ISchedulingRule rule = null;
|
||||
|
||||
if (this.resources.size() == 0) {
|
||||
if (this.resources.isEmpty()) {
|
||||
rule = ruleFactory.markerRule(this.resourceDelta.getResource().getProject());
|
||||
} else {
|
||||
ISchedulingRule rules[] = new ISchedulingRule[this.resources.size()];
|
||||
|
@ -123,9 +123,7 @@ public class ReviewResourceForRuleCommand extends AbstractDefaultCommand {
|
||||
final IFile file = (IFile) resource.getAdapter(IFile.class);
|
||||
beginTask("PMD Checking for specific rule...", 1);
|
||||
|
||||
if (file != null
|
||||
&& file.getFileExtension() != null
|
||||
&& file.getFileExtension().equals("java")) {
|
||||
if (file != null && "java".equals(file.getFileExtension())) {
|
||||
final RuleSet ruleSet = new RuleSet();
|
||||
ruleSet.addRule(rule);
|
||||
final PMDEngine pmdEngine = getPmdEngineForProject(project);
|
||||
|
Reference in New Issue
Block a user