forked from phoedos/pmd
Fix new violations detected by PMD 3.1
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@3491 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -30,6 +30,7 @@ import java.util.ResourceBundle;
|
||||
* @see name.herlin.command.CommandProcessor for more details on processor.
|
||||
*/
|
||||
public abstract class AbstractProcessableCommand implements Command {
|
||||
// @PMD:REVIEWED:SingularField: by Herlin on 10/05/05 23:24
|
||||
private CommandProcessor commandProcessor;
|
||||
|
||||
/**
|
||||
|
@ -53,6 +53,7 @@ public class DefaultCommandProcessor implements CommandProcessor {
|
||||
/**
|
||||
* @see name.herlin.command.CommandProcessor#waitCommandToFinish(name.herlin.command.AbstractProcessableCommand)
|
||||
*/
|
||||
// @PMD:REVIEWED:UnusedFormalParameter: by Herlin on 10/05/05 23:30
|
||||
public void waitCommandToFinish(final AbstractProcessableCommand aCommand) throws CommandException {
|
||||
// Do nothing because a default command executes synchronously
|
||||
// So when this method is executed the command has already terminated
|
||||
|
@ -32,7 +32,7 @@ import java.util.ResourceBundle;
|
||||
* the framework default command processor.
|
||||
*/
|
||||
public class DefaultCommandProcessorStrategy implements CommandProcessorStrategy {
|
||||
private final CommandProcessor defaultCommandProcessor = new DefaultCommandProcessor();
|
||||
private static final CommandProcessor DEFAULT_COMMAND_PROCESSOR = new DefaultCommandProcessor();
|
||||
private final Map registeredCommandProcessors = new Hashtable();
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ public class DefaultCommandProcessorStrategy implements CommandProcessorStrategy
|
||||
}
|
||||
|
||||
if (aProcessor == null) {
|
||||
aProcessor = this.defaultCommandProcessor;
|
||||
aProcessor = DEFAULT_COMMAND_PROCESSOR;
|
||||
}
|
||||
|
||||
return aProcessor;
|
||||
@ -70,7 +70,7 @@ public class DefaultCommandProcessorStrategy implements CommandProcessorStrategy
|
||||
CommandProcessor aProcessor = null;
|
||||
|
||||
try {
|
||||
final String processorClassName = (String) registeredCommandProcessors.get(aCommand.getName());
|
||||
final String processorClassName = (String) this.registeredCommandProcessors.get(aCommand.getName());
|
||||
if (processorClassName != null) {
|
||||
final Class clazz = Class.forName(processorClassName);
|
||||
aProcessor = (CommandProcessor) clazz.newInstance();
|
||||
|
@ -57,6 +57,9 @@ import org.eclipse.ui.ResourceWorkingSetFilter;
|
||||
* @version $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 2005/05/10 21:49:26 phherlin
|
||||
* Fix new violations detected by PMD 3.1
|
||||
*
|
||||
* Revision 1.1 2005/05/07 13:32:04 phherlin
|
||||
* Continuing refactoring
|
||||
* Fix some PMD violations
|
||||
@ -233,16 +236,15 @@ public class BaseVisitor {
|
||||
final String ruleName = tail.substring(0, tail.indexOf(':'));
|
||||
pendingReviews.push(ruleName);
|
||||
findLine = true;
|
||||
} else if (!comment && findLine) {
|
||||
if (!line.equals("") && !line.startsWith("//")) {
|
||||
findLine = false;
|
||||
while (!pendingReviews.empty()) {
|
||||
// @PMD:REVIEWED:AvoidInstantiatingObjectsInLoops: by Herlin on 01/05/05 18:36
|
||||
final Review review = new Review();
|
||||
review.ruleName = (String) pendingReviews.pop();
|
||||
review.lineNumber = lineNumber;
|
||||
reviewsList.add(review);
|
||||
}
|
||||
} else if (!comment && findLine && !line.equals("") && !line.startsWith("//")) {
|
||||
findLine = false;
|
||||
while (!pendingReviews.empty()) {
|
||||
// @PMD:REVIEWED:AvoidInstantiatingObjectsInLoops:
|
||||
// by Herlin on 01/05/05 18:36
|
||||
final Review review = new Review();
|
||||
review.ruleName = (String) pendingReviews.pop();
|
||||
review.lineNumber = lineNumber;
|
||||
reviewsList.add(review);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,9 @@ import org.eclipse.jdt.core.JavaCore;
|
||||
* @version $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 2005/05/10 21:49:18 phherlin
|
||||
* Fix new violations detected by PMD 3.1
|
||||
*
|
||||
* Revision 1.1 2005/05/07 13:32:04 phherlin
|
||||
* Continuing refactoring
|
||||
* Fix some PMD violations
|
||||
@ -321,6 +324,7 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
return fVisitChildren;
|
||||
}
|
||||
|
||||
// @PMD:REVIEWED:UnusedFormalParameter: by Herlin on 10/05/05 23:46
|
||||
public boolean visit(final IResourceDelta delta) {
|
||||
count++;
|
||||
return true;
|
||||
|
@ -59,6 +59,9 @@ import org.eclipse.core.runtime.Status;
|
||||
* @version $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 2005/05/10 21:49:26 phherlin
|
||||
* Fix new violations detected by PMD 3.1
|
||||
*
|
||||
* Revision 1.1 2005/05/07 13:32:04 phherlin
|
||||
* Continuing refactoring
|
||||
* Fix some PMD violations
|
||||
@ -101,6 +104,7 @@ public class RunnableCommandProcessor implements CommandProcessor, IWorkspaceRun
|
||||
/**
|
||||
* @see name.herlin.command.CommandProcessor#waitCommandToFinish(name.herlin.command.AbstractProcessableCommand)
|
||||
*/
|
||||
// @PMD:REVIEWED:UnusedFormalParameter: by Herlin on 10/05/05 23:46
|
||||
public void waitCommandToFinish(final AbstractProcessableCommand aCommand) throws CommandException {
|
||||
// do noting
|
||||
}
|
||||
@ -110,6 +114,7 @@ public class RunnableCommandProcessor implements CommandProcessor, IWorkspaceRun
|
||||
* @param monitor
|
||||
* @throws CoreException
|
||||
*/
|
||||
// @PMD:REVIEWED:UnusedFormalParameter: by Herlin on 10/05/05 23:48
|
||||
public void run(final IProgressMonitor monitor) throws CoreException {
|
||||
try {
|
||||
this.command.execute();
|
||||
|
@ -47,6 +47,9 @@ import org.eclipse.core.resources.IProject;
|
||||
* @version $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.3 2005/05/10 21:49:29 phherlin
|
||||
* Fix new violations detected by PMD 3.1
|
||||
*
|
||||
* Revision 1.2 2005/05/07 13:32:04 phherlin
|
||||
* Continuing refactoring
|
||||
* Fix some PMD violations
|
||||
@ -60,7 +63,11 @@ import org.eclipse.core.resources.IProject;
|
||||
*/
|
||||
public class ModelFactory {
|
||||
private static final ModelFactory SELF = new ModelFactory();
|
||||
|
||||
// @PMD:REVIEWED:SingularField: by Herlin on 10/05/05 23:42
|
||||
private final Map projectPropertiesModels = new HashMap();
|
||||
|
||||
// @PMD:REVIEWED:SingularField: by Herlin on 10/05/05 23:42
|
||||
private final PreferencesModel preferencesModel = new PreferencesModelImpl();
|
||||
|
||||
/**
|
||||
|
@ -74,6 +74,9 @@ import org.eclipse.ui.dialogs.PropertyPage;
|
||||
* @version $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.17 2005/05/10 21:49:27 phherlin
|
||||
* Fix new violations detected by PMD 3.1
|
||||
*
|
||||
* Revision 1.16 2005/05/07 13:32:04 phherlin
|
||||
* Continuing refactoring
|
||||
* Fix some PMD violations
|
||||
@ -141,7 +144,6 @@ public class PMDPropertyPage extends PropertyPage implements PMDConstants {
|
||||
private static final Log log = LogFactory.getLog("net.sourceforge.pmd.eclipse.properties.PMDPropertyPage");
|
||||
private PMDPropertyPageController controller;
|
||||
private PMDPropertyPageBean model;
|
||||
private IProject project;
|
||||
private Button enablePMDButton;
|
||||
protected TableViewer availableRulesTableViewer;
|
||||
private IWorkingSet selectedWorkingSet;
|
||||
@ -155,14 +157,14 @@ public class PMDPropertyPage extends PropertyPage implements PMDConstants {
|
||||
protected Control createContents(final Composite parent) {
|
||||
log.info("PMD properties editing requested");
|
||||
this.controller = new PMDPropertyPageController(this.getShell());
|
||||
this.project = (IProject) this.getElement().getAdapter(IProject.class);
|
||||
this.controller.setProject(this.project);
|
||||
final IProject project = (IProject) this.getElement().getAdapter(IProject.class);
|
||||
this.controller.setProject(project);
|
||||
this.model = controller.getPropertyPageBean();
|
||||
|
||||
Composite composite = null;
|
||||
noDefaultAndApplyButton();
|
||||
|
||||
if ((this.project.isAccessible()) && (this.model != null)) {
|
||||
if ((project.isAccessible()) && (this.model != null)) {
|
||||
composite = new Composite(parent, SWT.NONE);
|
||||
|
||||
final GridLayout layout = new GridLayout();
|
||||
|
@ -68,6 +68,9 @@ import org.eclipse.ui.progress.IProgressService;
|
||||
* @version $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.6 2005/05/10 21:49:29 phherlin
|
||||
* Fix new violations detected by PMD 3.1
|
||||
*
|
||||
* Revision 1.5 2005/05/07 13:32:05 phherlin
|
||||
* Continuing refactoring
|
||||
* Fix some PMD violations
|
||||
@ -91,7 +94,6 @@ public class PMDPropertyPageController implements IRunnableWithProgress, PMDCons
|
||||
private final Shell shell;
|
||||
private IProject project;
|
||||
private PMDPropertyPageBean propertyPageBean;
|
||||
private ProjectPropertiesModel projectPropertiesModel;
|
||||
private boolean rebuildNeeded;
|
||||
|
||||
/**
|
||||
@ -132,13 +134,13 @@ public class PMDPropertyPageController implements IRunnableWithProgress, PMDCons
|
||||
|
||||
if (this.propertyPageBean == null) {
|
||||
try {
|
||||
this.projectPropertiesModel = ModelFactory.getFactory().getProperiesModelForProject(this.project);
|
||||
final ProjectPropertiesModel model = ModelFactory.getFactory().getProperiesModelForProject(this.project);
|
||||
|
||||
this.propertyPageBean = new PMDPropertyPageBean();
|
||||
this.propertyPageBean.setPmdEnabled(this.projectPropertiesModel.isPmdEnabled());
|
||||
this.propertyPageBean.setProjectWorkingSet(this.projectPropertiesModel.getProjectWorkingSet());
|
||||
this.propertyPageBean.setProjectRuleSet(this.projectPropertiesModel.getProjectRuleSet());
|
||||
this.propertyPageBean.setRuleSetStoredInProject(this.projectPropertiesModel.isRuleSetStoredInProject());
|
||||
this.propertyPageBean.setPmdEnabled(model.isPmdEnabled());
|
||||
this.propertyPageBean.setProjectWorkingSet(model.getProjectWorkingSet());
|
||||
this.propertyPageBean.setProjectRuleSet(model.getProjectRuleSet());
|
||||
this.propertyPageBean.setRuleSetStoredInProject(model.isRuleSetStoredInProject());
|
||||
} catch (ModelException e) {
|
||||
PMDPlugin.getDefault().showError(e.getMessage(), e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user