forked from phoedos/pmd
Updated to NB trunk
SystemOption rewritten to use NbPreferences git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5115 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
- Requires NB6.0M9 or newer IDE build
|
||||
- [1722116] pmd.scan.Scanner.run fails with Netbeans 6.0
|
||||
|
||||
Version 1.9.1
|
||||
|
@ -1,11 +1,10 @@
|
||||
---++ BUILDING
|
||||
|
||||
The NetBeans IDE version 6.0M4 is currently used for the development of plugin.
|
||||
The NetBeans IDE version 6.0M9 is currently used for the development of plugin.
|
||||
Older version of harness (NB5.5) can fail to run tests.
|
||||
|
||||
Read the documentation of this support to get details about the
|
||||
configuration. For a quick setup it should be enough to copy
|
||||
the 'pmdsuite.properties.template' file into pmdsuite.properties' edit its
|
||||
content according to comments.
|
||||
configuration. Basically it tries to find Java platform called 'JDK 1.5' and
|
||||
NetBeans platform named 'NetBeans IDE M6.0M9'
|
||||
|
||||
Released plugin versions are built with JDK 1.5 and against NetBeans5.5.
|
||||
Released plugin versions are built with JDK 1.5 and against NetBeans6.0M9.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=dba7ea2d
|
||||
nbproject/build-impl.xml.data.CRC32=514f6da1
|
||||
nbproject/build-impl.xml.script.CRC32=209b78c0
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=3f8b4615
|
||||
|
@ -1,2 +1,2 @@
|
||||
nbjdk.active=JDK_1.5
|
||||
nbplatform.active=NetBeans_IDE_5.5
|
||||
nbplatform.active=NetBeans_IDE_6.0M9
|
||||
|
@ -77,8 +77,8 @@
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<release-version>0-1</release-version>
|
||||
<specification-version>1.3.1</specification-version>
|
||||
<release-version>1</release-version>
|
||||
<specification-version>1.5</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -135,14 +135,6 @@
|
||||
<specification-version>6.2</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.options</code-name-base>
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>6.2</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<code-name-base>org.openide.text</code-name-base>
|
||||
<build-prerequisite/>
|
||||
@ -156,7 +148,7 @@
|
||||
<build-prerequisite/>
|
||||
<compile-dependency/>
|
||||
<run-dependency>
|
||||
<specification-version>6.2</specification-version>
|
||||
<specification-version>7.4</specification-version>
|
||||
</run-dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -66,6 +66,7 @@ import org.openide.util.Lookup;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.actions.CookieAction;
|
||||
import pmd.config.ConfigUtils;
|
||||
import pmd.config.PMDOptionsSettings;
|
||||
import pmd.scan.EditorChangeListener;
|
||||
|
||||
/**
|
||||
@ -161,7 +162,7 @@ public class RunPMDAction extends CookieAction {
|
||||
List<Fault> list = new ArrayList<Fault>( 100 );
|
||||
|
||||
CancelCallback cancel = new CancelCallback();
|
||||
ProgressHandle prgHdl = ProgressHandleFactory.createHandle("PMD check", cancel); // PENDING action to show output
|
||||
ProgressHandle prgHdl = ProgressHandleFactory.createHandle("PMD check", cancel);
|
||||
prgHdl.start(dataobjects.size());
|
||||
try {
|
||||
for( int i = 0; i < dataobjects.size(); i++ ) {
|
||||
@ -303,7 +304,7 @@ public class RunPMDAction extends CookieAction {
|
||||
*/
|
||||
private static RuleSet constructRuleSets() {
|
||||
RuleSet rules = new RuleSet();
|
||||
List list = ConfigUtils.getRuleList();
|
||||
List list = PMDOptionsSettings.getDefault().getRuleList();
|
||||
Iterator iterator = list.iterator();
|
||||
while( iterator.hasNext() ) {
|
||||
rules.addRule( ( Rule )iterator.next() );
|
||||
|
@ -70,12 +70,12 @@ public class TableSorter extends AbstractTableModel {
|
||||
|
||||
private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
|
||||
|
||||
public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
return ((Comparable) o1).compareTo(o2);
|
||||
private static final Comparator COMPARABLE_COMPARATOR = new Comparator<Comparable>() {
|
||||
public int compare(Comparable o1, Comparable o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
};
|
||||
public static final Comparator LEXICAL_COMPARATOR = new Comparator() {
|
||||
private static final Comparator LEXICAL_COMPARATOR = new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
return o1.toString().compareTo(o2.toString());
|
||||
}
|
||||
@ -214,7 +214,7 @@ public class TableSorter extends AbstractTableModel {
|
||||
return comparator;
|
||||
}
|
||||
if (Comparable.class.isAssignableFrom(columnType)) {
|
||||
return COMPARABLE_COMAPRATOR;
|
||||
return COMPARABLE_COMPARATOR;
|
||||
}
|
||||
return LEXICAL_COMPARATOR;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
# DAMAGE.
|
||||
#
|
||||
|
||||
LBL_settings=PMD Settings
|
||||
PROP_rules=Rules
|
||||
HINT_rules=The rules that the PMD action uses
|
||||
Services/pmd-config-option.settings=PMD Settings
|
||||
|
@ -79,50 +79,34 @@ public abstract class ConfigUtils {
|
||||
extraFactories.remove(fact);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the list of rules to use. This is done by iterating over all
|
||||
* known rules and, for each one, checking whether its name appears in the
|
||||
* given string followed by a comma and a space. If it does appear, then it
|
||||
* is added to the list of rules to use, after setting any properties whose
|
||||
* defaults have been configured to be overridden, in
|
||||
* {@link PMDOptionsSettings}.{@link PMDOptionsSettings#getDefault getDefault()}.{@link PMDOptionsSettings#getRuleProperties getRuleProperties()}.
|
||||
*
|
||||
* @param rules a string containing the names of the rules to use, with a comma-and-space after each one (including the last).
|
||||
* @return a list containing the rules to use.
|
||||
*/
|
||||
public static List<Rule> createRuleList( String rules, Map<String, Map<String, String>> propOverrides ) {
|
||||
Iterator<Rule> iterator = getAllAvailableRules().iterator();
|
||||
List<Rule> list = new ArrayList<Rule>();
|
||||
while( iterator.hasNext() ) {
|
||||
Rule rule = iterator.next();
|
||||
if( rules.indexOf( rule.getName() + ", " ) > -1 ) {
|
||||
// add it, but first check for property overrides.
|
||||
Map<String, String> rulePropOverrides = propOverrides.get( rule.getName() );
|
||||
if(rulePropOverrides != null) {
|
||||
/**
|
||||
* Determines the list of rules to use. This is done by iterating over all
|
||||
* known rules and, for each one, checking whether its name appears in the
|
||||
* given string followed by a comma and a space. If it does appear, then it
|
||||
* is added to the list of rules to use, after setting any properties whose
|
||||
* defaults have been configured to be overridden, in
|
||||
* {@link PMDOptionsSettings}.{@link PMDOptionsSettings#getDefault getDefault()}.{@link PMDOptionsSettings#getRuleProperties getRuleProperties()}.
|
||||
*
|
||||
* @param rules a string containing the names of the rules to use, with a comma-and-space after each one (including the last).
|
||||
* @return a list containing the rules to use.
|
||||
*/
|
||||
public static List<Rule> createRuleList( String rules, Map<String, Map<String, String>> propOverrides ) {
|
||||
List<Rule> list = new ArrayList<Rule>();
|
||||
for (Rule rule: getAllAvailableRules()) {
|
||||
if( rules.contains( rule.getName() + ", " )) {
|
||||
// add it, but first check for property overrides.
|
||||
Map<String, String> rulePropOverrides = propOverrides.get( rule.getName() );
|
||||
if(rulePropOverrides != null) {
|
||||
for (Map.Entry<String, String> entry: rulePropOverrides.entrySet()) {
|
||||
rule.addProperty( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
list.add( rule );
|
||||
}
|
||||
}
|
||||
Collections.sort( list, new RuleComparator() );
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines the list of rules to use.
|
||||
* This just delegates to {@link #createRuleList} with the argument
|
||||
* {@link PMDOptionsSettings}.{@link PMDOptionsSettings#getDefault getDefault()}.{@link PMDOptionsSettings#getRules getRules()}.
|
||||
*
|
||||
* @return a list containing the rules to use. Each element of the list is an instance of {@link Rule}.
|
||||
*/
|
||||
public static List getRuleList() {
|
||||
return createRuleList( PMDOptionsSettings.getDefault().getRules(),
|
||||
PMDOptionsSettings.getDefault().getRuleProperties()
|
||||
);
|
||||
}
|
||||
rule.addProperty( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
}
|
||||
list.add( rule );
|
||||
}
|
||||
}
|
||||
Collections.sort( list, new RuleComparator() );
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ import java.util.List;
|
||||
* Represents a custom-rulesets configuration.
|
||||
*/
|
||||
public class CustomRuleSetSettings implements Serializable {
|
||||
/** The serialVersionUID. Don't change! */
|
||||
/** The serialVersionUID. */
|
||||
private final static long serialVersionUID = 8418202279212345678L;
|
||||
|
||||
/** Holds value of property ruleSets. */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
|
||||
<settings version="1.0">
|
||||
<module name="pmd"/>
|
||||
<instanceof class="org.openide.options.SystemOption"/>
|
||||
<instanceof class="pmd.config.PMDOptionsSettings"/>
|
||||
<instance class="pmd.config.PMDOptionsSettings"/>
|
||||
</settings>
|
@ -38,6 +38,8 @@ import pmd.config.PMDOptionsSettings;
|
||||
|
||||
/**
|
||||
* Classloader implementation for PMD custom rulesets.
|
||||
*
|
||||
* TODO: should be rewritten to have its resources rather than asks for all rulesets every time
|
||||
*/
|
||||
public class RuleClassLoader extends ClassLoader {
|
||||
|
||||
|
@ -9,12 +9,6 @@
|
||||
</file>
|
||||
</folder>
|
||||
</folder>
|
||||
<folder name="Services">
|
||||
<file name="pmd-config-option.settings" url="config/option.xml">
|
||||
<attr name="SystemFileSystem.localizingBundle" stringvalue="pmd.config.Bundle"/>
|
||||
<attr name="SystemFileSystem.icon" urlvalue="nbresloc:/pmd/resources/PMDOptionsSettingsIcon.gif"/>
|
||||
</file>
|
||||
</folder>
|
||||
<folder name="Menu">
|
||||
<folder name="Window">
|
||||
<attr name="ResultWindowOpenAction.shadow/pmd-ShowOutputWindowAction.shadow" boolvalue="true"/>
|
||||
|
@ -31,7 +31,6 @@ import java.beans.PropertyChangeListener;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.text.StyledDocument;
|
||||
import org.netbeans.editor.BaseDocument;
|
||||
import org.netbeans.editor.Registry;
|
||||
|
||||
|
Reference in New Issue
Block a user