Compare commits

..
Author SHA1 Message Date
Andreas Dangel 030795ea95 [maven-release-plugin] prepare release pmd_releases/5.0.5 2013-08-11 11:03:52 +02:00
Andreas Dangel 1dc6d7e698 pmd: Prepare pmd release 5.0.5 2013-08-11 10:25:41 +02:00
Andreas Dangel 5c92fdd31a pmd: fix #1095 AvoidFinalLocalVariable false positive 2013-08-11 09:29:52 +02:00
Andreas Dangel 9a81bcf7dd pmd: fix #1069 Eclipse plugin does not accept project-local config
This is about the RuleSetReferenceId and how we resolve such a
id to a real ruleset.
It is mostly backwards compatible.
2013-08-07 19:20:48 +02:00
Andreas Dangel fb426227e4 pmd: fix #1114 CPD - Tokenizer not initialized with requested properties
There was a similar problem with CPD GUI.
Also resetting the properties, so that unchecking the checkboxes has actually an effect.
2013-08-05 08:51:27 +02:00
Andreas Dangel acf8db926d pmd: fix #1091 file extension for fortran seems to be wrong in cpdgui tools 2013-08-03 22:29:03 +02:00
Andreas Dangel 91f2137679 pmd: fix #1102 False positive: shift operator parenthesis 2013-08-03 22:28:55 +02:00
Andreas Dangel cc095674b0 pmd: fix #1099 UseArraysAsList false positives 2013-08-03 22:28:43 +02:00
Andreas Dangel 0859285b8b pmd: fixed #1107 PMD 5.0.4 couldn't parse call of parent outer java class method from inner class 2013-08-03 22:28:34 +02:00
Andreas Dangel d0c103ab62 pmd: fix #1092 Wrong Attribute "excludemarker" in Ant Task Documentation 2013-08-03 22:28:08 +02:00
Andreas Dangel e76947b297 pmd: fix #1084 NPE at UselessStringValueOfRule.java:36 2013-08-03 22:27:58 +02:00
Andreas Dangel a417f0003f pmd: fix #1104 IdempotentOperation false positive 2013-08-03 22:27:38 +02:00
Andreas Dangel dc64e2df77 pmd: fix #1111 False positive: Useless parentheses 2013-08-03 22:26:52 +02:00
Andreas Dangel 829a939421 pmd: fix #1118 ClassCastException in pmd.lang.ecmascript.ast.ASTElementGet 2013-08-03 14:23:43 +02:00
Andreas Dangel eb57fdc882 pmd: fix #991 AvoidSynchronizedAtMethodLevel for static methods 2013-08-03 13:08:26 +02:00
Andreas Dangel da1ee1fe72 pmd: fix #1114 CPD - Tokenizer not initialized with requested properties 2013-08-03 12:28:25 +02:00
Andreas Dangel ee39aa5f3c [maven-release-plugin] prepare for next development iteration 2013-05-01 12:21:21 +02:00
Andreas Dangel 46573bb566 [maven-release-plugin] prepare release pmd_releases/5.0.4 2013-05-01 12:21:21 +02:00
Andreas Dangel da08b0757e pmd: Prepare pmd release 5.0.4 2013-05-01 11:59:42 +02:00
Andreas Dangel 1c0badd429 pmd: fix #1089 When changing priority in a custom ruleset, violations reported twice 2013-05-01 11:40:37 +02:00
Andreas Dangel e0a9e49560 pmd: fix #794 False positive on PreserveStackTrace with anonymous inner 2013-04-28 10:15:34 +02:00
Andreas Dangel dba46f2ebd pmd: fix #1063 False+: ArrayIsStoredDirectly 2013-04-28 10:15:26 +02:00
Andreas Dangel 5fb6daea58 pmd: fix #1085 NullPointerException by at net.sourceforge.pmd.lang.java.rule.design.GodClassRule.visit(GodClassRule.java:313) 2013-04-25 19:27:24 +02:00
Andreas Dangel 2d655f4684 pmd: fix #1087 PreserveStackTrace (still) ignores initCause()
one more test, extended documentation example
2013-04-25 18:39:03 +02:00
Andreas Dangel b77de63950 pmd: fix #1087 PreserveStackTrace (still) ignores initCause() 2013-04-24 21:40:22 +02:00
Andreas Dangel d347e38622 pmd: fix #1086 Unsupported Element and Attribute in Ant Task Example 2013-04-22 20:31:10 +02:00
Andreas Dangel 7494011999 pmd: fix #254 False+ : UnusedImport with Javadoc @throws 2013-04-15 21:35:51 +02:00
Andreas Dangel 3901ad7ddb pmd: correct documentation for pmd's ant task to select the language
and adding more unit tests.
2013-04-15 21:34:22 +02:00
Andreas Dangel 2e85f1f935 pmd: fix #1080 net.sourceforge.pmd.cpd.CPDTest test failing
The symlinks are simply removed now from the source code and
created by the test, when needed.
The test runs only under unix systems, not under windows.
2013-04-14 17:51:29 +02:00
Andreas Dangel a5efd66b73 pmd: adding more entries to gitignore and to exclude while creating the source zip file. 2013-04-14 17:49:49 +02:00
Andreas Dangel a96ccf9741 pmd: fix #1082 CPD performance issue on larger projects 2013-04-14 13:41:31 +02:00
Andreas Dangel f60128b142 pmd: fix #1081 Regression: CPD skipping all files when using relative paths 2013-04-14 13:41:14 +02:00
Andreas Dangel 89ebc32141 [maven-release-plugin] prepare for next development iteration 2013-04-05 19:31:38 +02:00
Andreas Dangel b501de3fba [maven-release-plugin] prepare release pmd_releases/5.0.3 2013-04-05 19:31:38 +02:00
Andreas Dangel 79fb7e359d pmd: correct the command line examples 2013-04-05 19:19:14 +02:00
Andreas Dangel 6aa4897e21 pmd: prepare pmd release 5.0.3 2013-04-05 18:52:59 +02:00
Andreas Dangel ee05fa73cd pmd: use the released pmd-build plugin 0.8 2013-04-05 18:49:11 +02:00
Andreas Dangel 0170a40dec pmd: fix NPE in LooseCouplingRule 2013-04-05 17:29:53 +02:00
Andreas Dangel 4d7b4bb1bc pmd: fix #1078 Package statement introduces false positive UnnecessaryFullyQualifiedName violation 2013-04-05 17:16:52 +02:00
Andreas Dangel a6c1c1f57c pmd: fix #1077 Missing JavaDocs for Xref-Test Files 2013-03-30 15:46:15 +01:00
Andreas Dangel 9f8246caac pmd: fix #938 False positive on LooseCoupling for overriding methods 2013-03-30 15:46:04 +01:00
Andreas Dangel f51e41b05c pmd: fix #940 False positive on UnsynchronizedStaticDateFormatter 2013-03-30 15:45:52 +01:00
Andreas Dangel ad66153a2d pmd: fix #942 CheckResultSet False Positive
* replacing the xpath rule with a java based rule implementation
2013-03-30 13:58:42 +01:00
Andreas Dangel c8c6aa16dd pmd: fix #943 PreserveStackTrace false positive if a StringBuffer exists 2013-03-30 12:01:42 +01:00
Andreas Dangel b998e64819 pmd: fix #945 PMD generates RuleSets it cannot read. 2013-03-30 12:01:33 +01:00
Andreas Dangel 62fc70e816 pmd: fix #958 Intermittent NullPointerException while loading XPath node attributes
* synchronizing the method cache
 * adding additional null check
2013-03-30 12:01:14 +01:00
Andreas Dangel 34b868ad14 formatting, white spaces 2013-03-30 12:01:06 +01:00
Andreas Dangel 26a862a51b pmd: update changelog, verify #1076 2013-03-24 20:40:55 +01:00
Philip Graf 4569842965 pmd: fix #1076 Report.treeIterator() does not return all violations
The cause of the bug was the implementation of
ViolationNode.equalsNode(otherNode) which returned true when two
different violations start on the same line.

Note: this change also adds a maven dependency on Mockito 1.9.5 (scope:
test). Mockito helps creating mock objects and makes the test more
readable.
2013-03-24 20:40:20 +01:00
Andreas Dangel fddccb5030 pmd: update changelog 2013-03-24 20:40:01 +01:00
Peter Kofler 00e27b4a37 fix Nullpointer Exception when using -l jsp 2013-03-24 20:39:52 +01:00
Andreas Dangel b6c6899741 pmd: fix #1027 PMD Ant: java.lang.ClassCastException 2013-03-17 12:47:45 +01:00
Andreas Dangel 43ecf1e110 pmd: fix #999 Law of Demeter: False positives and negatives 2013-03-17 11:08:16 +01:00
Andreas Dangel 5f45a28621 pmd: fix #975 false positive in ClassCastExceptionWithToArray 2013-03-17 10:20:58 +01:00
Andreas Dangel 41c44e5d8d pmd: fix #968 Issues with JUnit4 @Test annotation with expected exception
Thanks to Yiannis Paschalidis
2013-03-17 10:20:49 +01:00
Andreas Dangel 040d465137 pmd: fix #976 UselessStringValueOf wrong when appending character arrays 2013-03-16 19:55:45 +01:00
Andreas Dangel 4e5ca16990 pmd: fix #977 MisplacedNullCheck makes false positives 2013-03-16 19:21:15 +01:00
Andreas Dangel 30af4f6381 pmd: fix #985 Suppressed methods shouldn't affect avg CyclomaticComplexity 2013-03-16 18:16:29 +01:00
Andreas Dangel cece698b04 pmd: fix #984 Cyclomatic complexity should treat constructors like methods 2013-03-16 18:16:20 +01:00
Andreas Dangel 13ef401a63 pmd: fix #997 Rule NonThreadSafeSingleton gives analysis problem 2013-03-16 12:26:11 +01:00
Andreas Dangel 589ec3c6da pmd: fix #992 Class java.beans.Statement triggered in CloseResource rule 2013-03-16 12:25:53 +01:00
Andreas Dangel c00ca9e44c pmd: fix NPE in ConstructorCallsOverridableMethodRule 2013-03-15 21:57:39 +01:00
Andreas Dangel 31f6b9af1a pmd: fix #1032 ImmutableField Rule: Private field in inner class gives false positive
Improved symbol table resolution to check inner classes, too.
2013-03-15 21:37:29 +01:00
Andreas Dangel 8eac048c03 pmd: fix #1005 False + for ConstructorCallsOverridableMethod - overloaded methods
It won't be perfect, but for constructor calls and method calls a
simple check of the argument types is done. Primitive types are
distinguished, reference types not.
In order to support all cases, full symbol resolution is needed.
2013-03-14 20:49:08 +01:00
Andreas Dangel 3b14b3f5cb pmd: #1002 False +: FinalFieldCouldBeStatic on inner class 2013-03-13 21:12:46 +01:00
Andreas Dangel adcbdc204f pmd: fix #1073 Hard coded violation messages CommentSize 2013-03-10 09:54:34 +01:00
Andreas Dangel a1b1e3f31c pmd: fix #1074 rule priority doesn't work on group definitions
and verify #1067 Custom Ruleset doesn't import the complete ruleset anymore by reference
2013-03-09 17:56:45 +01:00
Andreas Dangel 3e8c42384b pmd: fixed #1064 Exception running PrematureDeclaration 2013-03-01 22:20:46 +01:00
Andreas Dangel a00532595a pmd: fixed #1068 CPD fails on broken symbolic links 2013-03-01 20:17:45 +01:00
Andreas Dangel 3feda38cc3 [maven-release-plugin] prepare for next development iteration 2013-02-03 18:35:38 +01:00
Andreas Dangel 3412d55fc6 [maven-release-plugin] prepare release pmd_releases/5.0.2 2013-02-03 18:35:37 +01:00
Andreas Dangel 436b7dcb50 pmd: set release date for 5.0.2 2013-02-03 18:29:37 +01:00
Andreas Dangel d25dadc4b4 pmd: Prepare pmd release 5.0.2 2013-02-03 15:44:02 +01:00
Andreas Dangel 1c051674a0 pmd: update changelog for 5.0.2 2013-02-03 15:34:58 +01:00
Romain PELISSE 3daca86045 pmd: AntTask support for language
- fix  #1004 targetjdk isn't attribute of PMD task
- introduce a new element, called <language>, that replaces the already existing <version/> element
2013-02-03 15:33:46 +01:00
Romain PELISSE d95d960de3 pmd: fix #1004 targetjdk isn't attribute of PMD task 2013-02-03 15:33:31 +01:00
Torsten Kleiber ef7478c350 Fix for bug #1056 "Error while processing" while running on xml file with DOCTYPE reference
Change the initial value of XINCLUDE_AWARE_DESCRIPTOR to false
This does validate an invalid doctype reference as in some ide generated xml files exist.
Any xml rule, which needs this property should overwrite this value with true.
2013-02-03 15:32:54 +01:00
Romain PELISSE c080fdda08 pmd: fix #1049 Errors in "How to write a rule" 2013-02-03 15:31:21 +01:00
Andreas Dangel e603844a53 pmd: fix #1030 CPD Java.lang.IndexOutOfBoundsException: Index: 2013-01-26 20:08:54 +01:00
Andreas Dangel 52b8be6601 pmd: fixed #947 CloseResource rule fails if field is marked with annotation 2013-01-26 17:58:31 +01:00
Andreas Dangel 7cbb385dbb pmd: fixed #1011 CloseResource Rule ignores Constructors 2013-01-26 17:57:17 +01:00
Andreas Dangel 61c0b4ea7f pmd: fixed #1007 Parse Exception with annotation 2013-01-26 17:57:11 +01:00
Andreas Dangel 26fa85a9fa pmd: fixed #1046 ant task CPDTask doesn't accept ecmascript 2013-01-26 17:56:51 +01:00
Andreas Dangel 98b903897e pmd: fixed #1039 pmd-nicerhtml.xsl is packaged in wrong location 2013-01-26 17:55:22 +01:00
Andreas Dangel 55b5aa7f27 pmd: update rule-guidelines to changed package names 2013-01-26 17:54:09 +01:00
Andreas Dangel ffac9894c9 pmd: fixed #1028 False-positive: Compare objects with equals for Enums 2013-01-26 17:54:03 +01:00
Andreas Dangel d557ed9c01 pmd: verify #1020 Parsing Error 2013-01-26 17:53:56 +01:00
Andreas Dangel e0b7f6f17c pmd: fixed #913 SignatureDeclareThrowsException is raised twice 2013-01-26 17:53:49 +01:00
Andreas Dangel cb9861dd1f pmd: fixed #878 False positive: UnusedFormalParameter for abstract methods 2013-01-26 17:53:41 +01:00
Andreas Dangel 7ee96a6b52 pmd: fixed #1055 Please add a colon in the ant output after line,column for Oracle JDeveloper IDE usage 2013-01-26 17:53:33 +01:00
Andreas Dangel ac8e3314a3 pmd: fixed bug #1012 False positive: Useless parentheses. 2013-01-19 19:13:09 +01:00
Andreas Dangel 7989ae1863 pmd: fixed #1060 GodClassRule >>> wrong method 2013-01-19 19:12:59 +01:00
Andreas Dangel e3708b5030 pmd: fix #1037 Facing a showstopper issue in PMD Report Class
* wrapping the report listeners in a thread safe (synchronized) class
 * overtaking the listeners for each thread / report
2012-12-17 11:02:24 +01:00
Andreas Dangel 85e493d55f pmd: fixed #1026 PMD doesn't handle 'value =' in SuppressWarnings annotation 2012-12-16 23:12:29 +01:00
Andreas Dangel 6abbea51dd pmd: fix #1043 node.getEndLine() always returns 0 (ECMAscript)
* added commons-io dependency
 * added a SourceCodePositioner to calculate line/column from position
2012-12-16 18:16:39 +01:00
Andreas Dangel 9162917346 pmd: fix #1047 False Positive in 'for' loops for LocalVariableCouldBeFinal in 5.0.1 2012-12-16 12:10:06 +01:00
Andreas Dangel 637006674f pmd: Fixed bug 1048: CommentContent Rule, String Index out of range Exception 2012-12-07 11:17:44 +01:00
Andreas Dangel 63c1a8fe47 pmd: CLI - make sure we display the usage help text
Therefore make the -h option a help option.
Make the auxclasspath option description look nicer - newlines break the layout.
Always display the jcommander usage help text.
And exit with an error code in case there are parameter errors.
2012-12-05 22:02:49 +01:00
Andreas Dangel 063c4228e3 pmd: fix bug #1044 - update suppressing documentation with new cli paramter name 2012-12-05 22:02:40 +01:00
Andreas Dangel 4b0063dfc1 [maven-release-plugin] prepare for next development iteration 2012-11-28 21:43:38 +01:00
Andreas Dangel 13e36974a5 [maven-release-plugin] prepare release pmd_releases/5.0.1 2012-11-28 21:43:36 +01:00
Andreas Dangel 33c7af965c pmd: fix failing unit test 2012-11-28 21:25:56 +01:00
Andreas Dangel a66bbf2193 pmd: prepare release 5.0.1 2012-11-28 21:02:35 +01:00
Andreas Dangel 38af8f2433 Merge branch 'master' into pmd/5.0.x 2012-11-28 20:42:58 +01:00
Andreas Dangel a6bcfe2b65 pmd: added missing ssh/scp wagon support for maven3
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/5.0.x@7669 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-01 11:41:10 +00:00
Andreas Dangel 6474fde42d [maven-release-plugin] prepare for next development iteration
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/5.0.x@7668 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-01 07:43:32 +00:00
Andreas Dangel 8dcde0edb5 [maven-release-plugin] prepare release pmd_release_5_0_0
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/5.0.x@7666 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-01 07:42:56 +00:00
Andreas Dangel 70347aedd5 pmd: Prepare pmd release 5.0.0
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/5.0.x@7665 51baf565-9d33-0410-a72c-fc3788e3496d
2012-05-01 07:38:38 +00:00
Andreas Dangel eaf1385595 update the version to the usual three components: 5.0.0-SNAPSHOT
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/5.0.x@7664 51baf565-9d33-0410-a72c-fc3788e3496d
2012-04-30 11:35:40 +00:00
2137 changed files with 134132 additions and 60982 deletions

No files matched your search

+5 -24
View File
@@ -1,27 +1,8 @@
[![PMD - Don't shoot the messenger][PMDLogo]][website]
# PMD
PMD
===
PMD is a source code analyzer. It finds unused variables,
empty catch blocks, unnecessary object creation, and so forth.
About
-----
PMD is a source code analyzer. It finds common programming flaws like unused variables, empty catch blocks,
unnecessary object creation, and so forth. It supports Java, JavaScript, XML, XSL.
Additionally it includes CPD, the copy-paste-detector. CPD finds duplicated code in
Java, C, C++, C#, PHP, Ruby, Fortran, JavaScript.
For more information, visit http://pmd.sourceforge.net
Source
------
Our latest source of PMD can be found on [GitHub]. Fork us!
The current status of this repo can be seen at [BuildHive].
News and Website
----------------
More information can be found on our [Website] and on [SourceForge].
[PMDLogo]: http://pmd.sourceforge.net/pmd_logo.png
[GitHub]: https://github.com/pmd/pmd
[BuildHive]: https://buildhive.cloudbees.com/job/pmd/
[Website]: http://pmd.sourceforge.net
[SourceForge]: https://sourceforge.net/projects/pmd/
To see the current status of this repo, visit https://buildhive.cloudbees.com/job/pmd/
@@ -0,0 +1,41 @@
package net.sourceforge.pmd.util.viewer;
import net.sourceforge.pmd.util.viewer.gui.MainFrame;
/**
* viewer's starter
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class Viewer {
/**
* starts the viewer
*
* @param args arguments
*/
public static void main(String[] args) {
new MainFrame();
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:41 tomcopeland
* Initial revision
*
* Revision 1.2 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,147 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.ast.Node;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.util.viewer.gui.menu.ASTNodePopupMenu;
import net.sourceforge.pmd.util.viewer.model.ASTModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.LinkedList;
/**
* tree panel GUI
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class ASTPanel
extends JPanel
implements ViewerModelListener, TreeSelectionListener {
private ViewerModel model;
private JTree tree;
/**
* constructs the panel
*
* @param model model to attach the panel to
*/
public ASTPanel(ViewerModel model) {
this.model = model;
init();
}
private void init() {
model.addViewerModelListener(this);
setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("AST.PANEL.TITLE")));
setLayout(new BorderLayout());
tree = new JTree((TreeNode) null);
tree.addTreeSelectionListener(this);
tree.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
TreePath path =
tree.getClosestPathForLocation(e.getX(), e.getY());
tree.setSelectionPath(path);
JPopupMenu menu =
new ASTNodePopupMenu(model, (SimpleNode) path.getLastPathComponent());
menu.show(tree, e.getX(), e.getY());
}
}
});
add(new JScrollPane(tree), BorderLayout.CENTER);
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
switch (e.getReason()) {
case ViewerModelEvent.CODE_RECOMPILED:
tree.setModel(new ASTModel(model.getRootNode()));
break;
case ViewerModelEvent.NODE_SELECTED:
if (e.getSource() != this) {
LinkedList list = new LinkedList();
for (
Node node = (Node) e.getParameter(); node != null;
node = node.jjtGetParent())
list.addFirst(node);
TreePath path = new TreePath(list.toArray());
tree.setSelectionPath(path);
tree.scrollPathToVisible(path);
}
break;
}
}
/**
* @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
*/
public void valueChanged(TreeSelectionEvent e) {
model.selectNode((SimpleNode) e.getNewLeadSelectionPath().getLastPathComponent(), this);
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.5 2005/02/16 15:46:05 mikkey
* javadoc fixes
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.3 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.2 2003/09/23 07:52:16 bgr
* menus added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,35 @@
package net.sourceforge.pmd.util.viewer.gui;
/**
* contains action command constants
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public interface ActionCommands {
String COMPILE_ACTION = "Compile";
String EVALUATE_ACTION = "Evaluate";
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.3 2004/12/22 20:52:12 tomcopeland
* Fixing some stuff PMD found
*
* Revision 1.2 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,105 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout;
import java.util.Vector;
/**
* A panel showing XPath expression evaluation results
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class EvaluationResultsPanel
extends JPanel
implements ViewerModelListener {
private ViewerModel model;
private JList list;
/**
* constructs the panel
*
* @param model model to refer to
*/
public EvaluationResultsPanel(ViewerModel model) {
super(new BorderLayout());
this.model = model;
init();
}
private void init() {
model.addViewerModelListener(this);
list = new JList();
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (list.getSelectedValue() != null) {
model.selectNode((SimpleNode) list.getSelectedValue(), EvaluationResultsPanel.this);
}
}
});
add(new JScrollPane(list), BorderLayout.CENTER);
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
switch (e.getReason()) {
case ViewerModelEvent.PATH_EXPRESSION_EVALUATED:
if (e.getSource() != this) {
list.setListData(new Vector(model.getLastEvaluationResults()));
}
break;
case ViewerModelEvent.CODE_RECOMPILED:
list.setListData(new Vector(0));
break;
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.5 2005/02/16 15:46:34 mikkey
* javadoc fixes
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
*/
@@ -0,0 +1,172 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.ast.ParseException;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* viewer's main frame
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class MainFrame
extends JFrame
implements ActionListener, ActionCommands, ViewerModelListener {
private ViewerModel model;
private SourceCodePanel sourcePanel;
private ASTPanel astPanel;
private XPathPanel xPathPanel;
private JButton compileBtn;
private JButton evalBtn;
private JLabel statusLbl;
/**
* constructs and shows the frame
*/
public MainFrame() {
super(NLS.nls("MAIN.FRAME.TITLE"));
init();
}
private void init() {
model = new ViewerModel();
model.addViewerModelListener(this);
sourcePanel = new SourceCodePanel(model);
astPanel = new ASTPanel(model);
xPathPanel = new XPathPanel(model);
getContentPane().setLayout(new BorderLayout());
JSplitPane editingPane =
new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sourcePanel, astPanel);
editingPane.setResizeWeight(0.5d);
JPanel interactionsPane = new JPanel(new BorderLayout());
interactionsPane.add(xPathPanel, BorderLayout.SOUTH);
interactionsPane.add(editingPane, BorderLayout.CENTER);
getContentPane().add(interactionsPane, BorderLayout.CENTER);
compileBtn = new JButton(NLS.nls("MAIN.FRAME.COMPILE_BUTTON.TITLE"));
compileBtn.setActionCommand(COMPILE_ACTION);
compileBtn.addActionListener(this);
evalBtn = new JButton(NLS.nls("MAIN.FRAME.EVALUATE_BUTTON.TITLE"));
evalBtn.setActionCommand(EVALUATE_ACTION);
evalBtn.addActionListener(this);
evalBtn.setEnabled(false);
statusLbl = new JLabel();
statusLbl.setHorizontalAlignment(SwingConstants.RIGHT);
JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
btnPane.add(compileBtn);
btnPane.add(evalBtn);
btnPane.add(statusLbl);
getContentPane().add(btnPane, BorderLayout.SOUTH);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
pack();
setSize(800, 600);
setVisible(true);
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
long t0, t1;
if (command.equals(COMPILE_ACTION)) {
try {
t0 = System.currentTimeMillis();
model.commitSource(sourcePanel.getSourceCode());
t1 = System.currentTimeMillis();
setStatus(NLS.nls("MAIN.FRAME.COMPILATION.TOOK")+ " "+(t1-t0)+" ms");
} catch (ParseException exc) {
setStatus(NLS.nls("MAIN.FRAME.COMPILATION.PROBLEM")+ " "+exc.toString());
new ParseExceptionHandler(this, exc);
}
} else if (command.equals(EVALUATE_ACTION)) {
try {
t0 = System.currentTimeMillis();
model.evaluateXPathExpression(xPathPanel.getXPathExpression(), this);
t1 = System.currentTimeMillis();
setStatus(NLS.nls("MAIN.FRAME.EVALUATION.TOOK")+ " "+(t1-t0)+" ms");
} catch (Exception exc) {
setStatus(NLS.nls("MAIN.FRAME.EVALUATION.PROBLEM")+ " "+exc.toString());
new ParseExceptionHandler(this, exc);
}
}
}
/**
* Sets the status bar message
* @param string the new status, the empty string will be set if the value is <code>null</code>
*/
private void setStatus(String string) {
if (string == null)
string = "";
statusLbl.setText(string);
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
evalBtn.setEnabled(model.hasCompiledTree());
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.6 2005/02/16 15:47:01 mikkey
* javadoc fixes
*
* Revision 1.5 2004/12/13 14:46:11 tomcopeland
* Applied, thanks Miguel!
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.2 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,112 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* handles parsing exceptions
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class ParseExceptionHandler
extends JDialog
implements ActionListener {
private Exception exc;
private JTextArea errorArea;
private JButton okBtn;
/**
* creates the dialog
*
* @param parent dialog's parent
* @param exc exception to be handled
*/
public ParseExceptionHandler(JFrame parent, Exception exc) {
super(parent, NLS.nls("COMPILE_ERROR.DIALOG.TITLE"), true);
this.exc = exc;
init();
}
private void init() {
errorArea = new JTextArea();
errorArea.setEditable(false);
errorArea.setText(exc.getMessage() + "\n");
getContentPane().setLayout(new BorderLayout());
JPanel messagePanel = new JPanel(new BorderLayout());
messagePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(),
BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
NLS.nls("COMPILE_ERROR.PANEL.TITLE"))));
messagePanel.add(new JScrollPane(errorArea), BorderLayout.CENTER);
getContentPane().add(messagePanel, BorderLayout.CENTER);
JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
okBtn = new JButton(NLS.nls("COMPILE_ERROR.OK_BUTTON.CAPTION"));
okBtn.addActionListener(this);
btnPane.add(okBtn);
getRootPane().setDefaultButton(okBtn);
getContentPane().add(btnPane, BorderLayout.SOUTH);
pack();
setLocationRelativeTo(getParent());
setVisible(true);
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource() == okBtn) {
dispose();
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.2 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,119 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultHighlighter;
import java.awt.BorderLayout;
import java.awt.Color;
/**
* source code panel
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class SourceCodePanel
extends JPanel
implements ViewerModelListener {
private ViewerModel model;
private JTextArea sourceCodeArea;
public SourceCodePanel(ViewerModel model) {
this.model = model;
init();
}
private void init() {
model.addViewerModelListener(this);
setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("SOURCE.PANEL.TITLE")));
setLayout(new BorderLayout());
sourceCodeArea = new JTextArea();
add(new JScrollPane(sourceCodeArea), BorderLayout.CENTER);
}
/**
* retrieves the string representation of the source code
*
* @return source code's string representation
*/
public String getSourceCode() {
return sourceCodeArea.getText();
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
if (e.getReason() == ViewerModelEvent.NODE_SELECTED) {
final SimpleNode node = (SimpleNode) e.getParameter();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
sourceCodeArea.getHighlighter().removeAllHighlights();
if (node == null) {
return;
}
int startOffset =
(sourceCodeArea.getLineStartOffset(node.getBeginLine() - 1) +
node.getBeginColumn()) - 1;
int end =
(sourceCodeArea.getLineStartOffset(node.getEndLine() - 1) +
node.getEndColumn());
sourceCodeArea.getHighlighter().addHighlight(startOffset, end,
new DefaultHighlighter.DefaultHighlightPainter(new Color(79, 237, 111)));
sourceCodeArea.moveCaretPosition(startOffset);
} catch (BadLocationException exc) {
throw new IllegalStateException(exc.getMessage());
}
}
});
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.5 2005/02/16 15:47:27 mikkey
* javadoc fixes
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,115 @@
package net.sourceforge.pmd.util.viewer.gui;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.model.ViewerModelEvent;
import net.sourceforge.pmd.util.viewer.model.ViewerModelListener;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import java.awt.Dimension;
/**
* Panel for the XPath entry and editing
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class XPathPanel
extends JTabbedPane
implements ViewerModelListener {
private ViewerModel model;
private JTextArea xPathArea;
/**
* Constructs the panel
*
* @param model model to refer to
*/
public XPathPanel(ViewerModel model) {
super(JTabbedPane.BOTTOM);
this.model = model;
init();
}
private void init() {
model.addViewerModelListener(this);
xPathArea = new JTextArea();
setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("XPATH.PANEL.TITLE")));
add(new JScrollPane(xPathArea), NLS.nls("XPATH.PANEL.EXPRESSION"));
add(new EvaluationResultsPanel(model), NLS.nls("XPATH.PANEL.RESULTS"));
setPreferredSize(new Dimension(-1, 200));
}
/**
* retrieves the XPath expression typed into the text area
*
* @return XPath expression
*/
public String getXPathExpression() {
return xPathArea.getText();
}
/**
* @see ViewerModelListener#viewerModelChanged(ViewerModelEvent)
*/
public void viewerModelChanged(ViewerModelEvent e) {
switch (e.getReason()) {
case ViewerModelEvent.PATH_EXPRESSION_APPENDED:
if (e.getSource() != this) {
xPathArea.append((String) e.getParameter());
}
setSelectedIndex(0);
break;
case ViewerModelEvent.CODE_RECOMPILED:
setSelectedIndex(0);
break;
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.5 2005/02/16 15:47:48 mikkey
* javadoc fixes
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.3 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.2 2003/09/23 07:52:16 bgr
* menus added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,63 @@
package net.sourceforge.pmd.util.viewer.gui.menu;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import javax.swing.*;
/**
* context sensetive menu for the AST Panel
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class ASTNodePopupMenu
extends JPopupMenu {
private ViewerModel model;
private SimpleNode node;
public ASTNodePopupMenu(ViewerModel model, SimpleNode node) {
this.model = model;
this.node = node;
init();
}
private void init() {
add(new SimpleNodeSubMenu(model, node));
addSeparator();
add(new AttributesSubMenu(model, node));
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:43 tomcopeland
* Initial revision
*
* Revision 1.5 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.4 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.3 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.2 2003/09/23 20:34:33 tomcopeland
* Fixed some stuff PMD found
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/23 07:52:16 bgr
* menus added
*
*/
@@ -0,0 +1,73 @@
package net.sourceforge.pmd.util.viewer.gui.menu;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.jaxen.Attribute;
import net.sourceforge.pmd.jaxen.AttributeAxisIterator;
import net.sourceforge.pmd.util.viewer.model.AttributeToolkit;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import java.text.MessageFormat;
/**
* contains menu items for the predicate creation
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class AttributesSubMenu
extends JMenu {
private ViewerModel model;
private SimpleNode node;
public AttributesSubMenu(ViewerModel model, SimpleNode node) {
super(MessageFormat.format(NLS.nls("AST.MENU.ATTRIBUTES"), new Object[]{node.toString()}));
this.model = model;
this.node = node;
init();
}
private void init() {
AttributeAxisIterator i = new AttributeAxisIterator(node);
while (i.hasNext()) {
Attribute attribute = (Attribute) i.next();
add(new XPathFragmentAddingItem(attribute.getName() + " = " + attribute.getValue(), model,
AttributeToolkit.constructPredicate(attribute)));
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:43 tomcopeland
* Initial revision
*
* Revision 1.5 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.4 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.3 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.2 2003/09/23 20:34:34 tomcopeland
* Fixed some stuff PMD found
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/23 07:52:16 bgr
* menus added
*
*/
@@ -0,0 +1,76 @@
package net.sourceforge.pmd.util.viewer.gui.menu;
import net.sourceforge.pmd.ast.Node;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import net.sourceforge.pmd.util.viewer.util.NLS;
import javax.swing.*;
import java.text.MessageFormat;
/**
* submenu for the simple node itself
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class SimpleNodeSubMenu
extends JMenu {
private ViewerModel model;
private SimpleNode node;
/**
* constructs the submenu
*
* @param model model to which the actions will be forwarded
* @param node menu's owner
*/
public SimpleNodeSubMenu(ViewerModel model, SimpleNode node) {
super(MessageFormat.format(NLS.nls("AST.MENU.NODE.TITLE"), new Object[]{node.toString()}));
this.model = model;
this.node = node;
init();
}
private void init() {
StringBuffer buf = new StringBuffer(200);
for (Node temp = node; temp != null; temp = temp.jjtGetParent()) {
buf.insert(0, "/" + temp.toString());
}
add(new XPathFragmentAddingItem(NLS.nls("AST.MENU.NODE.ADD_ABSOLUTE_PATH"), model, buf.toString()));
add(new XPathFragmentAddingItem(NLS.nls("AST.MENU.NODE.ADD_ALLDESCENDANTS"), model,
"//" + node.toString()));
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:43 tomcopeland
* Initial revision
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/23 07:52:16 bgr
* menus added
*
*/
@@ -0,0 +1,70 @@
package net.sourceforge.pmd.util.viewer.gui.menu;
import net.sourceforge.pmd.util.viewer.model.ViewerModel;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* adds the given path fragment to the XPath expression upon action
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class XPathFragmentAddingItem
extends JMenuItem
implements ActionListener {
private ViewerModel model;
private String fragment;
/**
* constructs the item
*
* @param caption menu item's caption
* @param model model to refer to
* @param fragment XPath expression fragment to be added upon action
*/
public XPathFragmentAddingItem(String caption, ViewerModel model, String fragment) {
super(caption);
this.model = model;
this.fragment = fragment;
addActionListener(this);
}
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
model.appendToXPathExpression(fragment, this);
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.4 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.3 2004/04/15 18:21:58 tomcopeland
* Cleaned up imports with new version of IDEA; fixed some deprecated Ant junx
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/23 07:52:16 bgr
* menus added
*
*/
@@ -0,0 +1,125 @@
package net.sourceforge.pmd.util.viewer.model;
import net.sourceforge.pmd.ast.SimpleNode;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import java.util.Vector;
/**
* Model for the AST Panel Tree component
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class ASTModel
implements TreeModel {
private SimpleNode root;
private Vector listeners = new Vector(1);
/**
* creates the tree model
*
* @param root tree's root
*/
public ASTModel(SimpleNode root) {
this.root = root;
}
/**
* @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
*/
public Object getChild(Object parent, int index) {
return ((SimpleNode) parent).jjtGetChild(index);
}
/**
* @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
*/
public int getChildCount(Object parent) {
return ((SimpleNode) parent).jjtGetNumChildren();
}
/**
* @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object,
* java.lang.Object)
*/
public int getIndexOfChild(Object parent, Object child) {
SimpleNode node = ((SimpleNode) parent);
for (int i = 0; i < node.jjtGetNumChildren(); i++)
if (node.jjtGetChild(i).equals(child)) {
return i;
}
return -1;
}
/**
* @see javax.swing.tree.TreeModel#isLeaf(java.lang.Object)
*/
public boolean isLeaf(Object node) {
return ((SimpleNode) node).jjtGetNumChildren() == 0;
}
/**
* @see javax.swing.tree.TreeModel#getRoot()
*/
public Object getRoot() {
return root;
}
/**
* @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath,
* java.lang.Object)
*/
public void valueForPathChanged(TreePath path, Object newValue) {
throw new UnsupportedOperationException();
}
/**
* @see javax.swing.tree.TreeModel#addTreeModelListener(javax.swing.event.TreeModelListener)
*/
public void addTreeModelListener(TreeModelListener l) {
listeners.add(l);
}
/**
* @see javax.swing.tree.TreeModel#removeTreeModelListener(javax.swing.event.TreeModelListener)
*/
public void removeTreeModelListener(TreeModelListener l) {
listeners.remove(l);
}
protected void fireTreeModelEvent(TreeModelEvent e) {
for (int i = 0; i < listeners.size(); i++) {
((TreeModelListener) listeners.elementAt(i)).treeNodesChanged(e);
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.3 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
*/
@@ -0,0 +1,53 @@
package net.sourceforge.pmd.util.viewer.model;
import net.sourceforge.pmd.jaxen.Attribute;
/**
* A toolkit for vaious attribute translations
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class AttributeToolkit {
/**
* formats a value for it's usage in XPath expressions
*
* @param attribute atribute which value should be formatted
* @return formmated value
*/
public static String formatValueForXPath(Attribute attribute) {
return "'" + attribute.getValue() + "'";
}
/**
* constructs a predicate from the given attribute
*
* @param attribute attribute to be formatted as predicate
* @return predicate
*/
public static String constructPredicate(Attribute attribute) {
return "[@" + attribute.getName() + "=" +
formatValueForXPath(attribute) + "]";
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.2 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/23 07:52:16 bgr
* menus added
*
*/
@@ -0,0 +1,142 @@
package net.sourceforge.pmd.util.viewer.model;
import net.sourceforge.pmd.ast.SimpleNode;
import javax.swing.tree.TreeNode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
/**
* provides the adapter for the tree model
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class SimpleNodeTreeNodeAdapter
implements TreeNode {
private SimpleNode node;
private List children;
private SimpleNodeTreeNodeAdapter parent;
/**
* constructs the node
*
* @param node underlying AST's node
*/
public SimpleNodeTreeNodeAdapter(SimpleNodeTreeNodeAdapter parent, SimpleNode node) {
this.parent = parent;
this.node = node;
}
/**
* retrieves the underlying node
*
* @return AST node
*/
public SimpleNode getSimpleNode() {
return node;
}
/**
* @see javax.swing.tree.TreeNode#getChildAt(int)
*/
public TreeNode getChildAt(int childIndex) {
checkChildren();
return (TreeNode) children.get(childIndex);
}
/**
* @see javax.swing.tree.TreeNode#getChildCount()
*/
public int getChildCount() {
checkChildren();
return children.size();
}
/**
* @see javax.swing.tree.TreeNode#getParent()
*/
public TreeNode getParent() {
return parent;
}
/**
* @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode)
*/
public int getIndex(TreeNode node) {
checkChildren();
return children.indexOf(node);
}
/**
* @see javax.swing.tree.TreeNode#getAllowsChildren()
*/
public boolean getAllowsChildren() {
return true;
}
/**
* @see javax.swing.tree.TreeNode#isLeaf()
*/
public boolean isLeaf() {
checkChildren();
return children.size() == 0;
}
/**
* @see javax.swing.tree.TreeNode#children()
*/
public Enumeration children() {
return Collections.enumeration(children);
}
/**
* checks the children and creates them if neccessary
*/
private void checkChildren() {
if (children == null) {
children = new ArrayList(node.jjtGetNumChildren());
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
children.add(new SimpleNodeTreeNodeAdapter(this, (SimpleNode) node.jjtGetChild(i)));
}
}
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return node.toString();
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:41 tomcopeland
* Initial revision
*
* Revision 1.3 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,180 @@
package net.sourceforge.pmd.util.viewer.model;
import net.sourceforge.pmd.TargetJDK1_4;
import net.sourceforge.pmd.ast.ASTCompilationUnit;
import net.sourceforge.pmd.ast.ParseException;
import net.sourceforge.pmd.ast.SimpleNode;
import net.sourceforge.pmd.jaxen.DocumentNavigator;
import org.jaxen.BaseXPath;
import org.jaxen.JaxenException;
import org.jaxen.XPath;
import java.io.StringReader;
import java.util.List;
import java.util.Vector;
/**
* The model for the viewer gui
* <p/>
* <p/>
* This is the model part of MVC
* </p>
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class ViewerModel {
private Vector listeners;
private SimpleNode rootNode;
private List evaluationResults;
/**
* constructs the model
*/
public ViewerModel() {
listeners = new Vector(5);
}
/**
* Retrieves AST's root node
*
* @return AST's root node
*/
public SimpleNode getRootNode() {
return rootNode;
}
/**
* commits source code to the model.
* <p/>
* <p/>
* all existing source will be replaced
* </p>
*
* @param source source to be commited
*/
public void commitSource(String source) {
ASTCompilationUnit compilationUnit = new TargetJDK1_4().createParser(new StringReader(source)).CompilationUnit();
rootNode = compilationUnit;
fireViewerModelEvent(new ViewerModelEvent(this, ViewerModelEvent.CODE_RECOMPILED));
}
/**
* determines wheteher the model has a compiled tree at it's disposal
*
* @return true if there is an AST, false otherwise
*/
public boolean hasCompiledTree() {
return rootNode != null;
}
/**
* evaluates the given XPath expression against the current tree
*
* @param xPath XPath expression to be evaluated
* @param evaluator object which requests the evaluation
*/
public void evaluateXPathExpression(String xPath, Object evaluator)
throws ParseException, JaxenException {
XPath xpath = new BaseXPath(xPath, new DocumentNavigator());
evaluationResults = xpath.selectNodes(rootNode);
fireViewerModelEvent(new ViewerModelEvent(evaluator, ViewerModelEvent.PATH_EXPRESSION_EVALUATED));
}
/**
* retrieves the results of last evaluation
*
* @return a list containing the nodes selected by the last XPath expression
* evaluation
*/
public List getLastEvaluationResults() {
return evaluationResults;
}
/**
* selects the given node in the AST
*
* @param node node to be selected
* @param selector object which requests the selection
*/
public void selectNode(SimpleNode node, Object selector) {
fireViewerModelEvent(new ViewerModelEvent(selector, ViewerModelEvent.NODE_SELECTED, node));
}
/**
* appends the given fragment to the XPath expression
*
* @param pathFragment fragment to be added
* @param appender object that is trying to append the fragment
*/
public void appendToXPathExpression(String pathFragment, Object appender) {
fireViewerModelEvent(new ViewerModelEvent(appender, ViewerModelEvent.PATH_EXPRESSION_APPENDED, pathFragment));
}
/**
* adds a listener to the model
*
* @param l listener to be added
*/
public void addViewerModelListener(ViewerModelListener l) {
listeners.add(l);
}
/**
* removes the lisetener from the model
*
* @param l listener to be removed
*/
public void removeViewerModelListener(ViewerModelListener l) {
listeners.remove(l);
}
/**
* notifes all listener of a change in the model
*
* @param e change's reason
*/
protected void fireViewerModelEvent(ViewerModelEvent e) {
for (int i = 0; i < listeners.size(); i++) {
((ViewerModelListener) listeners.elementAt(i)).viewerModelChanged(e);
}
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.5 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.4 2004/04/12 17:35:09 tomcopeland
* Cleaned up imports
*
* Revision 1.3 2004/04/12 17:23:29 tomcopeland
* Moving all explicit JavaParser creations over to a factory-ish sort of thing. This makes the version of the parser explicit rather than assumed.
*
* Revision 1.2 2003/09/23 20:51:06 tomcopeland
* Cleaned up imports
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.3 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.2 2003/09/23 07:52:16 bgr
* menus added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,112 @@
package net.sourceforge.pmd.util.viewer.model;
/**
* The event which will be sent every time the model changes
* <p/>
* <p/>
* Note: the instances will be immutable
* </p>
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class ViewerModelEvent {
/**
* reason in the case of code recompilation
*/
public static final int CODE_RECOMPILED = 1;
/**
* reason in the case of node selection
*/
public static final int NODE_SELECTED = 2;
/**
* reason in the case of path extension
*/
public static final int PATH_EXPRESSION_APPENDED = 3;
/**
* reason in the case of path expression evaluation
*/
public static final int PATH_EXPRESSION_EVALUATED = 4;
private Object source;
private int reason;
private Object parameter;
/**
* Creates an event
*
* @param source event's source
* @param reason event's reason
*/
public ViewerModelEvent(Object source, int reason) {
this(source, reason, null);
}
/**
* Creates an event
*
* @param source event's source
* @param reason event's reason
* @param parameter parameter object
*/
public ViewerModelEvent(Object source, int reason, Object parameter) {
this.source = source;
this.reason = reason;
this.parameter = parameter;
}
/**
* retrieves the reason for event's occurance
*
* @return event's reason
*/
public int getReason() {
return reason;
}
/**
* retrieves the object which caused the event
*
* @return object that casused the event
*/
public Object getSource() {
return source;
}
/**
* retrieves event's parameter
*
* @return event's parameter
*/
public Object getParameter() {
return parameter;
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.2 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.3 2003/09/24 00:40:35 bgr
* evaluation results browsing added
*
* Revision 1.2 2003/09/23 07:52:16 bgr
* menus added
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,39 @@
package net.sourceforge.pmd.util.viewer.model;
/**
* identiefie a listener of the ViewerModel
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public interface ViewerModelListener {
/**
* DOCUMENT ME!
*
* @param e DOCUMENT ME!
*/
void viewerModelChanged(ViewerModelEvent e);
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.3 2004/12/22 20:52:12 tomcopeland
* Fixing some stuff PMD found
*
* Revision 1.2 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
@@ -0,0 +1,34 @@
##########################################################################
# english string translations for the viewer
#
##########################################################################
# Main Frame
MAIN.FRAME.TITLE = AST Viewer
MAIN.FRAME.COMPILE_BUTTON.TITLE = Compile
MAIN.FRAME.EVALUATE_BUTTON.TITLE = Evaluate XPath Expression
MAIN.FRAME.COMPILATION.TOOK = Compilation took
MAIN.FRAME.COMPILATION.PROBLEM = Compilation problem:
MAIN.FRAME.EVALUATION.TOOK = Evaluation took
MAIN.FRAME.EVALUATION.PROBLEM = Evaluation problem:
# Source Panel
SOURCE.PANEL.TITLE = Source code
# Tree Panel
AST.PANEL.TITLE = Abstract Syntax Tree
AST.MENU.ATTRIBUTES = Add predicate from {0}'a attributes
AST.MENU.NODE.TITLE = Add {0} to the XPath expression
AST.MENU.NODE.ADD_ABSOLUTE_PATH = Add with absolute path
AST.MENU.NODE.ADD_ALLDESCENDANTS = Add all descentands of this type
# XPath Panel
XPATH.PANEL.TITLE = XPath
XPATH.PANEL.EXPRESSION = Expression
XPATH.PANEL.RESULTS = Results
# Compile Error dialog
COMPILE_ERROR.DIALOG.TITLE = Compilation error
COMPILE_ERROR.PANEL.TITLE = Error message
COMPILE_ERROR.OK_BUTTON.CAPTION = Ok
@@ -0,0 +1,49 @@
package net.sourceforge.pmd.util.viewer.util;
import java.util.ResourceBundle;
/**
* helps with internationalization
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
public class NLS {
private final static ResourceBundle bundle;
static {
bundle =
ResourceBundle.getBundle("net.sourceforge.pmd.util.viewer.resources.viewer_strings");
}
/**
* translates the given key to the message
*
* @param key key to be translated
* @return translated string
*/
public static String nls(String key) {
return bundle.getString(key);
}
}
/*
* $Log$
* Revision 1.1 2005/08/15 19:51:42 tomcopeland
* Initial revision
*
* Revision 1.2 2004/09/27 19:42:52 tomcopeland
* A ridiculously large checkin, but it's all just code reformatting. Nothing to see here...
*
* Revision 1.1 2003/09/23 20:32:42 tomcopeland
* Added Boris Gruschko's new AST/XPath viewer
*
* Revision 1.1 2003/09/24 01:33:03 bgr
* moved to a new package
*
* Revision 1.1 2003/09/22 05:21:54 bgr
* initial commit
*
*/
+1 -2
View File
@@ -6,13 +6,12 @@
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
<relativePath/>
</parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-build</artifactId>
<name>PMD Build Plugin</name>
<version>0.9-SNAPSHOT</version>
<version>0.8-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<description>
<![CDATA[
@@ -7,7 +7,6 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -23,7 +22,6 @@ public class RuntimeRulePropertiesAnalyzer {
private Class<?> propertyDesc;
private Method nameMethod;
private Method descMethod;
private Method defaultValueMethod;
private Field propertiesField;
private Field propertiesValues;
@@ -38,7 +36,6 @@ public class RuntimeRulePropertiesAnalyzer {
propertyDesc = cl.loadClass("net.sourceforge.pmd.PropertyDescriptor");
nameMethod = propertyDesc.getDeclaredMethod("name");
descMethod = propertyDesc.getDeclaredMethod("description");
defaultValueMethod = propertyDesc.getDeclaredMethod("defaultValue");
propertiesField = propertySource.getDeclaredField("propertyDescriptors");
propertiesValues = propertySource.getDeclaredField("propertyValuesByDescriptor");
propertiesField.setAccessible(true);
@@ -90,19 +87,11 @@ public class RuntimeRulePropertiesAnalyzer {
for (Object o : properties) {
Object value = values.get(o);
if (value == null) {
value = defaultValueMethod.invoke(o);
}
Element propElem = document.createElement("property");
propElem.setAttribute("name", (String)nameMethod.invoke(o));
propElem.setAttribute("description", (String)descMethod.invoke(o));
if (value != null) {
String valueString = String.valueOf(value);
if (value.getClass().isArray()) {
valueString = Arrays.toString((Object[])value);
}
propElem.setAttribute("value", valueString);
propElem.setAttribute("value", String.valueOf(value));
}
propsElem.appendChild(propElem);
}
@@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
BSD-style license; for more info see http://pmd.sourceforge.net/license.html
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="root">
<xsl:comment>
THIS FILE HAS BEEN AUTOMATICLY GENERATED.
@@ -55,7 +55,7 @@
<xsl:with-param name="classname" select="$classname"/>
</xsl:call-template>
</xsl:variable>
<p><xsl:value-of select="$definedByJavaClass"/>: <a><xsl:attribute name="href"><xsl:value-of select="concat(concat('../../xref/',$classfile),'.html')"/></xsl:attribute><xsl:value-of select="@class"/></a>
<p><xsl:value-of select="$definedByJavaClass"/>:<a><xsl:attribute name="href"><xsl:value-of select="concat(concat('../../xref/',$classfile),'.html')"/></xsl:attribute><xsl:value-of select="@class"/></a>
</p>
</xsl:otherwise>
</xsl:choose>
@@ -29,9 +29,6 @@
</li>
</xsl:for-each>
</ul>
<xsl:variable name="urlPrefixLength"><xsl:value-of select="string-length('${pmd.website.baseurl}/rules/')"/></xsl:variable>
<xsl:for-each select="language">
<xsl:variable name="language"><xsl:value-of select="@name"/></xsl:variable>
<xsl:for-each select="ruleset">
@@ -44,11 +41,7 @@
<xsl:attribute name="name"><xsl:value-of select="@name"/> (<xsl:value-of select="$language"/>)</xsl:attribute>
<ul>
<xsl:for-each select="./rule[@name]">
<li>
<a>
<xsl:attribute name="href"><xsl:value-of select="substring(@externalInfoUrl,$urlPrefixLength + 1)"/></xsl:attribute>
<xsl:value-of select="@name"/>
</a>: <xsl:value-of select="description"/></li>
<li> <xsl:value-of select="@name"/>: <xsl:value-of select="description"/></li>
</xsl:for-each>
</ul>
</subsection>
@@ -29,11 +29,6 @@ public class AbstractPropertySource {
public String description() {
return description;
}
@Override
public Object defaultValue() {
return defaultValue;
}
};
propertyDescriptors.add(descriptor);
propertyValuesByDescriptor.put(descriptor, defaultValue);
@@ -11,5 +11,4 @@ public interface PropertyDescriptor {
String name();
String description();
Object defaultValue();
}
+89
View File
@@ -0,0 +1,89 @@
<project name="pmd-jbuilder" default="compile" basedir="../">
<property name="dir.lib" value="lib\"/>
<property name="dir.src" value="src\"/>
<property name="dir.build" value="build\"/>
<property name="version" value="1.0"/>
<property name="pmd.version" value="3.3"/>
<path id="dependencies.path">
<pathelement location="${dir.build}"/>
<fileset dir="${dir.lib}">
<include name="*.jar"/>
</fileset>
</path>
<target name="delete">
<delete dir="${dir.build}"/>
<delete file="${dir.lib}\PMDExtension.jar"/>
<mkdir dir="${dir.build}"/>
</target>
<target name="compile" description="Compiles the code">
<mkdir dir="${dir.build}"/>
<javac deprecation="false"
debug="true"
optimize="false"
srcdir="${dir.src}"
destdir="${dir.build}">
<classpath>
<path refid="dependencies.path"/>
</classpath>
</javac>
</target>
<target name="clean" depends="delete,compile" description="Does a complete recompile"/>
<target name="jar" depends="clean" description="Jars up the classes and rulesets">
<jar
jarfile="${dir.lib}\PMDExtension.jar"
includes="net/sourceforge/pmd/bluej/*.class"
basedir="${dir.build}">
<manifest>
<attribute name="Main-Class" value="net.sourceforge.pmd.bluej.PMDExtension"/>
<attribute name="Class-Path" value="pmd/pmd-${pmd.version}.jar pmd/jaxen-1.1-beta-7.jar"/>
</manifest>
</jar>
</target>
<target name="mergejars" depends="jar" description="Creates one uber-jar for easier deployment">
<unjar src="${dir.lib}/jaxen-1.1-beta-7.jar" dest="lib" overwrite="true"/>
<unjar src="${dir.lib}/pmd-${pmd.version}.jar" dest="lib" overwrite="true"/>
<unjar src="${dir.lib}/PMDExtension.jar" dest="lib" overwrite="true"/>
<delete file="${dir.lib}\PMDExtension.jar"/>
<jar
jarfile="${dir.lib}\PMDExtension.jar"
includes="net/**/*.*,org/**/*.*,META-INF/**/*.*,rulesets/**/*.*,"
basedir="${dir.lib}">
<manifest>
<attribute name="Main-Class" value="net.sourceforge.pmd.bluej.PMDExtension"/>
</manifest>
</jar>
<delete dir="${dir.lib}/net"/>
<delete dir="${dir.lib}/rulesets"/>
<delete dir="${dir.lib}/org"/>
<delete dir="${dir.lib}/test"/>
<delete dir="${dir.lib}/META-INF"/>
</target>
<target name="deploy" depends="mergejars" description="Deploys new jar file to my BlueJ install">
<copy todir="/home/tom/pmd/ides/bluej/lib/extensions">
<fileset dir="${dir.lib}">
<include name="PMDExtension.jar"/>
</fileset>
</copy>
</target>
<target name="deploysfserver" depends="mergejars" description="Deploys new jar file to my BlueJ install">
<echo message="Uploading jar file to SourceForge"/>
<exec executable="scp" os="Linux">
<arg line=" /home/tom/pmd/pmd-bluej/lib/PMDExtension.jar tomcopeland@pmd.sf.net:/home/groups/p/pm/pmd/htdocs/"/>
</exec>
<echo message="Uploading extensions.xml to SourceForge"/>
<exec executable="scp" os="Linux">
<arg line=" /home/tom/pmd/pmd-bluej/bin/extensions.xml tomcopeland@pmd.sf.net:/home/groups/p/pm/pmd/htdocs/"/>
</exec>
</target>
</project>
+2
View File
@@ -0,0 +1,2 @@
November 10, 2005 - 1.0:
Initial functionality - basic/unusedcode rules only, JDK 1.4 only, report is displayed in wonky JOptionPane.
Loaded 30 of 2137 files, more files were not shown because too many files have changed in this diff. Show more