diff --git a/pmd-jedit/config/actions.xml b/pmd-jedit/config/actions.xml
index 2ab0f8d44c..87b69849bd 100644
--- a/pmd-jedit/config/actions.xml
+++ b/pmd-jedit/config/actions.xml
@@ -1,14 +1,9 @@
-
+
net.sourceforge.pmd.jedit.PMDJEditPlugin.check(buffer, view);
-
-
- net.sourceforge.pmd.jedit.PMDJEditPlugin.displayPreferencesDialog(view);
-
-
-
\ No newline at end of file
+
diff --git a/pmd-jedit/config/jedit.html b/pmd-jedit/config/jedit.html
index 1590add28f..369ccd5481 100644
--- a/pmd-jedit/config/jedit.html
+++ b/pmd-jedit/config/jedit.html
@@ -1,32 +1,23 @@
-PMD JEdit Plug-in Users' Guide
+PMD-JEdit Plug-in Users' Guide
-PMD JEdit Plug-in Users' Guide
+PMD-JEdit Plug-in Users' Guide
-Installation
-System requirements
-PMD is a Java source code analyzer. The PMD JEdit Plugin requires at least JEdit 4.0final. Here's the PMD web site.
+PMD is a Java source code analyzer - it finds unused variables, questionable design decisions, empty catch blocks, and so forth.
+You can read much more about PMD here - http://pmd.sf.net/.
Installation
-First, you may have to delete old version of the PMD plugin from your jars directory... you can pretty much just delete any jar file starting with "pmd" to be on the safe side. Then, unzip the PMD-Jedit .zip file.
-Just unzip it into your JEdit directory and it'll put a couple of jar files into your jars directory, restart JEdit,
-and you'll be ready to go.
-Integration
-The software adds a new menu item group into the Plugins menu of the editor view. There are several menu items:
-
--
-Plugins->PMD->Check code - checks your currently displayed Java code pops up a window with the results.
-
-
--
-Plugins->PMD->Options - here's where you can choose what rulesets you want to use to check your code.
-
-
+- Uninstall any old PMD-JEdit plugins
+
- Unzip the PMD-JEdit-bin-0.5.zip file into your JEdit directory; it'll put a couple of jar files into your jars directory.
+
- Restart JEdit and you'll be ready to go.
-License
-The JEdit Plug-in is free software, released under the Apache license.
+Integration
+There's a new 'PMD' menu item in the Plugins menu. This checks your currently displayed Java code and puts the results in the ErrorList.
+There's also a new section in the Global Options configuration panel that lets you pick rule sets.
+License
+The PMD-JEdit plugin is free software released under the Apache license.
\ No newline at end of file
diff --git a/pmd-jedit/config/pmd.props b/pmd-jedit/config/pmd.props
index 27f07640ea..1d26866d64 100644
--- a/pmd-jedit/config/pmd.props
+++ b/pmd-jedit/config/pmd.props
@@ -12,10 +12,11 @@ plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.jars=pmd-0.6.jar
#
# Menu properties
#
-pmd-menu=pmd.check - pmd.options
-pmd-menu.label=PMD
-pmd.check.label=$Check code
-pmd.options.label=$Options
+PMD.label=$PMD
+#
+# Option pane properties
+#
+options.pmd.title=PMD
options.pmd.label=PMD
diff --git a/pmd-jedit/etc/build.xml b/pmd-jedit/etc/build.xml
index 95875abdc2..41dc842f03 100644
--- a/pmd-jedit/etc/build.xml
+++ b/pmd-jedit/etc/build.xml
@@ -35,7 +35,7 @@
-
+
@@ -48,7 +48,7 @@
-
+
diff --git a/pmd-jedit/etc/changelog.txt b/pmd-jedit/etc/changelog.txt
index afd7b453be..ccab371970 100644
--- a/pmd-jedit/etc/changelog.txt
+++ b/pmd-jedit/etc/changelog.txt
@@ -1,4 +1,7 @@
-???? 2002 - 0.5:
+July 22 2002 - 0.5:
+Moved options into Global Options area and made them look nicer.
+Cleaned up menus.
+Cleaned up help text.
July 18 2002 - 0.4:
Updated to use pmd-0.6
diff --git a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java
index e2d8b1db85..5e89b1efc3 100644
--- a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java
+++ b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java
@@ -18,21 +18,20 @@ import java.io.StringReader;
import net.sourceforge.pmd.*;
-public class PMDJEditPlugin extends EBPlugin {
+public class PMDJEditPlugin extends EditPlugin {
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_RULESETS_PREFIX = "options.pmd.rulesets.";
private static PMDJEditPlugin instance;
-
+
static {
instance = new PMDJEditPlugin();
instance.start();
}
-
+
private DefaultErrorSource errorSource;
// boilerplate JEdit code
@@ -41,19 +40,19 @@ public class PMDJEditPlugin extends EBPlugin {
ErrorSource.registerErrorSource(errorSource);
}
+ public void createMenuItems(Vector menuItems) {
+ menuItems.addElement(GUIUtilities.loadMenuItem(NAME));
+ }
+
+ public void createOptionPanes(OptionsDialog optionsDialog) {
+ optionsDialog.addOptionPane(new PMDOptionPane());
+ }
+ // boilerplate JEdit code
+
public static void check(Buffer buffer, View view) {
instance.instanceCheck(buffer, view);
}
- public static void displayPreferencesDialog(View view) {
- instance.instanceDisplayPreferencesDialog(view);
- }
-
- public void createMenuItems(Vector menuItems) {
- menuItems.addElement(GUIUtilities.loadMenu(MENU));
- }
- // boilerplate JEdit code
-
public void instanceCheck(Buffer buffer, View view) {
try {
errorSource.clear();
@@ -68,18 +67,18 @@ public class PMDJEditPlugin extends EBPlugin {
ctx.setReport(new Report());
ctx.setSourceCodeFilename(buffer.getPath());
pmd.processFile(new StringReader(view.getTextArea().getText()), rules, ctx);
- for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
- RuleViolation rv = (RuleViolation)i.next();
+ if (ctx.getReport().isEmpty()) {
+ JOptionPane.showMessageDialog(jEdit.getFirstView(), "No problems found");
+ errorSource.clear();
+ } else {
String path = buffer.getPath();
- DefaultErrorSource.DefaultError err = new DefaultErrorSource.DefaultError(errorSource, ErrorSource.WARNING, path, rv.getLine()-1,0,0,rv.getDescription());
- errorSource.addError(err);
+ for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
+ RuleViolation rv = (RuleViolation)i.next();
+ errorSource.addError(new DefaultErrorSource.DefaultError(errorSource, ErrorSource.WARNING, path, rv.getLine()-1,0,0,rv.getDescription()));
+ }
}
} catch (RuleSetNotFoundException rsne) {
rsne.printStackTrace();
}
}
-
- public void instanceDisplayPreferencesDialog(View view) {
- new PMDOptionPane();
- }
}
diff --git a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDOptionPane.java b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDOptionPane.java
index d23fc699c3..6ec9fa3eb3 100644
--- a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDOptionPane.java
+++ b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDOptionPane.java
@@ -23,82 +23,28 @@ import net.sourceforge.pmd.RuleSet;
public class PMDOptionPane extends AbstractOptionPane implements OptionPane {
- private class SaveAL implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- selectedRuleSets.save();
- }
- }
-
- private class CloseAL implements ActionListener {
- public void actionPerformed(ActionEvent e) {
- dialog.dispose();
- }
- }
-
private SelectedRuleSetsMap selectedRuleSets;
- private JDialog dialog;
public PMDOptionPane() {
super(PMDJEditPlugin.NAME);
- _init();
- }
- public String getName() {
- return PMDJEditPlugin.NAME;
- }
-
- public void _init() {
- super._init();
-
- if (this.selectedRuleSets == null) {
+ if (selectedRuleSets == null) {
try {
selectedRuleSets = new SelectedRuleSetsMap();
} catch (RuleSetNotFoundException rsne) {
rsne.printStackTrace();
}
}
- JPanel textPanel = new JPanel();
- textPanel.setBackground(Color.white);
- textPanel.setLayout(new BorderLayout());
- textPanel.add(new JLabel("Select the rulesets you want to use and click 'Save'."), BorderLayout.NORTH);
- textPanel.add(new JLabel("Please see http://pmd.sourceforge.net/ for more information on what's in each rule set."), BorderLayout.SOUTH);
- JPanel checkBoxPanel = new JPanel();
- checkBoxPanel.setBackground(Color.white);
- checkBoxPanel.setBackground(Color.white);
- checkBoxPanel.setLayout(new GridLayout(selectedRuleSets.size(), 2));
+ addComponent(new JLabel("Please see http://pmd.sourceforge.net/ for more information on what's in each rule set."));
+
for (Iterator i = selectedRuleSets.keys(); i.hasNext();) {
RuleSet rs = (RuleSet)i.next();
- JPanel oneBoxPanel = new JPanel();
- oneBoxPanel.setBackground(Color.white);
- oneBoxPanel.add(new JLabel(rs.getName(), JLabel.LEFT));
- oneBoxPanel.add((JCheckBox)selectedRuleSets.get(rs));
- checkBoxPanel.add(oneBoxPanel);
+ addComponent((JCheckBox)selectedRuleSets.get(rs));
}
-
- JButton saveButton = new JButton("Save");
- saveButton.setMnemonic('s');
- saveButton.addActionListener(new SaveAL());
-
- JButton closeButton = new JButton("Close");
- closeButton.setMnemonic('c');
- closeButton.addActionListener(new CloseAL());
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.setBackground(Color.white);
- buttonPanel.add(saveButton);
- buttonPanel.add(closeButton);
-
- dialog = new JDialog(jEdit.getFirstView(), PMDJEditPlugin.NAME, true);
- dialog.setTitle(PMDJEditPlugin.NAME);
- dialog.getContentPane().setLayout(new BorderLayout());
- dialog.getContentPane().add(textPanel, BorderLayout.NORTH);
- dialog.getContentPane().add(checkBoxPanel, BorderLayout.CENTER);
- dialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
- dialog.setSize(new Dimension(500,300));
- dialog.pack();
- dialog.setLocationRelativeTo(jEdit.getFirstView());
- dialog.setVisible(true);
}
+ public void save() {
+ selectedRuleSets.save();
+ }
}
diff --git a/pmd-jedit/src/net/sourceforge/pmd/jedit/SelectedRuleSetsMap.java b/pmd-jedit/src/net/sourceforge/pmd/jedit/SelectedRuleSetsMap.java
index 1cf3a35c44..1d7481f731 100644
--- a/pmd-jedit/src/net/sourceforge/pmd/jedit/SelectedRuleSetsMap.java
+++ b/pmd-jedit/src/net/sourceforge/pmd/jedit/SelectedRuleSetsMap.java
@@ -58,8 +58,7 @@ public class SelectedRuleSetsMap {
}
private JCheckBox createCheckBox(String name) {
- JCheckBox box = new JCheckBox();
- box.setBackground(Color.white);
+ JCheckBox box = new JCheckBox(name);
box.setSelected(jEdit.getBooleanProperty(PMDJEditPlugin.OPTION_RULESETS_PREFIX + name, true));
return box;
}