diff --git a/pmd-jedit/config/actions.xml b/pmd-jedit/config/actions.xml
index c97a81948b..31232902dd 100644
--- a/pmd-jedit/config/actions.xml
+++ b/pmd-jedit/config/actions.xml
@@ -6,4 +6,9 @@
net.sourceforge.pmd.jedit.PMDJEditPlugin.check(view);
+
+
+ net.sourceforge.pmd.jedit.PMDJEditPlugin.displayPreferencesDialog(view);
+
+
\ No newline at end of file
diff --git a/pmd-jedit/config/pmd.props b/pmd-jedit/config/pmd.props
index 4de98b246b..46f8e1c3ae 100644
--- a/pmd-jedit/config/pmd.props
+++ b/pmd-jedit/config/pmd.props
@@ -12,6 +12,7 @@ plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.jars=pmd-0.3.jar
#
# Menu properties
#
-pmd-menu=pmd.check
+pmd-menu=pmd.check - pmd.options
pmd-menu.label=PMD
pmd.check.label=$Check active buffer
+pmd.options.label=$Options
diff --git a/pmd-jedit/etc/build.xml b/pmd-jedit/etc/build.xml
index 48133ae46c..f1329dc902 100644
--- a/pmd-jedit/etc/build.xml
+++ b/pmd-jedit/etc/build.xml
@@ -16,6 +16,7 @@
+
@@ -42,7 +43,8 @@
-
+
+
diff --git a/pmd-jedit/etc/changelog.txt b/pmd-jedit/etc/changelog.txt
index b6de9fcb8f..738b405775 100644
--- a/pmd-jedit/etc/changelog.txt
+++ b/pmd-jedit/etc/changelog.txt
@@ -1,4 +1,5 @@
???? 2002 - 0.2:
+Fixed bug - empty msg box is displayed if no errors are found.
July 8 2002 - 0.1:
Initial release
diff --git a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java
index af838863a1..f2e92c1113 100644
--- a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java
+++ b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java
@@ -20,37 +20,34 @@ 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.";
+ public static final String OPTION_PREFIX = "options.pmd.";
private static PMDJEditPlugin instance = new PMDJEditPlugin();
+ // boilerplate JEdit code
+ public static void check(View view) {
+ instance.instanceCheck(view);
+ }
+
+ public static void displayPreferencesDialog(View view) {
+ instance.instanceDisplayPreferencesDialog(view);
+ }
+
public void createMenuItems(Vector menuItems) {
menuItems.addElement(GUIUtilities.loadMenu(MENU));
}
-/*
public void createOptionPanes(OptionsDialog dialog) {
- dialog.addOptionPane(new PMDJEditOptionPane());
+ OptionGroup grp = new OptionGroup("PMD");
+ grp.addOptionPane(new PMDOptionPane());
+ dialog.addOptionGroup(grp);
}
-*/
+ // boilerplate JEdit code
public void instanceCheck(View view) {
- //view.getStatus().setMessage("HELLO PMD");
String text = view.getTextArea().getText();
PMD pmd = new PMD();
@@ -66,27 +63,23 @@ public class PMDJEditPlugin extends EBPlugin {
// TODO switch to use StringReader once PMD 0.4 gets released
pmd.processFile(new StringBufferInputStream(text), rules, ctx);
- String msg = "No errors found";
+ StringBuffer msg = new StringBuffer();
for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
RuleViolation rv = (RuleViolation)i.next();
- msg += rv.getDescription() + " at line " + rv.getLine() + System.getProperty("line.separator");
+ msg.append(rv.getDescription() + " at line " + rv.getLine() + System.getProperty("line.separator"));
}
- JOptionPane.showMessageDialog(view, msg, "PMD Results", JOptionPane.INFORMATION_MESSAGE);
+ if (msg.length() == 0) {
+ msg.append("No errors found");
+ }
+ JOptionPane.showMessageDialog(view, msg.toString(), "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);
- }
}
diff --git a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDOptionPane.java b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDOptionPane.java
new file mode 100644
index 0000000000..ae64f622ff
--- /dev/null
+++ b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDOptionPane.java
@@ -0,0 +1,35 @@
+/*
+ * User: tom
+ * Date: Jul 8, 2002
+ * Time: 4:29:19 PM
+ */
+package net.sourceforge.pmd.jedit;
+
+import org.gjt.sp.jedit.OptionPane;
+import org.gjt.sp.jedit.AbstractOptionPane;
+import org.gjt.sp.jedit.jEdit;
+import org.gjt.sp.jedit.View;
+
+public class PMDOptionPane extends AbstractOptionPane implements OptionPane {
+
+ private static final String NAME = "PMD Options";
+
+ public PMDOptionPane() {
+ super(NAME);
+ }
+
+ public String getName() {
+ return NAME;
+ }
+
+ public void _init() {
+ throw new RuntimeException("HI!!!!");
+/*
+ for (int i = 0; i < jEdit.getViews().length; i++) {
+ View v = jEdit.getViews()[i];
+ v.getStatus().setMessage("HOWDY");
+ }
+*/
+ }
+
+}