Initial revision
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1721 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
2
pmd-gel/etc/MANIFEST.MF
Normal file
2
pmd-gel/etc/MANIFEST.MF
Normal file
@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
Gel-Plugin: net.sourceforge.pmd.gel.PMDPlugin
|
57
pmd-gel/etc/build.xml
Normal file
57
pmd-gel/etc/build.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<project name="pmd-gel" default="compile" basedir="../">
|
||||
|
||||
<property name="lib" value="lib\"/>
|
||||
<property name="src" value="src\"/>
|
||||
<property name="classes" value="classes\"/>
|
||||
<property name="build" value="classes\"/>
|
||||
<property name="version" value="0.1"/>
|
||||
|
||||
<path id="classpath.path">
|
||||
<pathelement location="${build}"/>
|
||||
<fileset dir="${lib}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<target name="delete">
|
||||
<delete dir="${build}"/>
|
||||
<mkdir dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile">
|
||||
<mkdir dir="${build}"/>
|
||||
<javac deprecation="false"
|
||||
debug="true"
|
||||
optimize="false"
|
||||
srcdir="${src}"
|
||||
destdir="${build}">
|
||||
<classpath>
|
||||
<path refid="classpath.path"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="jar" depends="compile">
|
||||
<jar jarfile="${lib}\pmd-gel-${version}.jar" basedir="${build}" manifest="etc/MANIFEST.MF"/>
|
||||
</target>
|
||||
<target name="clean" depends="delete,compile"/>
|
||||
|
||||
<target name="dist" depends="clean,jar">
|
||||
<copy file="${lib}/pmd-gel-${version}.jar" toDir="c:\gel\plugin"/>
|
||||
</target>
|
||||
|
||||
<target name="release" depends="dist">
|
||||
<mkdir dir="tmp"/>
|
||||
<copy file="${lib}/pmd-gel-${version}.jar" toDir="tmp/"/>
|
||||
<copy file="${lib}/jaxen-core-1.0-fcs.jar" toDir="tmp/"/>
|
||||
<copy file="${lib}/saxpath-1.0-fcs.jar" toDir="tmp/"/>
|
||||
<copy file="${lib}/pmd-1.04.jar" toDir="tmp/"/>
|
||||
<copy file="${lib}/xercesImpl-2.0.2.jar" toDir="tmp/"/>
|
||||
<copy file="${lib}/xmlParserAPIs-2.0.2.jar" toDir="tmp/"/>
|
||||
<zip basedir="tmp/" zipfile="pmd-gel-${version}.zip"/>
|
||||
<delete dir="tmp"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
|
14
pmd-gel/etc/scp.bat
Executable file
14
pmd-gel/etc/scp.bat
Executable file
@ -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
|
BIN
pmd-gel/lib/plugin.jar
Normal file
BIN
pmd-gel/lib/plugin.jar
Normal file
Binary file not shown.
96
pmd-gel/pmd-gel.jde
Normal file
96
pmd-gel/pmd-gel.jde
Normal file
@ -0,0 +1,96 @@
|
||||
<CLASS Type="TProject">
|
||||
<PROPERTY Name="Name">pmd-gel</PROPERTY>
|
||||
<PROPERTY Name="FileName">C:\pmd\pmd-gel\pmd-gel.jde</PROPERTY>
|
||||
<PROPERTY Name="Managed">0</PROPERTY>
|
||||
<PROPERTY Name="Expanded">1</PROPERTY>
|
||||
<PROPERTY Name="CompileExtensions">gif,java,properties</PROPERTY>
|
||||
<PROPERTY Name="Extensions">java,gif,properties</PROPERTY>
|
||||
<PROPERTY Name="SmartFolder">0</PROPERTY>
|
||||
<PROPERTY Name="OpenFiles">
|
||||
<CLASS Type="TFiles">
|
||||
<PROPERTY Name="CurrentIndex">0</PROPERTY>
|
||||
<PROPERTY Name="LastFileName">C:\pmd\pmd-gel\etc\build.xml</PROPERTY>
|
||||
<CLASS Type="TFile">
|
||||
<PROPERTY Name="CaretLeft">1</PROPERTY>
|
||||
<PROPERTY Name="CaretTop">19</PROPERTY>
|
||||
<PROPERTY Name="FileName">$(PROJECT)\src\net\sourceforge\pmd\gel\PMDPlugin.java</PROPERTY>
|
||||
<PROPERTY Name="WindowLeft">1</PROPERTY>
|
||||
<PROPERTY Name="WindowTop">9</PROPERTY>
|
||||
</CLASS>
|
||||
<CLASS Type="TFile">
|
||||
<PROPERTY Name="ProjectID">{C34B000D-B5C9-415F-933A-552FB0590E44}</PROPERTY>
|
||||
<PROPERTY Name="CaretLeft">35</PROPERTY>
|
||||
<PROPERTY Name="CaretTop">32</PROPERTY>
|
||||
<PROPERTY Name="FileName">$(PROJECT)\etc\build.xml</PROPERTY>
|
||||
<PROPERTY Name="WindowLeft">1</PROPERTY>
|
||||
<PROPERTY Name="WindowTop">20</PROPERTY>
|
||||
</CLASS>
|
||||
<CLASS Type="TFile">
|
||||
<PROPERTY Name="ProjectID">{C34B000D-B5C9-415F-933A-552FB0590E44}</PROPERTY>
|
||||
<PROPERTY Name="CaretLeft">46</PROPERTY>
|
||||
<PROPERTY Name="CaretTop">2</PROPERTY>
|
||||
<PROPERTY Name="FileName">$(PROJECT)\etc\MANIFEST.MF</PROPERTY>
|
||||
<PROPERTY Name="WindowLeft">1</PROPERTY>
|
||||
<PROPERTY Name="WindowTop">1</PROPERTY>
|
||||
</CLASS>
|
||||
</CLASS>
|
||||
</PROPERTY>
|
||||
<PROPERTY Name="ID">{C34B000D-B5C9-415F-933A-552FB0590E44}</PROPERTY>
|
||||
<PROPERTY Name="HistoryPath">$(PROJECT)\history</PROPERTY>
|
||||
<PROPERTY Name="Libraries">
|
||||
<CLASS Type="TLibraries">
|
||||
<CLASS Type="TLibrary">
|
||||
<PROPERTY Name="ClassPath">$(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</PROPERTY>
|
||||
<PROPERTY Name="JavaDocPath"></PROPERTY>
|
||||
<PROPERTY Name="ID">{2C0CB001-1F3B-416C-BACB-41C43430B5A6}</PROPERTY>
|
||||
<PROPERTY Name="LibraryName">libs</PROPERTY>
|
||||
<PROPERTY Name="SourcePath"></PROPERTY>
|
||||
</CLASS>
|
||||
</CLASS>
|
||||
</PROPERTY>
|
||||
<PROPERTY Name="JDKID">{CF9CD614-D3E7-45B0-A566-57421C9333CC}</PROPERTY>
|
||||
<PROPERTY Name="DocPath">$(PROJECT)\docs</PROPERTY>
|
||||
<PROPERTY Name="OutputPath">$(PROJECT)\classes</PROPERTY>
|
||||
<PROPERTY Name="SourcePath">$(PROJECT)\src</PROPERTY>
|
||||
<PROPERTY Name="SourcePaths">
|
||||
<CLASS Type="TSourcePaths">
|
||||
<CLASS Type="TSourcePath">
|
||||
<PROPERTY Name="Path">$(PROJECT)\src</PROPERTY>
|
||||
<PROPERTY Name="Default">1</PROPERTY>
|
||||
<PROPERTY Name="SourcePathType">0</PROPERTY>
|
||||
</CLASS>
|
||||
</CLASS>
|
||||
</PROPERTY>
|
||||
<PROPERTY Name="RunType">0</PROPERTY>
|
||||
<PROPERTY Name="RunApplication">
|
||||
<CLASS Type="TRunApplication">
|
||||
</CLASS>
|
||||
</PROPERTY>
|
||||
<PROPERTY Name="RunApplet">
|
||||
<CLASS Type="TRunApplet">
|
||||
<PROPERTY Name="AppletType">0</PROPERTY>
|
||||
<PROPERTY Name="Parameters"></PROPERTY>
|
||||
</CLASS>
|
||||
</PROPERTY>
|
||||
<PROPERTY Name="RunManual">
|
||||
<CLASS Type="TRunManual">
|
||||
</CLASS>
|
||||
</PROPERTY>
|
||||
<PROPERTY Name="URLMaps">
|
||||
<CLASS Type="TURLMaps">
|
||||
</CLASS>
|
||||
</PROPERTY>
|
||||
<PROPERTY Name="SCCLocalPath">$(PROJECT)\src</PROPERTY>
|
||||
<PROPERTY Name="Version">0.80</PROPERTY>
|
||||
<PROPERTY Name="SourceControlType">0</PROPERTY>
|
||||
<PROPERTY Name="CVSServerType">0</PROPERTY>
|
||||
<CLASS Type="TFileNode">
|
||||
<PROPERTY Name="Name">PMDPlugin.java</PROPERTY>
|
||||
<PROPERTY Name="FileName">$(PROJECT)\src\net\sourceforge\pmd\gel\PMDPlugin.java</PROPERTY>
|
||||
<PROPERTY Name="Managed">0</PROPERTY>
|
||||
<PROPERTY Name="Marks">
|
||||
<CLASS Type="TMarks">
|
||||
</CLASS>
|
||||
</PROPERTY>
|
||||
</CLASS>
|
||||
</CLASS>
|
46
pmd-gel/src/net/sourceforge/pmd/gel/PMDPlugin.java
Normal file
46
pmd-gel/src/net/sourceforge/pmd/gel/PMDPlugin.java
Normal file
@ -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";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user