forked from phoedos/pmd
minor cleaning
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1542 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -10,12 +10,16 @@ import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
/**
|
||||
* A window to show the CPD report
|
||||
*
|
||||
* @author David Craine
|
||||
* @author Philippe Herlin
|
||||
* @version $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.3 2003/03/17 23:31:44 phherlin
|
||||
* minor cleaning
|
||||
*
|
||||
* To change this generated comment edit the template variable "typecomment":
|
||||
* Window>Preferences>Java>Templates.
|
||||
* To enable and disable the creation of type comments go to
|
||||
* Window>Preferences>Java>Code Generat ion.
|
||||
*/
|
||||
public class CPDReportWindow extends ApplicationWindow {
|
||||
private Label label;
|
||||
|
@ -1,55 +1,54 @@
|
||||
package net.sourceforge.pmd.eclipse;
|
||||
|
||||
import net.sourceforge.pmd.cpd.CPD;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceVisitor;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* A visitor to process IFile resource against CPD
|
||||
*
|
||||
* @author David Craine
|
||||
* @author Philippe Herlin
|
||||
* @version $Revision$
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.2 2003/03/17 23:32:05 phherlin
|
||||
* minor cleaning
|
||||
*
|
||||
* To change this generated comment edit the template variable "typecomment":
|
||||
* Window>Preferences>Java>Templates.
|
||||
* To enable and disable the creation of type comments go to
|
||||
* Window>Preferences>Java>Code Generation.
|
||||
*/
|
||||
public class CPDVisitor implements IResourceVisitor {
|
||||
CPD cpd;
|
||||
|
||||
/**
|
||||
* Constructor for CPDVisitor.
|
||||
*/
|
||||
public CPDVisitor(CPD cpd) {
|
||||
super();
|
||||
this.cpd = cpd;
|
||||
}
|
||||
CPD cpd;
|
||||
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResourceVisitor#visit(IResource)
|
||||
* Add java files into the CPD object
|
||||
*/
|
||||
public boolean visit(IResource resource) throws CoreException {
|
||||
if ((resource instanceof IFile) &&
|
||||
(((IFile) resource).getFileExtension() != null) &&
|
||||
((IFile) resource).getFileExtension().equals("java")) {
|
||||
try {
|
||||
cpd.add(((IFile)resource).getLocation().toFile());
|
||||
}
|
||||
catch (Exception e){
|
||||
MessageDialog.openError(null, "CPD", e.toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Constructor for CPDVisitor.
|
||||
*/
|
||||
public CPDVisitor(CPD cpd) {
|
||||
super();
|
||||
this.cpd = cpd;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @see org.eclipse.core.resources.IResourceVisitor#visit(IResource)
|
||||
* Add java files into the CPD object
|
||||
*/
|
||||
public boolean visit(IResource resource) throws CoreException {
|
||||
boolean result = true;
|
||||
if ((resource instanceof IFile)
|
||||
&& (((IFile) resource).getFileExtension() != null)
|
||||
&& ((IFile) resource).getFileExtension().equals("java")) {
|
||||
try {
|
||||
cpd.add(((IFile) resource).getLocation().toFile());
|
||||
} catch (Exception e) {
|
||||
MessageDialog.openError(null, "CPD", e.toString());
|
||||
}
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user