From ec84d716a6cc6363c80642dde1cbb2cc6dcf3768 Mon Sep 17 00:00:00 2001 From: David Craine Date: Fri, 2 Aug 2002 18:07:30 +0000 Subject: [PATCH] started work on HotKey configuration utiltiy git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@611 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd-jbuilder/lib/PMDOpenTool.jar | Bin 79033 -> 86795 bytes .../jbuilder/AcceleratorPropertyGroup.java | 70 ++++++++ .../pmd/jbuilder/AcceleratorPropertyPage.java | 128 +++++++++++++++ .../sourceforge/pmd/jbuilder/PMDOpenTool.java | 153 +++++++++++------- 4 files changed, 291 insertions(+), 60 deletions(-) create mode 100644 pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/AcceleratorPropertyGroup.java create mode 100644 pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/AcceleratorPropertyPage.java diff --git a/pmd-jbuilder/lib/PMDOpenTool.jar b/pmd-jbuilder/lib/PMDOpenTool.jar index a39ab1d6ff9e847c7cf1adfeb2e7369e731d613d..dc03dd88b54d728cc471804d6f8217462c877a6f 100644 GIT binary patch delta 11885 zcmcIq34E2+v7h;FZoZo@UqW)TZ{%h{LiPj*kg)F%h+&nm2qC#ZFeD)f3W{D(+!29O zdKLSM+E#p3D-cP5xPY}4twk)@=YoYkcdJy?y0j|qKi|DsZshg7{@(9J?|06bGiPSb zoH=vm%;E5dL3ci6H!I6+K?cd+T}?a8%^JRUd+}9SydOo|oBUTT@~$Q=@7=+y+xC zGzX;{6hs+1W$H9Qr^}f7)vRl7b~m(6YiMb$Zm4lH4O2T}Tru5pS2i~`xtm)zOlfXh zrv9;X2!8M_=p|)=2 zI;g6yv4JUWj=R;>y2|bEZgH(>Y<2=;$rZ2-2w(Y{ywd zV|@cDmf|etF@Ew6iuVbYhv6w!7m=O)(_?FTkPe+0ppankNFfEG?4ZFq4biEDDY$i2T}x&mQ;C>VFHTF7Gqn*}eSrItC#%89Y4Ja>yvpj8?#!Yx z^~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{MQ$ouIc$ws$P$~c8rz_16Z*(70VO_Un-Uv3WiUY zQU&Ksml^g`P1v!(p3~Hb`X*aHoi6$2lGG&Yqe@Ya#nw~T$)J#bYL-;+@_!&b$y!n# z97rnRKuK(HAipTdI#n()spB>MRZN^QsysP464`!8;e3kB3Sx{nnb zK3S~LQ_aPT;;p;N#IVuNxxP63B{xHT)B2%Dl`HhIyDMGR`7(*Mu_vxNd*&QDSKpL= z*bAzzV5>c|v7h{8w670)YCr5B&s5k&S9fu6T7FG3pU>1+)erUJ9ECdH-i-ZW{!`bi_i{vF}G6HuRe4ZQkyI-usJn7ba1 zuv&NyY}VKQ{@%-foFSGuTitle: 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 + * + * formatted with JxBeauty (c) johann.langhofer@nextra.at + */ + + +package net.sourceforge.pmd.jbuilder; + +import com.borland.primetime.properties.PropertyGroup; +import com.borland.primetime.properties.PropertyPageFactory; +import com.borland.primetime.properties.GlobalProperty; +import com.borland.primetime.properties.PropertyPage; +import net.sourceforge.pmd.RuleSetFactory; +import net.sourceforge.pmd.RuleSet; +import java.util.Iterator; +import java.util.HashMap; +import com.borland.primetime.ide.MessageCategory; +import com.borland.primetime.ide.Browser; +import java.util.Enumeration; + + + +/** + * put your documentation comment here + */ +public class AcceleratorPropertyGroup + implements PropertyGroup { + + public static AcceleratorPropertyGroup currentInstance = null; + + /** + * Standard Constructor + */ + public AcceleratorPropertyGroup () { + currentInstance = this; + } + + + /** + * Called by JBuilder + */ + public void initializeProperties () { + } + + /** + * Create the panel that will go in the property page + * @param topic Topic of page (represented as a tab in the property page) + * @return Factory for creating property pages - this factory will create RuleSetPropertyPages + */ + public PropertyPageFactory getPageFactory (Object topic) { + if (topic == Constants.RULESETS_TOPIC) { + return new PropertyPageFactory("PMD HotKey Condiguration", "Set the HotKeys for PMD") { + + public PropertyPage createPropertyPage () { + return new AcceleratorPropertyPage(); + } + }; + } + return null; + } +} + + + diff --git a/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/AcceleratorPropertyPage.java b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/AcceleratorPropertyPage.java new file mode 100644 index 0000000000..060d0fc891 --- /dev/null +++ b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/AcceleratorPropertyPage.java @@ -0,0 +1,128 @@ +/** + *

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 + * + * formatted with JxBeauty (c) johann.langhofer@nextra.at + */ + + +package net.sourceforge.pmd.jbuilder; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; + +import javax.swing.*; +import javax.swing.border.*; + +import com.borland.primetime.help.*; +import com.borland.primetime.ide.*; +import com.borland.primetime.properties.*; +import com.borland.jbcl.layout.*; +import java.io.InputStream; +import net.sourceforge.pmd.RuleSetFactory; +import net.sourceforge.pmd.RuleSet; + + + +public class AcceleratorPropertyPage extends PropertyPage { + private JPanel jPanel1 = new JPanel(); + private JLabel jLabel1 = new JLabel(); + private JComboBox jComboBox1 = new JComboBox(); + private JPanel jPanel2 = new JPanel(); + private JTextField jTextField1 = new JTextField(); + int keycode; + int modifiers; + private FlowLayout flowLayout1 = new FlowLayout(); + private JTextField jTextField2 = new JTextField(); + private JTextField jTextField3 = new JTextField(); + private VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout(); + + /** + * Constuctor + */ + public AcceleratorPropertyPage () { + try { + jbInit(); + init2(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + + /** + * Initialize the interface components + * @exception Exception thows any exceptions that occur + */ + protected void jbInit () throws Exception { + this.setLayout(verticalFlowLayout1); + jLabel1.setText("Select the Action"); + jPanel2.setLayout(flowLayout1); + jTextField2.setPreferredSize(new Dimension(50, 21)); + jTextField2.setEditable(false); + jTextField3.setPreferredSize(new Dimension(50, 21)); + jTextField3.setEditable(false); + jTextField1.setPreferredSize(new Dimension(50, 21)); + this.add(jPanel1, null); + jPanel1.add(jLabel1, null); + jPanel1.add(jComboBox1, null); + this.add(jPanel2, null); + jPanel2.add(jTextField1, null); + jPanel2.add(jTextField2, null); + jPanel2.add(jTextField3, null); + } + + + /** + * non-Jbuilder specific initialization stuff + */ + private void init2() { + jTextField1.addKeyListener(new KeyAdapter() { + + public void keyPressed(KeyEvent e) + { + keycode = e.getKeyCode(); + modifiers = e.getModifiers(); + if(e.isActionKey()) + { + jTextField2.setText(KeyEvent.getKeyText(keycode)); + jTextField3.setText(KeyEvent.getKeyModifiersText(modifiers)); + jTextField1.setText(""); + + } + } + + public void keyTyped(KeyEvent e) + { + jTextField2.setText(KeyEvent.getKeyText(keycode)); + jTextField3.setText(KeyEvent.getKeyModifiersText(modifiers)); + jTextField1.setText(""); + } + + }); + } + + public void writeProperties () { + } + + /** + * get the Help TOpic + * @return help topic + */ + public HelpTopic getHelpTopic () { + return null; + } + + /** + * Called by JBuilder to setup the initial property settings. + */ + public void readProperties () {} + +} + + diff --git a/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java index 8501255b33..16a956889f 100644 --- a/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java +++ b/pmd-jbuilder/src/net/sourceforge/pmd/jbuilder/PMDOpenTool.java @@ -26,6 +26,7 @@ import com.borland.primetime.node.*; import com.borland.primetime.properties.*; import com.borland.primetime.viewer.*; import net.sourceforge.pmd.*; +import java.awt.event.ActionEvent; @@ -49,9 +50,10 @@ public class PMDOpenTool { */ public static void initOpenTool (byte majorVersion, byte minorVersion) { if (majorVersion == PrimeTime.CURRENT_MAJOR_VERSION) { - GROUP_PMD.add(ACTION_PMDCheck); - GROUP_PMD.add(ACTION_PMDConfig); + GROUP_PMD.add(B_ACTION_PMDCheck); + GROUP_PMD.add(B_ACTION_PMDConfig); JBuilderMenu.GROUP_Tools.add(GROUP_PMD); + registerWithContentManager(); registerWithProjectView(); @@ -63,10 +65,19 @@ public class PMDOpenTool { ImportedRuleSetPropertyGroup ipropGrp = new ImportedRuleSetPropertyGroup(); ActiveRuleSetPropertyGroup apropGrp = new ActiveRuleSetPropertyGroup(); ConfigureRuleSetPropertyGroup cpropGrp = new ConfigureRuleSetPropertyGroup(); + AcceleratorPropertyGroup accpropGrp = new AcceleratorPropertyGroup(); + + //register the Keymap shortcuts + EditorManager.getKeymap().addActionForKeyStroke(KeyStroke.getKeyStroke('P', Event.CTRL_MASK | Event.SHIFT_MASK), + E_ACTION_PMDCheck); + + EditorManager.getKeymap().addActionForKeyStroke(KeyStroke.getKeyStroke('J', Event.CTRL_MASK | Event.SHIFT_MASK), + E_ACTION_PMDCheckProject); PropertyManager.registerPropertyGroup(apropGrp); PropertyManager.registerPropertyGroup(cpropGrp); PropertyManager.registerPropertyGroup(ipropGrp); + PropertyManager.registerPropertyGroup(accpropGrp); } } @@ -79,7 +90,7 @@ public class PMDOpenTool { ContextActionProvider cap = new ContextActionProvider() { public Action getContextAction (Browser browser, Node[] nodes) { - return ACTION_PMDCheck; + return B_ACTION_PMDCheck; } }; ContentManager.registerContextActionProvider(cap); @@ -88,10 +99,9 @@ public class PMDOpenTool { private static void registerWithProjectView() { ContextActionProvider cap = new ContextActionProvider() { public Action getContextAction (Browser browser, Node[] nodes) { - //Browser.getActiveBrowser().getMessageView().addMessage(msgCat, browser.getProjectView().getSelectedNode().toString()); Node node = browser.getProjectView().getSelectedNode(); if (node instanceof JBProject || node instanceof PackageNode) - return ACTION_PMDProjectCheck; + return B_ACTION_PMDProjectCheck; return null; } }; @@ -105,7 +115,6 @@ public class PMDOpenTool { * @return A Ruleset and any embedded rulesets */ private static RuleSet constructRuleSets () { - Browser.getActiveBrowser().getMessageView().addMessage(Constants.MSGCAT_TEST, "building ruleset"); RuleSet masterRuleSet = new RuleSet(); for (Iterator iter = ActiveRuleSetPropertyGroup.currentInstance.ruleSets.values().iterator(); iter.hasNext(); ) { RuleSetProperty rsp = (RuleSetProperty)iter.next(); @@ -142,28 +151,47 @@ public class PMDOpenTool { return null; } + + //create EditorAction for performing a PMD Check + public static EditorAction E_ACTION_PMDCheck = + new EditorAction("Displays PMD statistics about a Java File") { + public void actionPerformed(ActionEvent e) { + pmdCheck(); + } + }; + + //create EditorAction for performing a PMD Check on a project + public static EditorAction E_ACTION_PMDCheckProject = + new EditorAction("Displays PMD statistics about a Java File") { + public void actionPerformed(ActionEvent e) { + pmdCheckProject(); + } + }; + //create the Menu action item for initiating the PMD check - public static BrowserAction ACTION_PMDCheck = + public static BrowserAction B_ACTION_PMDCheck = // A new action with short menu string, mnemonic, and long menu string new BrowserAction("PMD Checker", 'P', "Displays PMD statistics about a Java File") { // The function called when the menu is selected public void actionPerformed (Browser browser) { - Node node = Browser.getActiveBrowser().getActiveNode(); - if (node instanceof JavaFileNode) { - Browser.getActiveBrowser().getMessageView().clearMessages(msgCat); //clear the message window - TextNodeViewer viewer = (TextNodeViewer)Browser.getActiveBrowser().getViewerOfType(node, - TextNodeViewer.class); - if (viewer != null) { - Document doc = viewer.getEditor().getDocument(); - try { - checkCode(doc.getText(0, doc.getLength()), (JavaFileNode)node, null); - } - catch (Exception e){ - e.printStackTrace(); - } - } - } + pmdCheck(); + } + }; + + //Create the menu action item for configuring PMD + public static BrowserAction B_ACTION_PMDConfig = new BrowserAction("Configure PMD", + 'C', "Configure the PMD Settings") { + public void actionPerformed (Browser browser) { + PropertyManager.showPropertyDialog(browser, "PMD Options", Constants.RULESETS_TOPIC, + PropertyDialog.getLastSelectedPage()); + } + }; + + //create the project menu action for running a PMD check against all the java files within the active project + public static BrowserAction B_ACTION_PMDProjectCheck = new BrowserAction ("PMD Check Project", 'P', "Check all the java files in the project") { + public void actionPerformed(Browser browser) { + pmdCheckProject(); } }; @@ -202,51 +230,56 @@ public class PMDOpenTool { } - //Create the menu action item for configuring PMD - public static BrowserAction ACTION_PMDConfig = new BrowserAction("Configure PMD", - 'C', "Configure the PMD Settings") { - public void actionPerformed (Browser browser) { - PropertyManager.showPropertyDialog(browser, "PMD Options", Constants.RULESETS_TOPIC, - PropertyDialog.getLastSelectedPage()); - } - }; - - //create the project menu action for running a PMD check against all the java files within the active project - public static BrowserAction ACTION_PMDProjectCheck = new BrowserAction ("PMD Check Project", 'P', "Check all the java files in the project") { - public void actionPerformed(Browser browser) { - Node[] nodes = browser.getActiveBrowser().getActiveProject().getDisplayChildren(); + private static void pmdCheck() { + Node node = Browser.getActiveBrowser().getActiveNode(); + if (node instanceof JavaFileNode) { Browser.getActiveBrowser().getMessageView().clearMessages(msgCat); //clear the message window - RuleSet rules = constructRuleSets(); - for (int i=0; i