diff --git a/pmd-netbeans/CHANGES.txt b/pmd-netbeans/CHANGES.txt index 2baa1a6652..b7665fd92c 100644 --- a/pmd-netbeans/CHANGES.txt +++ b/pmd-netbeans/CHANGES.txt @@ -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 diff --git a/pmd-netbeans/lib/BUILDING.txt b/pmd-netbeans/lib/BUILDING.txt index 07c0a1f944..3bf2c4d793 100644 --- a/pmd-netbeans/lib/BUILDING.txt +++ b/pmd-netbeans/lib/BUILDING.txt @@ -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. diff --git a/pmd-netbeans/nbproject/genfiles.properties b/pmd-netbeans/nbproject/genfiles.properties index 6c1f4af376..c222c2c6a7 100644 --- a/pmd-netbeans/nbproject/genfiles.properties +++ b/pmd-netbeans/nbproject/genfiles.properties @@ -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 diff --git a/pmd-netbeans/nbproject/platform.properties b/pmd-netbeans/nbproject/platform.properties index 0df0d823f7..589bcd1537 100644 --- a/pmd-netbeans/nbproject/platform.properties +++ b/pmd-netbeans/nbproject/platform.properties @@ -1,2 +1,2 @@ nbjdk.active=JDK_1.5 -nbplatform.active=NetBeans_IDE_5.5 +nbplatform.active=NetBeans_IDE_6.0M9 diff --git a/pmd-netbeans/nbproject/project.xml b/pmd-netbeans/nbproject/project.xml index a0938aad18..4ec970226f 100644 --- a/pmd-netbeans/nbproject/project.xml +++ b/pmd-netbeans/nbproject/project.xml @@ -77,8 +77,8 @@ - 0-1 - 1.3.1 + 1 + 1.5 @@ -135,14 +135,6 @@ 6.2 - - org.openide.options - - - - 6.2 - - org.openide.text @@ -156,7 +148,7 @@ - 6.2 + 7.4 diff --git a/pmd-netbeans/src/pmd/RunPMDAction.java b/pmd-netbeans/src/pmd/RunPMDAction.java index fa2bfcd388..c74361dafb 100644 --- a/pmd-netbeans/src/pmd/RunPMDAction.java +++ b/pmd-netbeans/src/pmd/RunPMDAction.java @@ -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 list = new ArrayList( 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() ); diff --git a/pmd-netbeans/src/pmd/TableSorter.java b/pmd-netbeans/src/pmd/TableSorter.java index 091b3238bb..15fffd1252 100644 --- a/pmd-netbeans/src/pmd/TableSorter.java +++ b/pmd-netbeans/src/pmd/TableSorter.java @@ -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() { + 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; } diff --git a/pmd-netbeans/src/pmd/config/Bundle.properties b/pmd-netbeans/src/pmd/config/Bundle.properties index bd03548dab..4f8b5cecce 100644 --- a/pmd-netbeans/src/pmd/config/Bundle.properties +++ b/pmd-netbeans/src/pmd/config/Bundle.properties @@ -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 diff --git a/pmd-netbeans/src/pmd/config/ConfigUtils.java b/pmd-netbeans/src/pmd/config/ConfigUtils.java index 2a118ed3eb..12b87ecc71 100644 --- a/pmd-netbeans/src/pmd/config/ConfigUtils.java +++ b/pmd-netbeans/src/pmd/config/ConfigUtils.java @@ -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 createRuleList( String rules, Map> propOverrides ) { - Iterator iterator = getAllAvailableRules().iterator(); - List list = new ArrayList(); - while( iterator.hasNext() ) { - Rule rule = iterator.next(); - if( rules.indexOf( rule.getName() + ", " ) > -1 ) { - // add it, but first check for property overrides. - Map 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 createRuleList( String rules, Map> propOverrides ) { + List list = new ArrayList(); + for (Rule rule: getAllAvailableRules()) { + if( rules.contains( rule.getName() + ", " )) { + // add it, but first check for property overrides. + Map rulePropOverrides = propOverrides.get( rule.getName() ); + if(rulePropOverrides != null) { for (Map.Entry 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; + } /** diff --git a/pmd-netbeans/src/pmd/config/CustomRuleSetSettings.java b/pmd-netbeans/src/pmd/config/CustomRuleSetSettings.java index e472ed5705..89e0595e30 100644 --- a/pmd-netbeans/src/pmd/config/CustomRuleSetSettings.java +++ b/pmd-netbeans/src/pmd/config/CustomRuleSetSettings.java @@ -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. */ diff --git a/pmd-netbeans/src/pmd/config/PMDOptionsSettings.java b/pmd-netbeans/src/pmd/config/PMDOptionsSettings.java index 5918e14d24..65ce88ff8b 100644 --- a/pmd-netbeans/src/pmd/config/PMDOptionsSettings.java +++ b/pmd-netbeans/src/pmd/config/PMDOptionsSettings.java @@ -26,24 +26,25 @@ */ package pmd.config; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; -import org.openide.options.SystemOption; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.prefs.BackingStoreException; +import java.util.prefs.Preferences; +import org.openide.util.NbPreferences; /** * Settings for the PMD-NetBeans module. */ -public class PMDOptionsSettings extends SystemOption { - - /** The serialVersionUID. Don't change! */ - private final static long serialVersionUID = 8418202279282091070L; +public class PMDOptionsSettings { /** The constant for the rules property. The String value of this property is a comma-separated list of * names of currently enabled rules. The names refer to the rule definitions in all rulesets returned by @@ -94,59 +95,60 @@ public class PMDOptionsSettings extends SystemOption { "AvoidReassigningParametersRule, OnlyOneReturn, UseSingletonRule, " + "DontImportJavaLang, UnusedImports, DuplicateImports, "; - // No constructor please! + /** Name of key for storing part of cumstom rulesets settings. */ + private static String PROP_INCLUDE_STD_RULES = "includeStdRules"; + + private static final String NODE_RULESETS = "rulesets"; + private static final String NODE_CLASSPATH = "classpath"; + + private static PMDOptionsSettings INSTANCE = new PMDOptionsSettings(); - /** Sets the default rulesets and initializes the option */ - protected void initialize() { - super.initialize(); - setRules(DEFAULT_RULES); - // OK to initialize with an empty map, we'll never expose it (always return a HashMap copy) - setRuleProperties(Collections.>emptyMap()); - setRulesets(new CustomRuleSetSettings()); - setScanEnabled(Boolean.FALSE); - setScanInterval(new Integer(DEFAULT_SCAN_INTERVAL)); - } + /** + * Default instance of this system option, for the convenience of associated + * classes. + * + * @return The default value + */ + public static PMDOptionsSettings getDefault() { + return INSTANCE; + } + + private transient PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + /* Sets the default rulesets and initializes the option */ + private PMDOptionsSettings() { + } + + private final String getProperty(String key) { + return NbPreferences.forModule(PMDOptionsSettings.class).get(key, null); + } + + private final void putProperty(String key, String value) { + Preferences pref = NbPreferences.forModule(PMDOptionsSettings.class); + if (value != null) { + pref.put(key, value); + } else { + NbPreferences.forModule(PMDOptionsSettings.class).remove(key); + } + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + pcs.addPropertyChangeListener(l); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + pcs.removePropertyChangeListener(l); + } - /** - * Returns the displayName of these options - * - * @return the displayname - */ - public String displayName() { - return NbBundle.getMessage( PMDOptionsSettings.class, "LBL_settings" ); - } - - - /** - * Returns the default help - * - * @return The helpCtx value - */ - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - - /** - * Default instance of this system option, for the convenience of associated - * classes. - * - * @return The default value - */ - public static PMDOptionsSettings getDefault() { - return ( PMDOptionsSettings )findObject( PMDOptionsSettings.class, true ); - } - - - /** - * Returns the rulesets property - * - * @return the rulesets property - */ - public String getRules() { - return ( String )getProperty( PROP_RULES ); - } + /** + * Returns the rulesets property + * + * @return the rulesets property + */ + public String getRules() { + return NbPreferences.forModule(PMDOptionsSettings.class).get(PROP_RULES, DEFAULT_RULES); + } /** * Sets the rulesets property @@ -154,93 +156,211 @@ public class PMDOptionsSettings extends SystemOption { * @param rules The new rules value */ public void setRules( String rules ) { - putProperty( PROP_RULES, rules, true ); + putProperty( PROP_RULES, rules ); + pcs.firePropertyChange(PROP_RULES, null, null); } - /** - * Returns the rule properties property. See {@link #PROP_RULE_PROPERTIES}. - * Note: this returns a non-live deep copy of the rule properties map; - * changes to the map or its contents will not affect the PMD settings until you - * call {@link #setRuleProperties} with the modified map. - *

- * This is my nice naive way to observe correct property change event handling. It - * gets inefficient as the set of rule properties gets large ... but the set of - * rule properties generally doesn't get large because it really only - * contains overrides of the PMD default rule properties. - *

- * IMPLEMENTATION NOTE: the deep copy operation recurses into all Map and Collection - * values, so circular references will kill it. Make sure you put only simple data - * in the rule properties! Also, note that non-Map, non-Collection values are not - * cloned; the assumption is that the leaves of this hierarchy (actual rule property - * values) are always immutable objects, most likely just strings. - * - * @return the rule properties, not null. - */ - public Map> getRuleProperties() { - return deepMapCopy((Map>)getProperty(PROP_RULE_PROPERTIES)); - } + /** + * 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 List getRuleList() { + return ConfigUtils.createRuleList( getRules(), getRuleProperties()); + } + + + /** + * Returns the rule properties property. See {@link #PROP_RULE_PROPERTIES}. + * Note: this returns a non-live deep copy of the rule properties map; + * changes to the map or its contents will not affect the PMD settings until you + * call {@link #setRuleProperties} with the modified map. + *

+ * IMPLEMENTATION NOTE: the deep copy operation recurses into all Map and Collection + * values, so circular references will kill it. Make sure you put only simple data + * in the rule properties! Also, note that non-Map, non-Collection values are not + * cloned; the assumption is that the leaves of this hierarchy (actual rule property + * values) are always immutable objects, most likely just strings. + * + * @return the rule properties, not null. + */ + public Map> getRuleProperties() { + Map> ruleProps = new HashMap>(); + try { + Preferences prefs = NbPreferences.forModule(PMDOptionsSettings.class); + // 1. delete all old properties that are no longer valid + for (String keyName: prefs.keys()) { + if (!keyName.startsWith(PROP_RULE_PROPERTIES+'.')) + continue; + int idx = keyName.indexOf(".", PROP_RULE_PROPERTIES.length()+2); + if (idx == -1) + continue; + String ruleName = keyName.substring(PROP_RULE_PROPERTIES.length()+1, idx - 1); + Map props = ruleProps.get(ruleName); + if (props == null) { + props = new HashMap(); + ruleProps.put(ruleName, props); + } + String propName = keyName.substring(idx+1); + props.put(propName, prefs.get(keyName, null)); + } + } catch (BackingStoreException bse) { + Logger.getLogger(PMDOptionsSettings.class.getName()).log(Level.INFO, "Error when storing preferences", bse); + } + return ruleProps; + } - /** - * Sets the rule properties property (sorry). See {@link #PROP_RULE_PROPERTIES}. - * See also the constraints on rule property values and the ban on circular references, - * in the documentation for {@link #getRuleProperties}. - * - * @param ruleProperties The new rule properties map, not null. In this Map, each key must be - * a String, the name of a PMD rule, and each value must be a Map, specifying the properties - * for that rule. - */ - public void setRuleProperties(Map> ruleProperties) { - putProperty( PROP_RULE_PROPERTIES, ruleProperties, true ); - } + /** + * Sets the rule properties property (sorry). See {@link #PROP_RULE_PROPERTIES}. + * See also the constraints on rule property values and the ban on circular references, + * in the documentation for {@link #getRuleProperties}. + * + * @param ruleProperties The new rule properties map, not null. In this Map, each key must be + * a String, the name of a PMD rule, and each value must be a Map, specifying the properties + * for that rule. + */ + public void setRuleProperties(Map> ruleProperties) { + try { + Preferences prefs = NbPreferences.forModule(PMDOptionsSettings.class); + // 1. delete all old properties that are no longer valid + for (String keyName: prefs.keys()) { + if (!keyName.startsWith(PROP_RULE_PROPERTIES+'.')) + continue; + int idx = keyName.indexOf(".", PROP_RULE_PROPERTIES.length()+2); + if (idx == -1) + continue; + String ruleName = keyName.substring(PROP_RULE_PROPERTIES.length()+1, idx - 1); + String propName = keyName.substring(idx+1); + if (ruleProperties.get(ruleName) != null && ruleProperties.get(ruleName).get(propName) == null) { + prefs.remove(keyName); + } + } - /** Getter for property rulesets. - * @return Value of property rulesets. - * - */ - public CustomRuleSetSettings getRulesets() { - return (CustomRuleSetSettings)getProperty( PROP_RULESETS ); - } - - /** Setter for property rulesets. - * @param rulesets New value of property rulesets. - * - */ - public void setRulesets(CustomRuleSetSettings rulesets) { - putProperty( PROP_RULESETS, rulesets, true ); - } - - /** Getter for property scanEnabled. - * @return Value of property scanEnabled. - * - */ - public Boolean isScanEnabled() { - return (Boolean)getProperty( PROP_ENABLE_SCAN ); - } - - /** Setter for property scanEnabled. - * @param scanEnabled New value of property scanEnabled. - * - */ - public void setScanEnabled(Boolean scanEnabled) { - putProperty( PROP_ENABLE_SCAN, scanEnabled, true ); - } - - /** Getter for property scanInterval. - * @return Value of property scanInterval. - * - */ - public Integer getScanInterval() { - return (Integer)getProperty( PROP_SCAN_INTERVAL); - } - - /** Setter for property scanInterval. - * @param scanInterval New value of property scanInterval. - * - */ - public void setScanInterval(Integer scanInterval) { - putProperty( PROP_SCAN_INTERVAL, scanInterval ); - } + // 2. set current ones + for (Map.Entry> ruleProp: ruleProperties.entrySet()) { + String ruleName = ruleProp.getKey(); + for (Map.Entry prop: ruleProp.getValue().entrySet()) { + prefs.put(PROP_RULE_PROPERTIES+'.'+ruleName+'.'+prop.getKey(), prop.getValue()); + } + } + pcs.firePropertyChange(PROP_RULE_PROPERTIES, null, null); + } catch (BackingStoreException bse) { + Logger.getLogger(PMDOptionsSettings.class.getName()).log(Level.INFO, "Error when storing preferences", bse); + } + } + + /** Getter for property rulesets. + * @return Value of property rulesets. + * + */ + public CustomRuleSetSettings getRulesets() { + CustomRuleSetSettings crss = new CustomRuleSetSettings(); + try { + crss.setIncludeStdRules(Boolean.valueOf(getProperty(PROP_INCLUDE_STD_RULES))); + + Preferences prefs = NbPreferences.forModule(PMDOptionsSettings.class); + if (prefs.nodeExists(NODE_RULESETS)) { + List rulesets = new ArrayList(); + for (String s: prefs.node(NODE_RULESETS).keys()) { + rulesets.add(s); + } + crss.setRuleSets(rulesets); + } + + if (prefs.nodeExists(NODE_CLASSPATH)) { + List cp = new ArrayList(); + for (String s: prefs.node(NODE_CLASSPATH).keys()) { + cp.add(s); + } + crss.setClassPath(cp); + } + + } catch (BackingStoreException bse) { + Logger.getLogger(PMDOptionsSettings.class.getName()).log(Level.INFO, "Error when reading preferences", bse); + } + return crss; + } + + /** Setter for property rulesets. + * @param rulesets New value of property rulesets. + * + */ + public void setRulesets(CustomRuleSetSettings rulesets) { + try { + putProperty( PROP_INCLUDE_STD_RULES, Boolean.toString(rulesets.isIncludeStdRules()) ); + + List r = rulesets.getRuleSets(); + Preferences prefs = NbPreferences.forModule(PMDOptionsSettings.class); + if (r.isEmpty() && prefs.nodeExists(NODE_RULESETS)) { + prefs.node(NODE_RULESETS).removeNode(); + } + else { + Preferences rsPref = prefs.node(NODE_RULESETS); + for (String key: rsPref.keys()) { + rsPref.remove(key); + } + for(String s: r) { + rsPref.put(s, s); + } + } + + @SuppressWarnings("unchecked") + List cp = rulesets.getClassPath(); + if (r.isEmpty() && prefs.nodeExists(NODE_CLASSPATH)) { + prefs.node(NODE_CLASSPATH).removeNode(); + } + else { + Preferences rsPref = prefs.node(NODE_CLASSPATH); + for (String key: rsPref.keys()) { + rsPref.remove(key); + } + for(String s: r) { + rsPref.put(s, s); + } + } + + } catch (BackingStoreException bse) { + Logger.getLogger(PMDOptionsSettings.class.getName()).log(Level.INFO, "Error when storing preferences", bse); + } + pcs.firePropertyChange(PROP_RULESETS, null, null); + } + /** Getter for property scanEnabled. + * @return Value of property scanEnabled. + * + */ + public Boolean isScanEnabled() { + return NbPreferences.forModule(PMDOptionsSettings.class).getBoolean(PROP_ENABLE_SCAN, false); + } + + /** Setter for property scanEnabled. + * @param scanEnabled New value of property scanEnabled. + * + */ + public void setScanEnabled(Boolean scanEnabled) { + NbPreferences.forModule(PMDOptionsSettings.class).putBoolean(PROP_ENABLE_SCAN, scanEnabled); + pcs.firePropertyChange(PROP_ENABLE_SCAN, null, null); + } + + /** Getter for property scanInterval. + * @return Value of property scanInterval. + * + */ + public Integer getScanInterval() { + return NbPreferences.forModule(PMDOptionsSettings.class).getInt(PROP_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL); + } + + /** Setter for property scanInterval. + * @param scanInterval New value of property scanInterval. + * + */ + public void setScanInterval(Integer scanInterval) { + NbPreferences.forModule(PMDOptionsSettings.class).putInt(PROP_SCAN_INTERVAL, scanInterval); + pcs.firePropertyChange(PROP_SCAN_INTERVAL, null, null); + } + /** * Performs a deep-copy operation on the given map, recursing into all values that are Maps or * Collections. Note that this is risky; if the map/collection hierarchy contains circular references, diff --git a/pmd-netbeans/src/pmd/config/option.xml b/pmd-netbeans/src/pmd/config/option.xml deleted file mode 100644 index 9afddb70f7..0000000000 --- a/pmd-netbeans/src/pmd/config/option.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/pmd-netbeans/src/pmd/custom/RuleClassLoader.java b/pmd-netbeans/src/pmd/custom/RuleClassLoader.java index 098c1befc4..fc58cb4524 100644 --- a/pmd-netbeans/src/pmd/custom/RuleClassLoader.java +++ b/pmd-netbeans/src/pmd/custom/RuleClassLoader.java @@ -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 { diff --git a/pmd-netbeans/src/pmd/mf-layer.xml b/pmd-netbeans/src/pmd/mf-layer.xml index b21f24e2f3..6ac3c17fed 100644 --- a/pmd-netbeans/src/pmd/mf-layer.xml +++ b/pmd-netbeans/src/pmd/mf-layer.xml @@ -9,12 +9,6 @@ - - - - - - diff --git a/pmd-netbeans/src/pmd/scan/EditorChangeListener.java b/pmd-netbeans/src/pmd/scan/EditorChangeListener.java index 152243754d..f67108f495 100644 --- a/pmd-netbeans/src/pmd/scan/EditorChangeListener.java +++ b/pmd-netbeans/src/pmd/scan/EditorChangeListener.java @@ -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;