From b959baf891fe8b76c0c605f880175714e9e80fa2 Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Mon, 28 Apr 2003 17:57:33 +0000 Subject: [PATCH] Changed XPath query widgit to a textarea git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1868 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/src/net/sourceforge/pmd/util/ASTViewer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pmd/src/net/sourceforge/pmd/util/ASTViewer.java b/pmd/src/net/sourceforge/pmd/util/ASTViewer.java index 14773a3380..5b25a86e01 100644 --- a/pmd/src/net/sourceforge/pmd/util/ASTViewer.java +++ b/pmd/src/net/sourceforge/pmd/util/ASTViewer.java @@ -80,7 +80,7 @@ public class ASTViewer { private class XPathListener implements ActionListener { public void actionPerformed(ActionEvent ae) { - if (xpathQueryField.getText().length() == 0) { + if (xpathQueryArea.getText().length() == 0) { xpathResultArea.setText("XPath query field is empty"); codeEditorPane.requestFocus(); return; @@ -88,7 +88,7 @@ public class ASTViewer { StringReader sr = new StringReader(codeEditorPane.getText()); JavaParser parser = new JavaParser(sr); try { - XPath xpath = new BaseXPath(xpathQueryField.getText(), new DocumentNavigator()); + XPath xpath = new BaseXPath(xpathQueryArea.getText(), new DocumentNavigator()); ASTCompilationUnit c = parser.CompilationUnit(); StringBuffer sb = new StringBuffer(); for (Iterator iter = xpath.selectNodes(c).iterator(); iter.hasNext();) { @@ -106,14 +106,14 @@ public class ASTViewer { } catch (JaxenException je) { xpathResultArea.setText(je.fillInStackTrace().getMessage()); } - xpathQueryField.requestFocus(); + xpathQueryArea.requestFocus(); } } private JTextPane codeEditorPane = new JTextPane(); private JTextArea astArea = new JTextArea(); private JTextArea xpathResultArea = new JTextArea(); - private JTextField xpathQueryField = new JTextField(40); + private JTextArea xpathQueryArea = new JTextArea(8, 40); private JFrame frame = new JFrame("AST Viewer"); public ASTViewer() { @@ -140,7 +140,8 @@ public class ASTViewer { JPanel controlPanel = new JPanel(); controlPanel.add(new JLabel("XPath Query (if any) ->")); - controlPanel.add(xpathQueryField); + xpathQueryArea.setBorder(BorderFactory.createLineBorder(Color.black)); + controlPanel.add(new JScrollPane(xpathQueryArea)); controlPanel.add(goButton); JSplitPane resultsSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, astPanel, xpathResultPanel);