diff --git a/pmd-gel/etc/scp.bat b/pmd-gel/etc/scp.bat
index ff14bc4dfa..09307a5d35 100755
--- a/pmd-gel/etc/scp.bat
+++ b/pmd-gel/etc/scp.bat
@@ -9,6 +9,6 @@ set CLASSPATH=%CLASSPATH%;../test-data/
set CLASSPATH=%CLASSPATH%;../
set CLASSPATH=%CLASSPATH%;../lib/xercesImpl-2.0.2.jar
set CLASSPATH=%CLASSPATH%;../lib/xmlParserAPIs-2.0.2.jar
-set CLASSPATH=%CLASSPATH%;c:\javacc2.1\bin\lib\JavaCC.zip
+set CLASSPATH=%CLASSPATH%;../lib/plugin.jar
set CLASSPATH=%CLASSPATH%;c:\ant\lib\ant.jar
set CLASSPATH=%CLASSPATH%;c:\ant\lib\junit.jar
diff --git a/pmd-gel/pmd-gel.jde b/pmd-gel/pmd-gel.jde
index ced1e5fa33..1f4c72ad11 100644
--- a/pmd-gel/pmd-gel.jde
+++ b/pmd-gel/pmd-gel.jde
@@ -9,21 +9,20 @@
0
- C:\pmd\pmd-gel\etc\build.xml
- 1
- 19
+ 68
+ 43
$(PROJECT)\src\net\sourceforge\pmd\gel\PMDPlugin.java
1
- 9
+ 25
{C34B000D-B5C9-415F-933A-552FB0590E44}
- 35
- 32
+ 36
+ 40
$(PROJECT)\etc\build.xml
1
- 20
+ 4
{C34B000D-B5C9-415F-933A-552FB0590E44}
@@ -33,6 +32,30 @@
1
1
+
+ {C34B000D-B5C9-415F-933A-552FB0590E44}
+ 18
+ 22
+ C:\Gel\plugin\src\com\gexperts\gel\Editor.java
+ 1
+ 4
+
+
+ {C34B000D-B5C9-415F-933A-552FB0590E44}
+ 1
+ 1
+ C:\Gel\plugin\src\com\gexperts\gel\Gel.java
+ 1
+ 4
+
+
+ {C34B000D-B5C9-415F-933A-552FB0590E44}
+ 25
+ 13
+ C:\Gel\plugin\src\com\gexperts\gel\Project.java
+ 1
+ 40
+
{C34B000D-B5C9-415F-933A-552FB0590E44}
@@ -93,4 +116,13 @@
+
+ Test.java
+ $(PROJECT)\src\net\sourceforge\pmd\gel\Test.java
+ 0
+
+
+
+
+
\ No newline at end of file
diff --git a/pmd-gel/src/net/sourceforge/pmd/gel/PMDPlugin.java b/pmd-gel/src/net/sourceforge/pmd/gel/PMDPlugin.java
index 491c8864dc..3788023156 100644
--- a/pmd-gel/src/net/sourceforge/pmd/gel/PMDPlugin.java
+++ b/pmd-gel/src/net/sourceforge/pmd/gel/PMDPlugin.java
@@ -5,6 +5,7 @@ import java.io.*;
import javax.swing.*;
import com.gexperts.gel.*;
import net.sourceforge.pmd.*;
+import net.sourceforge.pmd.cpd.*;
public class PMDPlugin implements GelAction {
@@ -16,24 +17,32 @@ public class PMDPlugin implements GelAction {
public void perform(Gel p0) {
try {
+ int x =2;
PMD pmd = new PMD();
RuleContext ctx = new RuleContext();
RuleSetFactory rsf = new RuleSetFactory();
RuleSet ruleSet = new RuleSet();
ruleSet.addRuleSet(rsf.createRuleSet("rulesets/unusedcode.xml"));
- ruleSet.addRuleSet(rsf.createRuleSet("rulesets/basic.xml"));
ctx.setReport(new Report());
- ctx.setSourceCodeFilename(p0.getEditor().getFileName());
- StringReader reader = new StringReader(p0.getEditor().getContents());
- pmd.processFile(reader, ruleSet, ctx);
- if (ctx.getReport().isEmpty()) {
- JOptionPane.showMessageDialog(null, "No problems found", "PMD", JOptionPane.INFORMATION_MESSAGE);
- } else {
- for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
- RuleViolation rv = (RuleViolation)i.next();
- JOptionPane.showMessageDialog(null, (rv.getLine()-1) + ":" + rv.getDescription(), "PMD", JOptionPane.INFORMATION_MESSAGE);
+ for (Iterator iter = p0.getProject().getSourcePaths().iterator(); iter.hasNext();) {
+ String srcDir = (String)iter.next();
+ FileFinder ff = new FileFinder();
+ List files = ff.findFilesFrom(srcDir, new JavaFileOrDirectoryFilter(), true);
+ for (Iterator fileIter = files.iterator(); fileIter.hasNext();) {
+ File fileName = (File)fileIter.next();
+ ctx.setSourceCodeFilename(fileName.getAbsolutePath());
+ Reader reader = new FileReader(fileName);
+ pmd.processFile(reader, ruleSet, ctx);
}
- }
+ }
+ if (ctx.getReport().isEmpty()) {
+ JOptionPane.showMessageDialog(null, "No problems found", "PMD", JOptionPane.INFORMATION_MESSAGE);
+ } else {
+ for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
+ RuleViolation rv = (RuleViolation)i.next();
+ p0.showMessage("File: " + rv.getFilename() + "\r\nLine: " + (rv.getLine()-1) + "\r\nProblem: " + rv.getDescription());
+ }
+ }
} catch (Exception rsne) {
JOptionPane.showMessageDialog(null, "ERROR" + rsne.getMessage());
rsne.printStackTrace();
diff --git a/pmd-gel/src/net/sourceforge/pmd/gel/Test.java b/pmd-gel/src/net/sourceforge/pmd/gel/Test.java
new file mode 100644
index 0000000000..8bb516c78c
--- /dev/null
+++ b/pmd-gel/src/net/sourceforge/pmd/gel/Test.java
@@ -0,0 +1,5 @@
+package net.sourceforge.pmd.gel;
+
+public class Test {
+ private int y;
+}
\ No newline at end of file