Revision: 6517
http://pmd.svn.sourceforge.net/pmd/?rev=6517&view=rev
Author: xlv
Date: 2008-09-26 19:47:12 +0000 (Fri, 26 Sep 2008)
Log Message:
-----------
all rule examples displayed in Rule Configuration panel
Modified Paths:
--------------
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/CHANGELOG.txt
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/RELNOTES.txt
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/messages.properties
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/nl/fr/messages.properties
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/nls/StringKeys.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/RuleDialog.java
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/CHANGELOG.txt
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/CHANGELOG.txt 2008-09-26 19:10:25 UTC (rev 6516)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/CHANGELOG.txt 2008-09-26 19:47:12 UTC (rev 6517)
@@ -4,6 +4,8 @@
. PMD updated to v4.2.3
. plugin reorganization
+. code cleanup
+. all rule examples displayed in Rule Configuration panel
----------------------------------------------------------------------------------------
v3.2.4 - April 11 2008
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/RELNOTES.txt
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/RELNOTES.txt 2008-09-26 19:10:25 UTC (rev 6516)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/RELNOTES.txt 2008-09-26 19:47:12 UTC (rev 6517)
@@ -7,6 +7,8 @@
plugin reorganization
+code cleanup
+
v3.2.4 April 11 2008
------------------
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/messages.properties
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/messages.properties 2008-09-26 19:10:25 UTC (rev 6516)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/messages.properties 2008-09-26 19:47:12 UTC (rev 6517)
@@ -81,7 +81,7 @@
preference.ruleedit.label.priority = Priority :
preference.ruleedit.label.description = Description :
preference.ruleedit.label.external_info_url = External Info URL :
-preference.ruleedit.label.example = Example :
+preference.ruleedit.label.examples = Examples :
preference.ruleedit.label.xpath = XPath :
preference.ruleedit.button.rule_reference = Rule Reference
preference.ruleedit.button.xpath_rule = XPath rule
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/nl/fr/messages.properties
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/nl/fr/messages.properties 2008-09-26 19:10:25 UTC (rev 6516)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/nl/fr/messages.properties 2008-09-26 19:47:12 UTC (rev 6517)
@@ -81,7 +81,7 @@
preference.ruleedit.label.priority = Priorit\xE9 :
preference.ruleedit.label.description = Description :
preference.ruleedit.label.external_info_url = URL d'information externe :
-preference.ruleedit.label.example = Exemple :
+preference.ruleedit.label.examples = Exemples :
preference.ruleedit.label.xpath = XPath :
preference.ruleedit.button.rule_reference = R\xE8gle Reference
preference.ruleedit.button.xpath_rule = R\xE8gle XPath
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/nls/StringKeys.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/nls/StringKeys.java 2008-09-26 19:10:25 UTC (rev 6516)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/nls/StringKeys.java 2008-09-26 19:47:12 UTC (rev 6517)
@@ -190,7 +190,7 @@
public static final String MSGKEY_PREF_RULEEDIT_LABEL_PRIORITY = "preference.ruleedit.label.priority";
public static final String MSGKEY_PREF_RULEEDIT_LABEL_DESCRIPTION = "preference.ruleedit.label.description";
public static final String MSGKEY_PREF_RULEEDIT_LABEL_EXTERNAL_INFO_URL = "preference.ruleedit.label.external_info_url";
- public static final String MSGKEY_PREF_RULEEDIT_LABEL_EXAMPLE = "preference.ruleedit.label.example";
+ public static final String MSGKEY_PREF_RULEEDIT_LABEL_EXAMPLES = "preference.ruleedit.label.examples";
public static final String MSGKEY_PREF_RULEEDIT_LABEL_XPATH = "preference.ruleedit.label.xpath";
public static final String MSGKEY_PREF_RULEEDIT_BUTTON_RULE_REFERENCE = "preference.ruleedit.button.rule_reference";
public static final String MSGKEY_PREF_RULEEDIT_BUTTON_XPATH_RULE = "preference.ruleedit.button.xpath_rule";
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/RuleDialog.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/RuleDialog.java 2008-09-26 19:10:25 UTC (rev 6516)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/RuleDialog.java 2008-09-26 19:47:12 UTC (rev 6517)
@@ -2,6 +2,7 @@
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Iterator;
import net.sourceforge.pmd.Rule;
import net.sourceforge.pmd.RuleReference;
@@ -241,7 +242,7 @@
data.grabExcessHorizontalSpace = true;
externalInfoUrlText.setLayoutData(data);
- Label exampleLabel = buildLabel(dlgArea, StringKeys.MSGKEY_PREF_RULEEDIT_LABEL_EXAMPLE);
+ Label exampleLabel = buildLabel(dlgArea, StringKeys.MSGKEY_PREF_RULEEDIT_LABEL_EXAMPLES);
data = new GridData();
data.horizontalSpan = 4;
exampleLabel.setLayoutData(data);
@@ -605,18 +606,38 @@
}
/**
+ * Concatenate all the rule examples in one String.
+ *
+ * @return the concatenation of all example strings
+ */
+ private String getExamplesString() {
+ StringBuffer buffer = new StringBuffer();
+ Iterator i = this.editedRule.getExamples().iterator();
+ boolean first = true;
+ while (i.hasNext()) {
+ if (first) {
+ first = false;
+ } else {
+ buffer.append("\n\n");
+ }
+ buffer.append(((String)i.next()).trim());
+ }
+ return buffer.toString();
+ }
+
+ /**
* Build the example text
*/
private Text buildExampleText(Composite parent) {
Text text = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
text.setFont(courierFont);
if (mode == MODE_EDIT) {
- text.setText(this.editedRule.getExample().trim());
+ text.setText(getExamplesString());
}
if (mode == MODE_VIEW) {
text.setEditable(false);
- text.setText(this.editedRule.getExample().trim());
+ text.setText(getExamplesString());
}
return text;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|