all rule examples displayed in Rule Configuration panel
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6517 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -4,6 +4,8 @@ v3.2.5
|
||||
|
||||
. PMD updated to v4.2.3
|
||||
. plugin reorganization
|
||||
. code cleanup
|
||||
. all rule examples displayed in Rule Configuration panel
|
||||
|
||||
----------------------------------------------------------------------------------------
|
||||
v3.2.4 - April 11 2008
|
||||
|
@ -7,6 +7,8 @@ PMD to 4.2.3
|
||||
|
||||
plugin reorganization
|
||||
|
||||
code cleanup
|
||||
|
||||
v3.2.4 April 11 2008
|
||||
------------------
|
||||
|
||||
|
@ -81,7 +81,7 @@ preference.ruleedit.label.message = Message :
|
||||
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
|
||||
|
@ -81,7 +81,7 @@ preference.ruleedit.label.message = Message :
|
||||
preference.ruleedit.label.priority = Priorité :
|
||||
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ègle Reference
|
||||
preference.ruleedit.button.xpath_rule = Règle XPath
|
||||
|
@ -190,7 +190,7 @@ public class StringKeys {
|
||||
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";
|
||||
|
@ -2,6 +2,7 @@ package net.sourceforge.pmd.ui.preferences;
|
||||
|
||||
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 @@ public class RuleDialog extends Dialog {
|
||||
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);
|
||||
@ -604,6 +605,26 @@ public class RuleDialog extends Dialog {
|
||||
return button;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@ -611,12 +632,12 @@ public class RuleDialog extends Dialog {
|
||||
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;
|
||||
|
Reference in New Issue
Block a user