diff --git a/pmd-jbuilder/PMDOpenTool.jpx b/pmd-jbuilder/PMDOpenTool.jpx index 60cc0157ed..1921b5ff8f 100644 --- a/pmd-jbuilder/PMDOpenTool.jpx +++ b/pmd-jbuilder/PMDOpenTool.jpx @@ -33,7 +33,7 @@ - + @@ -43,12 +43,19 @@ + + + + + + - + + diff --git a/pmd-jbuilder/PMDOpenTool.jpx.local b/pmd-jbuilder/PMDOpenTool.jpx.local index 81d9d610be..fdd60ddc74 100644 --- a/pmd-jbuilder/PMDOpenTool.jpx.local +++ b/pmd-jbuilder/PMDOpenTool.jpx.local @@ -25,9 +25,24 @@ debug.NoTracingClasses.6[0]=30 com.borland.jbuilder.runtime.*1 1 -1 debug.NoTracingClasses.7[0]=17 com.borland.sql.*1 1 -1 debug.NoTracingClasses.8[0]=9 com.sun.*1 1 -1 debug.NoTracingClasses.9[0]=6 java.*1 1 -1 -history.files.active[0]=C%|/JBuilder7/lib/ext/PMDOpenTool.jar -history.files.open.1[0]=C%|/JBuilder7/lib/ext/PMDOpenTool.jar -history.files.open.2[0]=src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java,F;0,0 +history.files.active[0]=src/net/sourceforge/pmd/jbuilder/RuleSetPropertyGroup.java +history.files.open.1[0]=src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java,F;136,1658 +history.files.open.2[0]=src/net/sourceforge/pmd/jbuilder/RuleSetPropertyGroup.java,F;13,593 +history.files.open.3[0]=src/net/sourceforge/pmd/jbuilder/RuleSetPropertyPage.java,F;0,754 +import.optimize.packageprefixgroupings.1[0]=java +import.optimize.packageprefixgroupings.2[0]= +import.optimize.packageprefixgroupings.3[0]=javax +import.optimize.packageprefixgroupings.4[0]= +import.optimize.packageprefixgroupings.5[0]=<*> sys.Author[0]=David Craine -sys.DefaultPackage[0]=pmdopentool -wizard.package.package_history.1[0]=pmdopentool +sys.DefaultPackage[0]=net.sourceforge.pmd.jbuilder +team.ActiveVCS[0]=CVS +team.CvsAccessMethod[0]=ext +team.CvsAutosaveEnabled[0]=1 +team.CvsModule[0]=pmd-jbuilder +team.CvsRepository[0]=/cvsroot/pmd +team.CvsServer[0]=cvs.pmd.sourceforge.net +team.CvsShowConsole[0]=0 +team.CvsUsername[0]=dcraine +wizard.package.package_history.1[0]=net.sourceforge.pmd.jbuilder +wizard.package.package_history.2[0]=pmdopentool diff --git a/pmd-jbuilder/classes.opentools b/pmd-jbuilder/classes.opentools index d627dcd65a..a3f50c747e 100644 --- a/pmd-jbuilder/classes.opentools +++ b/pmd-jbuilder/classes.opentools @@ -1 +1 @@ -OpenTools-UI: pmdopentool.PMDOpenTool +OpenTools-UI: net.sourceforge.pmd.jbuilder.PMDOpenTool diff --git a/pmd-jbuilder/copyfile.bat b/pmd-jbuilder/copyfile.bat new file mode 100755 index 0000000000..d49aedd105 --- /dev/null +++ b/pmd-jbuilder/copyfile.bat @@ -0,0 +1,2 @@ +copy lib\PMDOpenTOol.jar %1 +copy lib\pmd-0.3.jar %1 \ No newline at end of file diff --git a/pmd-jbuilder/lib/PMDOpenTool.jar b/pmd-jbuilder/lib/PMDOpenTool.jar index cd34a415ed..b64f956137 100644 Binary files a/pmd-jbuilder/lib/PMDOpenTool.jar and b/pmd-jbuilder/lib/PMDOpenTool.jar differ diff --git a/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java index cfc22c5fbc..18c909f080 100644 --- a/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java +++ b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java @@ -1,26 +1,26 @@ package net.sourceforge.pmd.jbuilder; +import java.awt.*; import java.io.*; import java.util.*; +import javax.swing.*; import javax.swing.text.*; import com.borland.jbuilder.*; import com.borland.jbuilder.node.*; import com.borland.primetime.*; +import com.borland.primetime.editor.*; import com.borland.primetime.ide.*; import com.borland.primetime.node.*; import com.borland.primetime.viewer.*; import net.sourceforge.pmd.*; import net.sourceforge.pmd.reports.*; -import com.borland.primetime.actions.DelegateHandler; -import com.borland.primetime.actions.DelegateAction; -import javax.swing.Action; -import com.borland.primetime.editor.LineMark; -import com.borland.primetime.editor.EditorPane; -import com.borland.primetime.editor.EditorManager; -import com.borland.primetime.editor.MasterStyleContext; -import java.awt.Color; +import com.borland.primetime.actions.ActionGroup; +import com.borland.primetime.properties.NodeProperty; +import com.borland.primetime.properties.GlobalProperty; +import com.borland.primetime.properties.PropertyManager; +import com.borland.primetime.properties.PropertyDialog; /** @@ -33,9 +33,9 @@ import java.awt.Color; */ public class PMDOpenTool { + static MessageCategory msgCat = new MessageCategory("PMD Results"); - - + public static ActionGroup GROUP_PMD = new ActionGroup("PMD", 'p', true); public PMDOpenTool() { int i; @@ -44,11 +44,15 @@ public class PMDOpenTool { public static void initOpenTool(byte majorVersion, byte minorVersion) { if (majorVersion == PrimeTime.CURRENT_MAJOR_VERSION) { - JBuilderMenu.GROUP_Tools.add(ACTION_PMDCheck); + GROUP_PMD.add(ACTION_PMDCheck); + GROUP_PMD.add(ACTION_PMDConfig); + JBuilderMenu.GROUP_Tools.add(GROUP_PMD); registerWithContentManager(); + PropertyManager.registerPropertyGroup(new RuleSetPropertyGroup()); } } + /** * Registers an "PMD Checker" action with the ContentManager (Tabs) * The action will not be visible if multiple nodes are selected @@ -66,6 +70,23 @@ public class PMDOpenTool { ContentManager.registerContextActionProvider(cap); } + + private static RuleSet constructRuleSets(RuleSetFactory ruleSetFactory, PMD pmd) { + RuleSet masterRuleSet = null; + for (int i = 0; iTitle: JBuilder OpenTool for PMD

+ *

Description: Provides an environemnt for using the PMD aplication from within JBuilder

+ *

Copyright: Copyright (c) 2002

+ *

Company: InfoEther

+ * @author David Craine + * @version 1.0 + */ + +public class RuleSetPropertyGroup implements PropertyGroup { + /** + BEGIN - RULE DEFINITION SECTION + To add new rule sets simply create a new rule set name constant, create GlobalProperty constant, + and add each to their respective arrays. + */ + + public static final String RULESETS="RuleSets"; + public static final String RULESET_BASIC = "basic"; + public static final String RULESET_DESIGN = "design"; + public static final String RULESET_UNUSEDCODE = "unusedcode"; + public static final String RULESET_COUGAAR = "cougaar"; + public static final String RULESET_TICBUILD = "ticbuild"; + + public static final Object RULESETS_TOPIC = new Object(); + public static final GlobalProperty PROPKEY_RULESET_DESIGN = new GlobalProperty(RULESETS, RULESET_DESIGN, "true"); + public static final GlobalProperty PROPKEY_RULESET_BASIC = new GlobalProperty(RULESETS, RULESET_BASIC, "true"); + public static final GlobalProperty PROPKEY_RULESET_UNUSEDCODE = new GlobalProperty(RULESETS, RULESET_UNUSEDCODE, "true"); + public static final GlobalProperty PROPKEY_RULESET_COUGAAR = new GlobalProperty(RULESETS, RULESET_COUGAAR, "true"); + public static final GlobalProperty PROPKEY_RULESET_TICBUILD = new GlobalProperty(RULESETS, RULESET_TICBUILD, "true"); + + //make sure that these two arrays are synchronized + public static final String[] RULESET_NAMES = { + RULESET_BASIC, + RULESET_DESIGN, + RULESET_UNUSEDCODE, + RULESET_COUGAAR, + RULESET_TICBUILD}; + public static final GlobalProperty[] PROPKEYS = { + PROPKEY_RULESET_BASIC, + PROPKEY_RULESET_DESIGN, + PROPKEY_RULESET_UNUSEDCODE, + PROPKEY_RULESET_COUGAAR, + PROPKEY_RULESET_TICBUILD}; + /** + * END - RULE DEFINITION SECTION + */ + + + public RuleSetPropertyGroup() { + } + public void initializeProperties() { + /**@todo Implement this com.borland.primetime.properties.PropertyGroup method*/ + throw new java.lang.UnsupportedOperationException("Method initializeProperties() not yet implemented."); + } + public PropertyPageFactory getPageFactory(Object topic) { + if (topic == RULESETS_TOPIC) { + return new PropertyPageFactory("PMD Properties", "Set PMD RuleSet Properties") { + public PropertyPage createPropertyPage() { + return new RuleSetPropertyPage(); + } + }; + } + return null; + } +} \ No newline at end of file diff --git a/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/RuleSetPropertyPage.java b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/RuleSetPropertyPage.java new file mode 100644 index 0000000000..00da9fee92 --- /dev/null +++ b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/RuleSetPropertyPage.java @@ -0,0 +1,187 @@ +package net.sourceforge.pmd.jbuilder; + +import com.borland.primetime.properties.*; +import com.borland.primetime.help.HelpTopic; +import javax.swing.*; +import java.awt.*; +import java.util.HashMap; +import javax.swing.border.*; +import javax.swing.ListModel; +import javax.swing.DefaultListModel; +import java.awt.event.*; +import com.borland.primetime.ide.Browser; +import com.borland.primetime.ide.MessageCategory; +import java.util.Enumeration; + + +/** + *

Title: JBuilder OpenTool for PMD

+ *

Description: Provides an environemnt for using the PMD aplication from within JBuilder

+ *

Copyright: Copyright (c) 2002

+ *

Company: InfoEther

+ * @author David Craine + * @version 1.0 + */ + +public class RuleSetPropertyPage extends PropertyPage { + + //static MessageCategory cat = new MessageCategory("test"); + + private BorderLayout borderLayout1 = new BorderLayout(); + private JSplitPane jSplitPane1 = new JSplitPane(); + private Border border1; + private TitledBorder titledBorder1; + private Border border2; + private TitledBorder titledBorder2; + private DefaultListModel dlmAvailableRuleSets = new DefaultListModel(); + private DefaultListModel dlmSelectedRuleSets = new DefaultListModel(); + private JPanel jpAvailableRuleSets = new JPanel(); + private JScrollPane jspAvailableRuleSets = new JScrollPane(); + private JList jlistAvailableRuleSets = new JList(); + private JPanel jpSelectedRuleSets = new JPanel(); + private JList jlistSelectedRuleSets = new JList(); + private JScrollPane jspSelecedRuleSets = new JScrollPane(); + private BorderLayout borderLayout2 = new BorderLayout(); + private BorderLayout borderLayout3 = new BorderLayout(); + private JButton jbSelectRuleSets = new JButton(); + private JButton jbDeselectRuleSets = new JButton(); + private Border border3; + private Border border4; + + public RuleSetPropertyPage() { + try { + jbInit(); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + + + private void initRuleSplitPanes() { + //loop through the sets of rules and place them in the appropriate pane based upon setting + for (int i=0;i>>"); + jbSelectRuleSets.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + jbSelectRuleSets_actionPerformed(e); + } + }); + jbDeselectRuleSets.setText("<<<===Remove"); + jbDeselectRuleSets.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(ActionEvent e) { + jbDeselectRuleSets_actionPerformed(e); + } + }); + jpAvailableRuleSets.setBorder(titledBorder1); + jpSelectedRuleSets.setBorder(titledBorder2); + this.add(jSplitPane1, BorderLayout.CENTER); + jSplitPane1.add(jpAvailableRuleSets, JSplitPane.LEFT); + jSplitPane1.add(jpSelectedRuleSets, JSplitPane.RIGHT); + jpAvailableRuleSets.add(jspAvailableRuleSets, BorderLayout.CENTER); + jpSelectedRuleSets.add(jspSelecedRuleSets, BorderLayout.CENTER); + jspSelecedRuleSets.getViewport().add(jlistSelectedRuleSets, null); + jspAvailableRuleSets.getViewport().add(jlistAvailableRuleSets, null); + jpAvailableRuleSets.add(jbSelectRuleSets, BorderLayout.SOUTH); + jpSelectedRuleSets.add(jbDeselectRuleSets, BorderLayout.SOUTH); + + initRuleSplitPanes(); + jSplitPane1.setDividerLocation(200); + } + + public void writeProperties() { + //set the properties for the items items in the selected list to true + for (Enumeration e = dlmSelectedRuleSets.elements(); e.hasMoreElements(); ) { + ListEntry le = (ListEntry)e.nextElement(); + le.getProp().setValue("true"); + } + + //set the properties for the items items in the available list to false + for (Enumeration e = dlmAvailableRuleSets.elements(); e.hasMoreElements(); ) { + ListEntry le = (ListEntry)e.nextElement(); + le.getProp().setValue("false"); + } + + + } + public HelpTopic getHelpTopic() { + return null; + } + public void readProperties() { + } + + void jbSelectRuleSets_actionPerformed(ActionEvent e) { + //get the selected elements in the selected list and move to the available list + int [] selectedItems = jlistAvailableRuleSets.getSelectedIndices(); + if (selectedItems != null) { + for (int i=0; i