From 97ed3507c5237719e0d7b56444dcae5375c92c9c Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Thu, 10 Apr 2003 02:38:03 +0000 Subject: [PATCH] Initial revision git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1721 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd-gel/etc/MANIFEST.MF | 2 + pmd-gel/etc/build.xml | 57 +++++++++++ pmd-gel/etc/scp.bat | 14 +++ pmd-gel/lib/plugin.jar | Bin 0 -> 404 bytes pmd-gel/pmd-gel.jde | 96 ++++++++++++++++++ .../net/sourceforge/pmd/gel/PMDPlugin.java | 46 +++++++++ 6 files changed, 215 insertions(+) create mode 100644 pmd-gel/etc/MANIFEST.MF create mode 100644 pmd-gel/etc/build.xml create mode 100755 pmd-gel/etc/scp.bat create mode 100644 pmd-gel/lib/plugin.jar create mode 100644 pmd-gel/pmd-gel.jde create mode 100644 pmd-gel/src/net/sourceforge/pmd/gel/PMDPlugin.java diff --git a/pmd-gel/etc/MANIFEST.MF b/pmd-gel/etc/MANIFEST.MF new file mode 100644 index 0000000000..a757ab7b06 --- /dev/null +++ b/pmd-gel/etc/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +Gel-Plugin: net.sourceforge.pmd.gel.PMDPlugin diff --git a/pmd-gel/etc/build.xml b/pmd-gel/etc/build.xml new file mode 100644 index 0000000000..9af1f98723 --- /dev/null +++ b/pmd-gel/etc/build.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pmd-gel/etc/scp.bat b/pmd-gel/etc/scp.bat new file mode 100755 index 0000000000..ff14bc4dfa --- /dev/null +++ b/pmd-gel/etc/scp.bat @@ -0,0 +1,14 @@ +@echo off +set CVSROOT=:ext:tomcopeland@cvs.pmd.sourceforge.net:/cvsroot/pmd +set CVS_RSH=c:\bin\ssh\ssh +set HOME=c: +set ANT_HOME=c:\ant +set PATH=c:\j2sdk1.4.1_01\bin;%PATH% +set CLASSPATH=../build/ +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%;c:\ant\lib\ant.jar +set CLASSPATH=%CLASSPATH%;c:\ant\lib\junit.jar diff --git a/pmd-gel/lib/plugin.jar b/pmd-gel/lib/plugin.jar new file mode 100644 index 0000000000000000000000000000000000000000..1440329068995af114d4a29f6d8a6db3dc5e3e17 GIT binary patch literal 404 zcmWIWW@Zs#-~hrIOJejGkN_tG3xls~h@-BjpPT-_Qw$8u3<2Kk93T};P-Ou)HH!dM zz%~0i`gyv!28ZbRx_$ONbK1vSSMMUPx31Q?Gv_x48C)@b@U%$J%U8$K_hRWP7EX!R zl3E!o)1PVnNK+GkDjqI2eaSO1?TTlruQNXteJo-GyFy&S=(r2e4iE;pf(z^-J~S@~ z0!5SabM@0xD+*GJN{WGu9DRhNr=lsB#irafC9@>ING~}jvADQ&%56X4K#{ipclmU4 zmv5QFY7^?}Z7Jex}xYUV`rp<*pMHQzWO1A6rowwZM@i-L#?v-_+ literal 0 HcmV?d00001 diff --git a/pmd-gel/pmd-gel.jde b/pmd-gel/pmd-gel.jde new file mode 100644 index 0000000000..ced1e5fa33 --- /dev/null +++ b/pmd-gel/pmd-gel.jde @@ -0,0 +1,96 @@ + + pmd-gel + C:\pmd\pmd-gel\pmd-gel.jde + 0 + 1 + gif,java,properties + java,gif,properties + 0 + + + 0 + C:\pmd\pmd-gel\etc\build.xml + + 1 + 19 + $(PROJECT)\src\net\sourceforge\pmd\gel\PMDPlugin.java + 1 + 9 + + + {C34B000D-B5C9-415F-933A-552FB0590E44} + 35 + 32 + $(PROJECT)\etc\build.xml + 1 + 20 + + + {C34B000D-B5C9-415F-933A-552FB0590E44} + 46 + 2 + $(PROJECT)\etc\MANIFEST.MF + 1 + 1 + + + + {C34B000D-B5C9-415F-933A-552FB0590E44} + $(PROJECT)\history + + + + $(PROJECT)\lib\xmlParserAPIs-2.0.2.jar,$(PROJECT)\lib\jaxen-core-1.0-fcs.jar,$(PROJECT)\lib\plugin.jar,$(PROJECT)\lib\pmd-1.04.jar,$(PROJECT)\lib\saxpath-1.0-fcs.jar,$(PROJECT)\lib\xercesImpl-2.0.2.jar + + {2C0CB001-1F3B-416C-BACB-41C43430B5A6} + libs + + + + + {CF9CD614-D3E7-45B0-A566-57421C9333CC} + $(PROJECT)\docs + $(PROJECT)\classes + $(PROJECT)\src + + + + $(PROJECT)\src + 1 + 0 + + + + 0 + + + + + + + 0 + + + + + + + + + + + + $(PROJECT)\src + 0.80 + 0 + 0 + + PMDPlugin.java + $(PROJECT)\src\net\sourceforge\pmd\gel\PMDPlugin.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 new file mode 100644 index 0000000000..491c8864dc --- /dev/null +++ b/pmd-gel/src/net/sourceforge/pmd/gel/PMDPlugin.java @@ -0,0 +1,46 @@ +package net.sourceforge.pmd.gel; + +import java.util.*; +import java.io.*; +import javax.swing.*; +import com.gexperts.gel.*; +import net.sourceforge.pmd.*; + +public class PMDPlugin implements GelAction { + + + public boolean isActive(Gel p0) { + System.out.println("isActive"); + return true; + } + + public void perform(Gel p0) { + try { + 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); + } + } + } catch (Exception rsne) { + JOptionPane.showMessageDialog(null, "ERROR" + rsne.getMessage()); + rsne.printStackTrace(); + } + } + + public String getName() { + return "PMDPlugin"; + } +} \ No newline at end of file