From ddbea7223c4a404ce4e019ae76be9c1c3e5115f4 Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Mon, 6 Oct 2003 19:25:23 +0000 Subject: [PATCH] Added Jeff's Textpad notes git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2291 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/xdocs/integrations.xml | 75 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/pmd/xdocs/integrations.xml b/pmd/xdocs/integrations.xml index 58ebef0d99..5dbef421e7 100644 --- a/pmd/xdocs/integrations.xml +++ b/pmd/xdocs/integrations.xml @@ -125,9 +125,78 @@ you can change the plugin to prompt you for a directory to check by going to tha selecting the "Ask for Directory" checkbox.

- -

Please see the Maven plugins web site for more information.

-
+ + +

Please see the Maven plugins web site for more information.

+
+ + + +
Assumptions
+ +

+ +
To integrate into TextPad
+ +

    +
  1. In the Configure menu, choose Preferences.... This opens the Preferences dialog
  2. +
  3. In the left pane of the Preferences dialog, choose the Tools branch by clicking on the word "Tools".
  4. +
  5. On the far right of the dialog, click on the Add button, and then select Program... from the drop-down. This opens the standard Windows Open File dialog.
  6. +
  7. Type D:\java\jdk_131\bin\java.exe and click the Open button. In the center pane of the Preferences dialog, an item "Java" has now been added, and is currently selected.
  8. +
  9. Click the word Java, which makes the word editable. Select the entire word, and type "PMD directory". Press Return
  10. +
  11. Repeat steps three through five, but type "PMD file", instead of "PMD directory".
  12. +
  13. Click Apply.
  14. +
  15. Expand the Tools branch (if not already) by clicking on the '+' directly to its left.
  16. +
  17. In the expanded list, select PMD directory. This changes the right side of this dialog to the "tool" form.
  18. +
  19. In the "tool" form, enter these parameters:
      +
    • Parameters: -classpath D:\java\pmd-1.2.1\lib\pmd-1.2.1.jar;D:\java\pmd-1.2.1\lib\jaxen-core-1.0-fcs.jar; D:\java\pmd-1.2.1\lib\saxpath-1.0-fcs.jar;D:\java\pmd-1.2.1\lib\xmlParserAPIs-2.0.2.jar; D:\java\pmd-1.2.1\lib\xercesImpl-2.0.2.jar net.sourceforge.pmd.PMD $FileDir net.sourceforge.pmd.renderers.TextPadRenderer E:\directory\my_pmd_ruleset.xml -debug +
      (Eliminate the spaces following both 'jaxen-core-1.0-fcs.jar;' and 'xmlParserAPIs-2.0.2.jar;'. They are there to prevent the text from exceeding the right side of your screen)
    • +
    • Initial Folder: $FileDir
    • +
    • Save all documents first: Checked
    • +
    • Capture output: Checked
    • +
    • All other checkboxes: Unchecked
    • +
    • Regular expression to match output: ^\([^(]+\)(\([0-9]+\),
    • +
    • Registers/File: 1
    • +
    • Registers/Line: 2
    • +
  20. +
  21. In the expanded list, select PMD file.
  22. +
  23. In the "tool" form, enter the same parameters as above, except replace '$FileDir' with '$File', in the Parameters textbox.
  24. +
  25. To save your work (truly, given a quirk of TextPad), click on OK, which closes the Preferences dialog. Restart TextPad and re-open the Preferences dialog.
  26. +
  27. Go back to both the "PMD directory" and "PMD file" Tools branches, and replace 'E:\directory\my_pmd_ruleset.xml' with the ruleset of your choice. For example, rulesets/basic.xml.
  28. +
  29. Go to the Keyboard branch in the left pane (above Tools), which changes the right side to the "keyboard configuration" form.
  30. +
  31. In the Categories list box, select Tools.
  32. +
  33. In the Command list box, select PMD directory.
  34. +
  35. Put your cursor into the Press new shortcut key, and type your desired key command. For example Ctrl+Page Up
  36. +
  37. Click Assign.
  38. +
  39. In the Command list box, select PMD file.
  40. +
  41. Put your cursor into the Press new shortcut key, and type your desired key command. For example Ctrl+Page Down
  42. +
  43. Click Assign.
  44. +
  45. Save your work again: Click on OK, which closes the Preferences dialog, and then restart TextPad.
  46. +

+ + +
To run PMD against a single Java file
+ +

    +
  1. In TextPad, open any Java file.
  2. +
  3. Click Ctrl+Page Down. This opens an empty, read-only text document (titled "Command Results"). When PMD completes its analysis, this document will be populated with a listing of violated rules (or "Command completed successfully" indicating no violations).
  4. +
  5. Double click any line to go to it.
  6. +

+ +
To run PMD against a directory of Java files
+ +

    +
  1. In TextPad, open any file in the root directory you wish to analyze. Unfortunately, you'll need to create a dummy file, if no file exists there.
  2. +
  3. Click Ctrl+Page Up. This opens an empty, read-only text document (titled "Command Results"). When PMD completes its analysis, this document will be populated with a listing of violated rules (or "Command completed successfully" indicating no violations).
  4. +
  5. Double click any line to go to it.
  6. +

+ +

Because directory analysis may take a while, you may choose to cancel this operation. Do so by closing the (black Command Results) document, and then confirming that, "yes, I do really want to exit the tool".

+
+

Here's how to set up the PMD-Gel plugin: