forked from phoedos/pmd
Initial revision
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@230 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
9
pmd-jedit/config/actions.xml
Normal file
9
pmd-jedit/config/actions.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE ACTIONS SYSTEM "actions.dtd">
|
||||
<ACTIONS>
|
||||
<ACTION NAME="pmd.check">
|
||||
<CODE>
|
||||
net.sourceforge.pmd.jedit.PMDJEditPlugin.check(view);
|
||||
</CODE>
|
||||
</ACTION>
|
||||
</ACTIONS>
|
32
pmd-jedit/config/jedit.html
Normal file
32
pmd-jedit/config/jedit.html
Normal file
@ -0,0 +1,32 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>PMD JEdit Plug-in Users' Guide</title><meta name="generator" content="DocBook XSL Stylesheets V1.50.0"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article"><div class="titlepage"><div><h1 class="title"><a name="d0e2"></a>PMD JEdit Plug-in Users' Guide</h1></div><div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="#plugin-jedit-installation">Installation</a></dt><dd><dl><dt><a href="#plugin-jedit-installation-requirements">System requirements</a></dt><dt><a href="#plugin-jedit-installation-installation">Installation</a></dt></dl></dd><dt><a href="#plugin-jedit-integration">Integration</a></dt><dt><a href="#plugin-jedit-license">License</a></dt></dl></div><a class="indexterm" name="d0e17"></a><a class="indexterm" name="d0e20"></a><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="plugin-jedit-installation"></a>Installation</h2></div></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="plugin-jedit-installation-requirements"></a>System requirements</h3></div></div><p>
|
||||
The PMD JEdit Plug-in requires at least JEdit 4.0final.
|
||||
</p><p>
|
||||
</p><p>
|
||||
Refer to the PMD user manual for the basic requirements to run PMD (You
|
||||
may find the latest version on the PMD website,
|
||||
<a href="http://pmd.sf.net/" target="_top">http://PMD.sf.net/</a>)
|
||||
</p></div><div class="sect2"><div class="titlepage"><div><h3 class="title"><a name="plugin-jedit-installation-installation"></a>Installation</h3></div></div><a class="indexterm" name="d0e43"></a><p>
|
||||
The Plug-in comes as a single <tt>.zip</tt> file.
|
||||
Unzipping this file into a directory of your choice (referred
|
||||
to as <i><tt><HOME_DIR></tt></i>) will produce two
|
||||
subdirectories <tt>/bin</tt> and <tt>/docs</tt>.
|
||||
</p><p>
|
||||
Further installation is simple: just copy the file
|
||||
<tt><i><tt><HOME_DIR></tt></i>/bin/PMD-jedit-bundle-<i><tt><version></tt></i>.jar</tt>
|
||||
into the <tt>/jars</tt> directory of your JEdit distribution.
|
||||
JEdit will then need to be restarted before PMD begins working.
|
||||
</p></div></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="plugin-jedit-integration"></a>Integration</h2></div></div><p>
|
||||
The software adds a new menu item group into the <b>Plugins</b>
|
||||
menu of the editor view. Available is a new menu item:
|
||||
</p><div class="itemizedlist"><ul type="disc"><li><p>
|
||||
<b>Plugins</b>-><b>PMD</b>-><b>Check active buffer</b> (<b>Ctrl-Shift-F11</b>).
|
||||
</p><p>
|
||||
Checks the contents of the active text area.
|
||||
</p>
|
||||
</p>
|
||||
</li>
|
||||
<p></p></li></ul></div></div><div class="sect1"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="plugin-jedit-license"></a>License</h2></div></div><p>
|
||||
The JEdit Plug-in is free software, released under the Apache license.
|
||||
</p></div></div></body></html>
|
17
pmd-jedit/config/pmd.props
Normal file
17
pmd-jedit/config/pmd.props
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# Plugin properties
|
||||
#
|
||||
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.name=PMD Java Source Code Checker
|
||||
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.author=Tom Copeland
|
||||
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.version=0.1
|
||||
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.docs=jedit.html
|
||||
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.0=jdk 1.3
|
||||
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.1=jedit 04.00.99.00
|
||||
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.jars=pmd.jar
|
||||
|
||||
#
|
||||
# Menu properties
|
||||
#
|
||||
pmd-menu=pmd.check
|
||||
pmd-menu.label=PMD
|
||||
pmd.check.label=$Check active buffer
|
49
pmd-jedit/etc/build.xml
Normal file
49
pmd-jedit/etc/build.xml
Normal file
@ -0,0 +1,49 @@
|
||||
<project name="PMDJEditPlugin" default="clean" basedir="../">
|
||||
|
||||
<property name="config" value="config/"/>
|
||||
<property name="src" value="src/"/>
|
||||
<property name="lib" value="lib/"/>
|
||||
<property name="build" value="build/"/>
|
||||
<property name="jedit.install.dir" value="c:\jedit\jars"/>
|
||||
|
||||
|
||||
<path id="project.class.path">
|
||||
<pathelement location="${lib}/pmd.jar"/>
|
||||
<pathelement location="${lib}/jedit.jar"/>
|
||||
<pathelement location="${build}"/>
|
||||
</path>
|
||||
|
||||
|
||||
<target name="delete">
|
||||
<delete file="${lib}/${ant.project.name}.jar"/>
|
||||
<delete dir="${build}"/>
|
||||
<mkdir dir="${build}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile">
|
||||
<javac
|
||||
srcdir="${src}"
|
||||
destdir="${build}"
|
||||
debug="on"
|
||||
deprecation="on">
|
||||
<classpath refid="project.class.path"/>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="dist" depends="clean">
|
||||
<jar jarfile="${lib}/${ant.project.name}.jar">
|
||||
<fileset dir="${build}"/>
|
||||
<fileset dir="${config}">
|
||||
<include name="*.props"/>
|
||||
<include name="*.xml"/>
|
||||
<include name="*.html"/>
|
||||
</fileset>
|
||||
</jar>
|
||||
<copy file="${lib}/${ant.project.name}.jar" todir="${jedit.install.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="delete,compile">
|
||||
</target>
|
||||
|
||||
</project>
|
2
pmd-jedit/etc/changelog.txt
Normal file
2
pmd-jedit/etc/changelog.txt
Normal file
@ -0,0 +1,2 @@
|
||||
???? 2002 - 0.1:
|
||||
Initial release
|
40
pmd-jedit/etc/doing_the_next_pmd_jedit_release.txt
Normal file
40
pmd-jedit/etc/doing_the_next_pmd_jedit_release.txt
Normal file
@ -0,0 +1,40 @@
|
||||
update the release date in the changelog
|
||||
|
||||
ant release <-- new task, should create jar and zip it up into a pmd-jedit.zip that looks like:
|
||||
jars/pmd-0.3.jar
|
||||
jars/PMDJEditPlugin.jar
|
||||
|
||||
so that it can be unzipped like an overlay
|
||||
|
||||
cvs add -kb pmd-jedit-0.1.jar
|
||||
cvs rm pmd-jedit-0.1.jar
|
||||
cvs ci -m "adding new jar, removing old one"
|
||||
cd c:\data\pmd-jedit
|
||||
cvs rtag -D tomorrow "pmd_jedit_release_0_4" pmd-jedit
|
||||
rmdir /q /s c:\tmp\pmd-jedit
|
||||
mkdir c:\tmp\pmd-jedit
|
||||
cvs export -d c:\tmp\pmd-jedit -r pmd_jedit_release_0_1 pmd-jedit
|
||||
zip it up, rename it to pmd-jedit-0.1.zip
|
||||
unzip it into c:\jedit
|
||||
TESTS: Can you
|
||||
1) run jedit ok?
|
||||
2) open the options panel?
|
||||
3) run PMD on a file?
|
||||
|
||||
if you see a bug and fix it, you can delete the release using:
|
||||
cvs rtag -d pmd_jedit_release_0_1 pmd
|
||||
and then retag everything
|
||||
|
||||
FTP the zip file to SF
|
||||
ftp upload.sourceforge.net
|
||||
generic userid/password: anonymous/tomcopeland@users.sourceforge.net
|
||||
cd incoming
|
||||
bin
|
||||
put pmd-jedit-0.1.zip
|
||||
|
||||
Go to Admin, Edit/Release Files, click on Add new release
|
||||
Paste stuff into the changelog/readme boxes
|
||||
Add the pmd-jedit-0.1.zip file
|
||||
Classify the file
|
||||
|
||||
Submit some news saying "hey, new release of the JEdit plugin!"
|
4
pmd-jedit/etc/scp.bat
Executable file
4
pmd-jedit/etc/scp.bat
Executable file
@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
set CLASSPATH=build/
|
||||
set CLASSPATH=%CLASSPATH%;lib\pmd-0.3.jar
|
||||
set CLASSPATH=%CLASSPATH%;lib\jedit.jar
|
371
pmd-jedit/jedit-pmd.ipr
Normal file
371
pmd-jedit/jedit-pmd.ipr
Normal file
File diff suppressed because it is too large
Load Diff
BIN
pmd-jedit/lib/jedit.jar
Normal file
BIN
pmd-jedit/lib/jedit.jar
Normal file
Binary file not shown.
BIN
pmd-jedit/lib/pmd-0.3.jar
Normal file
BIN
pmd-jedit/lib/pmd-0.3.jar
Normal file
Binary file not shown.
92
pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java
Normal file
92
pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* User: tom
|
||||
* Date: Jul 3, 2002
|
||||
* Time: 2:33:24 PM
|
||||
*/
|
||||
package net.sourceforge.pmd.jedit;
|
||||
|
||||
import org.gjt.sp.jedit.*;
|
||||
import org.gjt.sp.jedit.gui.OptionsDialog;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Vector;
|
||||
import java.util.Iterator;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.StringBufferInputStream;
|
||||
|
||||
import net.sourceforge.pmd.*;
|
||||
import net.sourceforge.pmd.reports.ReportFactory;
|
||||
|
||||
public class PMDJEditPlugin extends EBPlugin {
|
||||
|
||||
|
||||
/*
|
||||
private static class PMDJEditOptionPane extends AbstractOptionPane implements OptionPane {
|
||||
public PMDJEditOptionPane() {
|
||||
super("pmd.general");
|
||||
}
|
||||
public String getName() {
|
||||
return "PMD Option Pane";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public static final String NAME = "PMD";
|
||||
public static final String MENU = "pmd-menu";
|
||||
public static final String PROPERTY_PREFIX = "plugin.net.sourceforge.pmd.jedit.";
|
||||
// public static final String OPTION_PREFIX = "options.pmd.";
|
||||
|
||||
private static PMDJEditPlugin instance = new PMDJEditPlugin();
|
||||
|
||||
public void createMenuItems(Vector menuItems) {
|
||||
menuItems.addElement(GUIUtilities.loadMenu(MENU));
|
||||
}
|
||||
|
||||
/*
|
||||
public void createOptionPanes(OptionsDialog dialog) {
|
||||
dialog.addOptionPane(new PMDJEditOptionPane());
|
||||
}
|
||||
*/
|
||||
|
||||
public void instanceCheck(View view) {
|
||||
//view.getStatus().setMessage("HELLO PMD");
|
||||
String text = view.getTextArea().getText();
|
||||
|
||||
PMD pmd = new PMD();
|
||||
|
||||
ReportFactory rf = new ReportFactory();
|
||||
RuleContext ctx = new RuleContext();
|
||||
RuleSetFactory ruleSetFactory = new RuleSetFactory();
|
||||
RuleSet rules = ruleSetFactory.createRuleSet(pmd.getClass().getClassLoader().getResourceAsStream("rulesets/unusedcode.xml"));
|
||||
|
||||
ctx.setReport(rf.createReport("xml"));
|
||||
ctx.setSourceCodeFilename("this");
|
||||
try {
|
||||
// TODO switch to use StringReader once PMD 0.4 gets released
|
||||
pmd.processFile(new StringBufferInputStream(text), rules, ctx);
|
||||
|
||||
String msg = "";
|
||||
for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
|
||||
RuleViolation rv = (RuleViolation)i.next();
|
||||
msg += rv.getDescription() + " at line " + rv.getLine() + System.getProperty("line.separator");
|
||||
}
|
||||
JOptionPane.showMessageDialog(view, msg, "PMD Results", JOptionPane.INFORMATION_MESSAGE);
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
fnfe.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void instanceDisplayPreferencesDialog(View view) {
|
||||
//view.getStatus().setMessage("HELLO PMD DIALOG");
|
||||
}
|
||||
|
||||
public static void check(View view) {
|
||||
instance.instanceCheck(view);
|
||||
}
|
||||
|
||||
public static void displayPreferencesDialog(View view) {
|
||||
instance.instanceDisplayPreferencesDialog(view);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user