From bbfee3796b10b89283e66c49d8ba8127daf7a58b Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Fri, 26 Jul 2002 14:10:36 +0000 Subject: [PATCH] preps for release git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@505 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd-jedit/config/jedit.html | 6 +- pmd-jedit/config/pmd.props | 2 +- pmd-jedit/etc/changelog.txt | 5 +- .../sourceforge/pmd/jedit/PMDJEditPlugin.java | 74 ++++++++----------- .../sourceforge/pmd/jedit/PMDOptionPane.java | 5 +- 5 files changed, 41 insertions(+), 51 deletions(-) diff --git a/pmd-jedit/config/jedit.html b/pmd-jedit/config/jedit.html index 6fc5766f0d..5d4f575f6b 100644 --- a/pmd-jedit/config/jedit.html +++ b/pmd-jedit/config/jedit.html @@ -21,12 +21,12 @@ You can read much more about PMD here - http://pmd.sf.net/.

  • "Check all files in current directory" does just that
  • "Check directory recursively" does just that, too!
  • -

    "Current directory" means "the directory which is displayed in the file system browser. So, for +

    "Current directory" means "the directory which is displayed in the file system browser". So, for example, if you wanted to run PMD on your whole source tree, and your top level source directory is named "src", you would 1) double-click on the "src" directory and then 2) select the "PMD->Check directory recursively" menu option.

    -

    All those options put any errors into the ErrorList so you can jump around your project fixing stuff. -

    There's also a new section in the Global Options configuration panel that lets you pick rule sets.

    +

    All those options put any errors into the ErrorList so you can then go jumping around your project fixing stuff. +

    There's a section in the Global Options->Plugins configuration panel that lets you pick which rule sets you want to use.

    License

    The PMD-JEdit plugin is free software released under the Apache license.

    diff --git a/pmd-jedit/config/pmd.props b/pmd-jedit/config/pmd.props index 26ffbc66ab..c2631bef68 100644 --- a/pmd-jedit/config/pmd.props +++ b/pmd-jedit/config/pmd.props @@ -7,7 +7,7 @@ plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.version=0.6 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-0.6.jar +plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.jars=pmd-0.7.jar # # Menu properties diff --git a/pmd-jedit/etc/changelog.txt b/pmd-jedit/etc/changelog.txt index 0a9eefe0f2..1289f1e572 100644 --- a/pmd-jedit/etc/changelog.txt +++ b/pmd-jedit/etc/changelog.txt @@ -1,6 +1,7 @@ -???? - 0.6 -PMD can be run on 1) all files in a directory or 2) recursively into a directory tree. +July 26 2002 - 0.6 Updated to use pmd-0.7. +PMD can be run on 1) all files in a directory or 2) recursively into a directory tree. +Added some detail to the Options area. July 22 2002 - 0.5: Moved options into Global Options area and made them look nicer. diff --git a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java index d42fab04ae..a904375660 100644 --- a/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java +++ b/pmd-jedit/src/net/sourceforge/pmd/jedit/PMDJEditPlugin.java @@ -27,17 +27,11 @@ public class PMDJEditPlugin extends EditPlugin { public static final String PROPERTY_PREFIX = "plugin.net.sourceforge.pmd.jedit."; public static final String OPTION_RULESETS_PREFIX = "options.pmd.rulesets."; - public static class JavaFileFilter implements FilenameFilter { - public boolean accept(File unused, String filename) { - return filename.endsWith("java"); - } - } - - public static class JavaFileOrDirectoryFilter implements FilenameFilter { - public boolean accept(File dir, String filename) { - return filename.endsWith("java") || (new File(dir.getAbsolutePath() + System.getProperty("file.separator") + filename).isDirectory()); - } - } + public static class JavaFileOrDirectoryFilter implements FilenameFilter { + public boolean accept(File dir, String filename) { + return filename.endsWith("java") || (new File(dir.getAbsolutePath() + System.getProperty("file.separator") + filename).isDirectory()); + } + } private static PMDJEditPlugin instance; @@ -71,10 +65,10 @@ public class PMDJEditPlugin extends EditPlugin { DockableWindowManager wm = view.getDockableWindowManager(); VFSBrowser browser = (VFSBrowser)wm.getDockable("vfs.browser"); if(browser == null) { - JOptionPane.showMessageDialog(jEdit.getFirstView(), "Can't run PMD on a directory unless the file browser is open", "PMD", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(jEdit.getFirstView(), "Can't run PMD on a directory unless the file browser is open", NAME, JOptionPane.ERROR_MESSAGE); return; } - processFiles(findFilesInDirectory(browser.getDirectory()), browser); + processFiles(findFilesInDirectory(browser.getDirectory()), browser); } public static void checkDirectoryRecursively(View view) { @@ -85,13 +79,11 @@ public class PMDJEditPlugin extends EditPlugin { DockableWindowManager wm = view.getDockableWindowManager(); VFSBrowser browser = (VFSBrowser)wm.getDockable("vfs.browser"); if(browser == null) { - JOptionPane.showMessageDialog(jEdit.getFirstView(), "Can't run PMD on a directory unless the file browser is open", "PMD", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(jEdit.getFirstView(), "Can't run PMD on a directory unless the file browser is open", NAME, JOptionPane.ERROR_MESSAGE); return; } - processFiles(findFilesRecursively(browser.getDirectory()), browser); + processFiles(findFilesRecursively(browser.getDirectory()), browser); } - - public static void check(Buffer buffer, View view) { instance.instanceCheck(buffer, view); @@ -122,7 +114,7 @@ public class PMDJEditPlugin extends EditPlugin { } } - private void processFiles(List files, VFSBrowser browser) { + private void processFiles(List files, VFSBrowser browser) { errorSource.clear(); PMD pmd = new PMD(); SelectedRuleSetsMap selectedRuleSets = null; @@ -132,11 +124,13 @@ public class PMDJEditPlugin extends EditPlugin { // should never happen since rulesets are fetched via getRegisteredRuleSet, nonetheless: System.out.println("PMD ERROR: Couldn't find a ruleset"); rsne.printStackTrace(); - JOptionPane.showMessageDialog(jEdit.getFirstView(), "Unable to find rulesets, halting PMD", "PMD", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(jEdit.getFirstView(), "Unable to find rulesets, halting PMD", NAME, JOptionPane.ERROR_MESSAGE); return; } RuleContext ctx = new RuleContext(); ctx.setReport(new Report()); + + boolean foundProblems = false; for (Iterator i = files.iterator(); i.hasNext();) { File file = (File)i.next(); ctx.setReport(new Report()); @@ -148,48 +142,40 @@ public class PMDJEditPlugin extends EditPlugin { System.out.println("PMD ERROR: Unable to open file " + file.getAbsolutePath()); } for (Iterator j = ctx.getReport().iterator(); j.hasNext();) { + foundProblems = true; RuleViolation rv = (RuleViolation)j.next(); errorSource.addError(new DefaultErrorSource.DefaultError(errorSource, ErrorSource.WARNING, file.getAbsolutePath(), rv.getLine()-1,0,0,rv.getDescription())); } } - /* - if (ctx.getReport().isEmpty()) { - JOptionPane.showMessageDialog(jEdit.getFirstView(), "No problems found", "PMD", JOptionPane.INFORMATION_MESSAGE); + if (!foundProblems) { + JOptionPane.showMessageDialog(jEdit.getFirstView(), "No problems found", NAME, JOptionPane.INFORMATION_MESSAGE); errorSource.clear(); } -*/ - } + } private List findFilesInDirectory(String dir) { - FilenameFilter filter = new JavaFileFilter(); - String[] files = (new File(dir)).list(filter); List result = new ArrayList(); - for (int i=0; i