forked from phoedos/pmd
added a menu bar and a results panel
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@641 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -119,19 +119,6 @@ public class CPD {
|
||||
cpd.setListener(new CPDNullListener());
|
||||
cpd.setMinimumTileSize(26);
|
||||
try {
|
||||
/*
|
||||
cpd.add("1", "public class Foo {}");
|
||||
cpd.add("2", "public class Bar {}");
|
||||
*/
|
||||
/*
|
||||
cpd.add(new File("c:\\data\\pmd\\pmd\\test-data\\Unused1.java"));
|
||||
cpd.add(new File("c:\\data\\pmd\\pmd\\test-data\\Unused2.java"));
|
||||
cpd.add(new File("c:\\data\\pmd\\pmd\\test-data\\Unused3.java"));
|
||||
cpd.add(new File("c:\\data\\pmd\\pmd\\test-data\\Unused4.java"));
|
||||
cpd.add(new File("c:\\data\\pmd\\pmd\\test-data\\Unused5.java"));
|
||||
cpd.add(new File("c:\\data\\pmd\\pmd\\test-data\\Unused6.java"));
|
||||
cpd.add(new File("c:\\data\\pmd\\pmd\\test-data\\Unused7.java"));
|
||||
*/
|
||||
//cpd.add(findFilesRecursively("c:\\data\\pmd\\pmd-cpd\\src\\net\\sourceforge\\pmd\\cpd"));
|
||||
//cpd.add(new File("c:\\data\\cougaar\\core\\src\\org\\cougaar\\core\\adaptivity\\PlayHelper.java"));
|
||||
cpd.addRecursively("c:\\data\\cougaar\\core\\src\\org\\cougaar\\core\\adaptivity\\");
|
||||
|
@ -41,12 +41,25 @@ public class GUI implements CPDListener {
|
||||
private JProgressBar tokenizingFilesBar = new JProgressBar();
|
||||
private JProgressBar addingTokensBar = new JProgressBar();
|
||||
|
||||
private JTextArea resultsTextArea = new JTextArea(20,50);
|
||||
|
||||
private JTextField expandingTileField = new JTextField(50);
|
||||
private JCheckBox recurseCheckbox = new JCheckBox("Recurse?", true);
|
||||
public GUI() {
|
||||
JFrame f = new JFrame("PMD Cut and Paste Detector");
|
||||
|
||||
JMenu fileMenu = new JMenu("File");
|
||||
fileMenu.setMnemonic('f');
|
||||
JMenuItem exitItem = new JMenuItem("Exit");
|
||||
exitItem.setMnemonic('x');
|
||||
exitItem.addActionListener(new CancelListener());
|
||||
fileMenu.add(exitItem);
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
menuBar.add(fileMenu);
|
||||
f.setJMenuBar(menuBar);
|
||||
|
||||
JPanel inputPanel = new JPanel();
|
||||
inputPanel.setLayout(new GridLayout(4,2));
|
||||
inputPanel.setLayout(new GridLayout(3,2));
|
||||
inputPanel.add(new JLabel("Enter a root src directory"));
|
||||
inputPanel.add(rootDirectoryField);
|
||||
inputPanel.add(new JLabel("Enter a minimum tile size"));
|
||||
@ -60,6 +73,7 @@ public class GUI implements CPDListener {
|
||||
cxButton.addActionListener(new CancelListener());
|
||||
buttonsPanel.add(cxButton);
|
||||
inputPanel.add(buttonsPanel);
|
||||
inputPanel.setBorder(BorderFactory.createTitledBorder("Settings"));
|
||||
|
||||
JPanel progressPanel = new JPanel();
|
||||
progressPanel.setLayout(new BorderLayout());
|
||||
@ -72,14 +86,23 @@ public class GUI implements CPDListener {
|
||||
panel2.add(addingTokensBar);
|
||||
progressPanel.add(panel2, BorderLayout.CENTER);
|
||||
JPanel panel3 = new JPanel();
|
||||
panel3.add(new JLabel("Expanding tile"));
|
||||
panel3.add(new JLabel("Current tile"));
|
||||
panel3.add(expandingTileField);
|
||||
progressPanel.add(panel3, BorderLayout.SOUTH);
|
||||
progressPanel.setBorder(BorderFactory.createTitledBorder("Progress"));
|
||||
|
||||
JPanel resultsPanel = new JPanel();
|
||||
resultsPanel.add(new JScrollPane(resultsTextArea));
|
||||
resultsPanel.setBorder(BorderFactory.createTitledBorder("Results"));
|
||||
|
||||
|
||||
f.getContentPane().setLayout(new BorderLayout());
|
||||
f.getContentPane().add(inputPanel, BorderLayout.NORTH);
|
||||
f.getContentPane().add(progressPanel, BorderLayout.CENTER);
|
||||
f.getContentPane().setSize(600,400);
|
||||
JPanel topPanel = new JPanel();
|
||||
topPanel.setLayout(new BorderLayout());
|
||||
topPanel.add(inputPanel, BorderLayout.NORTH);
|
||||
topPanel.add(progressPanel, BorderLayout.SOUTH);
|
||||
f.getContentPane().add(topPanel, BorderLayout.NORTH);
|
||||
f.getContentPane().add(resultsPanel, BorderLayout.SOUTH);
|
||||
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
f.pack();
|
||||
f.show();
|
||||
@ -98,7 +121,7 @@ public class GUI implements CPDListener {
|
||||
}
|
||||
cpd.go();
|
||||
CPDRenderer renderer = new TextRenderer();
|
||||
System.out.println(renderer.render(cpd));
|
||||
resultsTextArea.setText(renderer.render(cpd));
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
|
Reference in New Issue
Block a user