forked from phoedos/pmd
New option dialog
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1256 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -34,13 +34,13 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.pmd.PMD;
|
||||
import net.sourceforge.pmd.Report;
|
||||
import net.sourceforge.pmd.Rule;
|
||||
import net.sourceforge.pmd.RuleContext;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
import net.sourceforge.pmd.RuleSetFactory;
|
||||
import net.sourceforge.pmd.RuleSetNotFoundException;
|
||||
import net.sourceforge.pmd.RuleViolation;
|
||||
|
||||
import org.openide.TopManager;
|
||||
@ -57,6 +57,7 @@ import org.openide.windows.InputOutput;
|
||||
import org.openide.windows.OutputWriter;
|
||||
|
||||
import pmd.config.PMDOptionsSettings;
|
||||
import pmd.config.ui.SelectedListModel;
|
||||
|
||||
/**
|
||||
* Action that can always be invoked and work procedurally.
|
||||
@ -222,15 +223,17 @@ public class RunPMDAction extends CookieAction {
|
||||
* @see pmd.config.PMDOptionsSettings#getRulesets()
|
||||
*/
|
||||
private static RuleSet constructRuleSets() {
|
||||
RuleSet rules = null;
|
||||
try {
|
||||
RuleSetFactory ruleSetFactory = new RuleSetFactory();
|
||||
rules = ruleSetFactory.createRuleSet(
|
||||
PMDOptionsSettings.getDefault().getRulesets() );
|
||||
}
|
||||
catch( RuleSetNotFoundException rsnfe ) {
|
||||
TopManager.getDefault().getErrorManager().notify( rsnfe );
|
||||
}
|
||||
RuleSet rules = new RuleSet();
|
||||
|
||||
|
||||
|
||||
SelectedListModel.getSelectedListModelInstance().setData( PMDOptionsSettings.getDefault().getRules() );
|
||||
List list = SelectedListModel.getSelectedListModelInstance().getData();
|
||||
Iterator iterator = list.iterator();
|
||||
while( iterator.hasNext() ) {
|
||||
rules.addRule( (Rule)iterator.next() );
|
||||
}
|
||||
|
||||
return rules;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Options API
|
||||
LBL_settings=PMD Settings
|
||||
PROP_rulesets=Rulesets
|
||||
HINT_rulesets=The rulesets that the pmd action uses
|
||||
PROP_rules=Rules
|
||||
HINT_rules=The rules that the pmd action uses
|
||||
Services/pmd-config-option.settings=\PMD Settings
|
||||
UI/Services/IDEConfiguration/ServerAndExternalToolSettings/pmd-config-option.shadow=link
|
||||
|
@ -38,18 +38,19 @@ import org.openide.util.NbBundle;
|
||||
*/
|
||||
public class PMDOptionsSettings extends SystemOption {
|
||||
|
||||
// private static final long serialVersionUID = ...;
|
||||
private static final long serialVersionUID = 8418202279282091070L;
|
||||
|
||||
/** The constant for the rulesets property */
|
||||
public final static String PROP_RULESETS = "rulesets";
|
||||
|
||||
/** The constant for the rulesets property */
|
||||
public final static String PROP_RULES = "rules";
|
||||
|
||||
// No constructor please!
|
||||
|
||||
/** Sets the default rulesets and initializes the option */
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
setRulesets( "rulesets/basic.xml,rulesets/imports.xml,rulesets/unusedcode.xml,rulesets/braces.xml,rulesets/design.xml,rulesets/strings.xml" );
|
||||
setRulesets("");
|
||||
}
|
||||
|
||||
|
||||
@ -91,6 +92,7 @@ public class PMDOptionsSettings extends SystemOption {
|
||||
*/
|
||||
public String getRulesets() {
|
||||
return ( String )getProperty( PROP_RULESETS );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -102,4 +104,25 @@ public class PMDOptionsSettings extends SystemOption {
|
||||
public void setRulesets( String rulesets ) {
|
||||
putProperty( PROP_RULESETS, rulesets, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rulesets property
|
||||
*
|
||||
* @return the rulesets property
|
||||
*/
|
||||
public String getRules() {
|
||||
return ( String )getProperty( PROP_RULES );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the rulesets property
|
||||
*
|
||||
* @param rulesets the rulesets value to set
|
||||
*/
|
||||
public void setRules( String rules) {
|
||||
putProperty( PROP_RULES, rules, true );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,11 +30,14 @@ import java.awt.Image;
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.IntrospectionException;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.beans.PropertyEditorManager;
|
||||
import java.beans.SimpleBeanInfo;
|
||||
|
||||
import org.openide.TopManager;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.Utilities;
|
||||
import pmd.config.ui.RuleEditor;
|
||||
import pmd.config.ui.RuleEnabler;
|
||||
|
||||
/**
|
||||
* Description of {@link PMDOptionsSettings}.
|
||||
@ -50,11 +53,13 @@ public class PMDOptionsSettingsBeanInfo extends SimpleBeanInfo {
|
||||
* @return the description of the rulesets property
|
||||
*/
|
||||
public PropertyDescriptor[] getPropertyDescriptors() {
|
||||
PropertyEditorManager.registerEditor( PMDOptionsSettingsBeanInfo.class, RuleEditor.class );
|
||||
try {
|
||||
PropertyDescriptor rulesets = new PropertyDescriptor( "rulesets", PMDOptionsSettings.class );
|
||||
rulesets.setDisplayName( NbBundle.getMessage( PMDOptionsSettingsBeanInfo.class, "PROP_rulesets" ) );
|
||||
rulesets.setShortDescription( NbBundle.getMessage( PMDOptionsSettingsBeanInfo.class, "HINT_rulesets" ) );
|
||||
return new PropertyDescriptor[]{rulesets};
|
||||
PropertyDescriptor rules = new PropertyDescriptor( "rules", PMDOptionsSettings.class, "getRules", "setRules" );
|
||||
rules.setDisplayName( NbBundle.getMessage( PMDOptionsSettingsBeanInfo.class, "PROP_rules" ) );
|
||||
rules.setShortDescription( NbBundle.getMessage( PMDOptionsSettingsBeanInfo.class, "HINT_rules" ) );
|
||||
rules.setPropertyEditorClass( RuleEditor.class );
|
||||
return new PropertyDescriptor[]{rules};
|
||||
}
|
||||
catch( IntrospectionException ie ) {
|
||||
TopManager.getDefault().getErrorManager().notify( ie );
|
||||
|
145
pmd-netbeans/src/pmd/config/ui/AvailableListModel.java
Normal file
145
pmd-netbeans/src/pmd/config/ui/AvailableListModel.java
Normal file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* ListModel.java
|
||||
*
|
||||
* Created on 14. november 2002, 21:26
|
||||
*/
|
||||
package pmd.config.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.swing.AbstractListModel;
|
||||
|
||||
|
||||
import net.sourceforge.pmd.Rule;
|
||||
import net.sourceforge.pmd.RuleSet;
|
||||
import net.sourceforge.pmd.RuleSetFactory;
|
||||
import net.sourceforge.pmd.RuleSetNotFoundException;
|
||||
|
||||
/**
|
||||
* @author ole martin mørk
|
||||
* @created 16. november 2002
|
||||
*/
|
||||
public class AvailableListModel extends AbstractListModel {
|
||||
private static AvailableListModel listmodel = new AvailableListModel();
|
||||
private List list = new ArrayList();
|
||||
|
||||
|
||||
/**
|
||||
* Gets the instance attribute of the AvailableListModel class
|
||||
*
|
||||
* @return The instance value
|
||||
*/
|
||||
public static AvailableListModel getInstance() {
|
||||
return listmodel;
|
||||
}
|
||||
|
||||
|
||||
/** Creates a new instance of ListModel */
|
||||
protected AvailableListModel() {
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the elementAt attribute of the AvailableListModel object
|
||||
*
|
||||
* @param param Description of the Parameter
|
||||
* @return The elementAt value
|
||||
*/
|
||||
public Object getElementAt( int param ) {
|
||||
return ( ( Rule )list.get( param ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the size attribute of the AvailableListModel object
|
||||
*
|
||||
* @return The size value
|
||||
*/
|
||||
public int getSize() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the list attribute of the AvailableListModel object
|
||||
*
|
||||
* @param list The new list value
|
||||
*/
|
||||
public void setList( List list ) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param o Description of the Parameter
|
||||
*/
|
||||
public void add( Object o ) {
|
||||
if( !list.contains( o ) ) {
|
||||
list.add( ( Rule )o );
|
||||
fireIntervalAdded( this, list.size(), list.size() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @param o Description of the Parameter
|
||||
*/
|
||||
public void remove( Object o ) {
|
||||
int i = list.indexOf( o );
|
||||
list.remove( o );
|
||||
fireIntervalRemoved( this, i, i );
|
||||
}
|
||||
|
||||
|
||||
/** Description of the Method */
|
||||
public void removeAll() {
|
||||
int i = list.size();
|
||||
list.clear();
|
||||
fireIntervalRemoved( this, 0, i );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a feature to the All attribute of the AvailableListModel object
|
||||
*
|
||||
* @param coll The feature to be added to the All attribute
|
||||
*/
|
||||
public void addAll( Collection coll ) {
|
||||
int i = list.size();
|
||||
list.addAll( coll );
|
||||
fireIntervalAdded( this, i, list.size() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the data attribute of the AvailableListModel object
|
||||
*
|
||||
* @return The data value
|
||||
*/
|
||||
public List getData() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
try {
|
||||
RuleSetFactory ruleSetFactory = new RuleSetFactory();
|
||||
Iterator iterator = ruleSetFactory.getRegisteredRuleSets();
|
||||
while( iterator.hasNext() ) {
|
||||
RuleSet ruleset = ( RuleSet )iterator.next();
|
||||
Set rules = ruleset.getRules();
|
||||
addAll( rules );
|
||||
}
|
||||
}
|
||||
catch( RuleSetNotFoundException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
41
pmd-netbeans/src/pmd/config/ui/ListCell.java
Normal file
41
pmd-netbeans/src/pmd/config/ui/ListCell.java
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* ListCellRenderer.java
|
||||
*
|
||||
* Created on 14. november 2002, 21:46
|
||||
*/
|
||||
package pmd.config.ui;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.ListCellRenderer;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import net.sourceforge.pmd.Rule;
|
||||
|
||||
/**
|
||||
* @author ole martin mørk
|
||||
* @created 16. november 2002
|
||||
*/
|
||||
public class ListCell implements ListCellRenderer {
|
||||
|
||||
|
||||
/**
|
||||
* Gets the listCellRendererComponent attribute of the ListCell object
|
||||
*
|
||||
* @param jList Description of the Parameter
|
||||
* @param obj Description of the Parameter
|
||||
* @param param Description of the Parameter
|
||||
* @param param3 Description of the Parameter
|
||||
* @param param4 Description of the Parameter
|
||||
* @return The listCellRendererComponent value
|
||||
*/
|
||||
public java.awt.Component getListCellRendererComponent(
|
||||
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Rule rule = ( Rule )value;
|
||||
JLabel box = new JLabel( rule.getName() );
|
||||
box.setEnabled( true );
|
||||
box.setBorder( isSelected ? UIManager.getBorder( "List.focusCellHighlightBorder" ) : new EmptyBorder( 1, 1, 1, 1 ) );
|
||||
return box;
|
||||
}
|
||||
|
||||
}
|
92
pmd-netbeans/src/pmd/config/ui/RuleEditor.java
Normal file
92
pmd-netbeans/src/pmd/config/ui/RuleEditor.java
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* RuleEditor.java
|
||||
*
|
||||
* Created on 18. november 2002, 21:50
|
||||
*/
|
||||
package pmd.config.ui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.sourceforge.pmd.Rule;
|
||||
|
||||
/**
|
||||
* @author ole martin mørk
|
||||
* @created 18. november 2002
|
||||
*/
|
||||
public class RuleEditor extends PropertyEditorSupport {
|
||||
|
||||
/**
|
||||
* Gets the customEditor attribute of the RuleEditor object
|
||||
*
|
||||
* @return The customEditor value
|
||||
*/
|
||||
public Component getCustomEditor() {
|
||||
return new RuleEnabler( this );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Description of the Method
|
||||
*
|
||||
* @return Description of the Return Value
|
||||
*/
|
||||
public boolean supportsCustomEditor() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value attribute of the RuleEditor object
|
||||
*
|
||||
* @return The value value
|
||||
*/
|
||||
public Object getValue() {
|
||||
String string = getValueAsText( SelectedListModel.getSelectedListModelInstance().getData() );
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the asText attribute of the RuleEditor object
|
||||
*
|
||||
* @return The asText value
|
||||
*/
|
||||
public String getAsText() {
|
||||
return getValue().toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the value attribute of the RuleEditor object
|
||||
*
|
||||
* @param obj The new value value
|
||||
*/
|
||||
public void setValue( Object obj ) {
|
||||
if( obj != null ) {
|
||||
SelectedListModel.getSelectedListModelInstance().setData( ( String )obj );
|
||||
AvailableListModel.getInstance().refresh();
|
||||
AvailableListModel.getInstance().getData().removeAll( SelectedListModel.getSelectedListModelInstance().getData() );
|
||||
}
|
||||
}
|
||||
public void setAsText( String string ) throws IllegalArgumentException {}
|
||||
|
||||
/**
|
||||
* Gets the valueAsText attribute of the RuleEditor object
|
||||
*
|
||||
* @param value Description of the Parameter
|
||||
* @return The valueAsText value
|
||||
*/
|
||||
private String getValueAsText( List value ) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
if( value != null ) {
|
||||
Iterator iterator = value.iterator();
|
||||
while( iterator.hasNext() ) {
|
||||
Rule rule = ( Rule )iterator.next();
|
||||
buffer.append( rule.getName() ).append( ", " );
|
||||
}
|
||||
}
|
||||
return String.valueOf( buffer );
|
||||
}
|
||||
}
|
270
pmd-netbeans/src/pmd/config/ui/RuleEnabler.form
Normal file
270
pmd-netbeans/src/pmd/config/ui/RuleEnabler.form
Normal file
@ -0,0 +1,270 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-77,0,0,2,-115"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="0"/>
|
||||
<Property name="rows" type="int" value="2"/>
|
||||
<Property name="verticalGap" type="int" value="5"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel5">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[270, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="4" fill="1" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="availableList">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="AvailableListModel.getInstance()" type="code"/>
|
||||
</Property>
|
||||
<Property name="cellRenderer" type="javax.swing.ListCellRenderer" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="new ListCell()" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="availableListValueChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane3">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[270, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="4" fill="1" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="chosenList">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="SelectedListModel.getSelectedListModelInstance()" type="code"/>
|
||||
</Property>
|
||||
<Property name="cellRenderer" type="javax.swing.ListCellRenderer" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="new ListCell()" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="chosenListValueChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Available rules"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="3" insetsBottom="3" insetsRight="3" anchor="17" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Chosen rules"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="2" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="3" insetsBottom="3" insetsRight="3" anchor="17" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="chooseOne">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value=">"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="chooseOneActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="1" insetsBottom="0" insetsRight="1" anchor="15" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="choseAll">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value=">>"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="choseAllActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="1" insetsBottom="0" insetsRight="1" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="removeOne">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="<"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeOneActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="3" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="1" insetsBottom="0" insetsRight="1" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="removeAll">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="<<"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeAllActionPerformed"/>
|
||||
</Events>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="1" gridY="4" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="1" insetsBottom="0" insetsRight="1" anchor="11" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel6">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Information"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="-1" gridY="-1" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Example"/>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="3" gridY="0" gridWidth="3" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="12" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane4">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 200]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[150, 150]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="1" gridWidth="3" gridHeight="3" fill="1" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="16" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JEditorPane" name="information">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[300, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="3" gridY="1" gridWidth="3" gridHeight="3" fill="1" ipadX="0" ipadY="0" insetsTop="2" insetsLeft="2" insetsBottom="2" insetsRight="2" anchor="14" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextPane" name="example">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="North"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="0"/>
|
||||
<Property name="rows" type="int" value="2"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Select rules that should be used"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="See http://pmd.sf.net for more information"/>
|
||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
328
pmd-netbeans/src/pmd/config/ui/RuleEnabler.java
Normal file
328
pmd-netbeans/src/pmd/config/ui/RuleEnabler.java
Normal file
File diff suppressed because it is too large
Load Diff
49
pmd-netbeans/src/pmd/config/ui/SelectedListModel.java
Normal file
49
pmd-netbeans/src/pmd/config/ui/SelectedListModel.java
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* SelectedListModel.java
|
||||
*
|
||||
* Created on 16. november 2002, 13:16
|
||||
*/
|
||||
|
||||
package pmd.config.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.sourceforge.pmd.Rule;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ole martin mørk
|
||||
*/
|
||||
public class SelectedListModel extends AvailableListModel {
|
||||
|
||||
private static SelectedListModel listmodel = new SelectedListModel();
|
||||
|
||||
/** Creates a new instance of SelectedListModel */
|
||||
private SelectedListModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static AvailableListModel getInstance() {
|
||||
return listmodel;
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
setList( new ArrayList() );
|
||||
}
|
||||
|
||||
public void setData( String rules ) {
|
||||
refresh();
|
||||
Iterator iterator = AvailableListModel.getInstance().getData().iterator();
|
||||
while( iterator.hasNext() ) {
|
||||
Rule rule = (Rule)iterator.next();
|
||||
if( rules.indexOf( rule.getName() + ", " ) > -1 ) {
|
||||
add( rule );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static SelectedListModel getSelectedListModelInstance() {
|
||||
return listmodel;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user