Display rule description along with example.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6973 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Dale Anson
2009-07-25 05:22:48 +00:00
parent 067c322be7
commit 3dddbb2a54
3 changed files with 9 additions and 3 deletions

View File

@ -3,7 +3,7 @@
# #
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.name=PMDPlugin plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.name=PMDPlugin
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.author=Jiger Patel, Tom Copeland, Alan Ezust, Dale Anson plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.author=Jiger Patel, Tom Copeland, Alan Ezust, Dale Anson
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.version=3.0.1 plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.version=3.1
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.docs=doc/jedit.html plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.docs=doc/jedit.html
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.0=jdk 1.5 plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.0=jdk 1.5
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.1=jedit 04.03.03.00 plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.1=jedit 04.03.03.00

View File

@ -65,6 +65,10 @@ As of version 3.0, the PMD Plugin provides access to the PMD Rule Designer, whic
<a name="releasenotes"></a> <a name="releasenotes"></a>
<h2>Release Notes &amp; Changelog</h2> <h2>Release Notes &amp; Changelog</h2>
<h3>3.1 (Dale Anson)</h3>
<ol>
<li>Display rule description along with example.</li>
</ol>
<h3>3.0 (Dale Anson)</h3> <h3>3.0 (Dale Anson)</h3>
<ol> <ol>
<li>Split the option pane into smaller panes so they are easier to use.</li> <li>Split the option pane into smaller panes so they are easier to use.</li>

View File

@ -25,7 +25,7 @@ public class PMDRulesOptionPane extends AbstractOptionPane implements OptionPane
SelectedRules rules; SelectedRules rules;
JTextArea exampleTextArea = new JTextArea( 15, 60 ); JTextArea exampleTextArea = new JTextArea( 15, 90 );
JTextField txtCustomRules; JTextField txtCustomRules;
CheckboxTree tree; CheckboxTree tree;
JCheckBox useDefaultRules; JCheckBox useDefaultRules;
@ -144,10 +144,12 @@ public class PMDRulesOptionPane extends AbstractOptionPane implements OptionPane
Object userObject = node.getUserObject(); Object userObject = node.getUserObject();
if ( userObject instanceof RuleNode ) { if ( userObject instanceof RuleNode ) {
changeExampleLabel( "Example" ); changeExampleLabel( "Example" );
String description = ( ( RuleNode ) userObject ).getRule().getDescription();
description = description.trim();
List<String> examples = ( ( RuleNode ) userObject ).getRule().getExamples(); List<String> examples = ( ( RuleNode ) userObject ).getRule().getExamples();
exampleTextArea.setLineWrap( false ); exampleTextArea.setLineWrap( false );
exampleTextArea.setWrapStyleWord( false ); exampleTextArea.setWrapStyleWord( false );
exampleTextArea.setText( StringList.join( examples, "\n---------\n" ) ); exampleTextArea.setText( description + StringList.join( examples, "\n---------\n" ) );
exampleTextArea.setCaretPosition( 0 ); exampleTextArea.setCaretPosition( 0 );
} }
else if ( userObject instanceof RuleSetNode ) { else if ( userObject instanceof RuleSetNode ) {