1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  package net.sf.jour.rt.swingmonitor.ui.action;
22  
23  import java.awt.Component;
24  import java.awt.event.ActionEvent;
25  import java.awt.event.ActionListener;
26  import java.io.File;
27  
28  import javax.swing.JFileChooser;
29  
30  import net.sf.jour.rt.RtProperties;
31  import net.sf.jour.rt.agent.BulkEventFileReader;
32  import net.sf.jour.rt.agent.EventProcessor;
33  
34  
35  
36  /***
37   * Opend data folders and reset current statistics.
38   *
39   * Created on 14.12.2004
40   * Contributing Author(s):
41   *
42   *   Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation)
43   *   Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation)
44   *
45   * @author vlads
46   * @version $Revision: 1.2 $ ($Author: vlads $)  $Date: 2004/12/16 05:35:55 $
47   */
48  public class MonitorDataFolderAction implements ActionListener {
49  
50      Component parent;
51      
52      public MonitorDataFolderAction(Component parent) {
53          this.parent = parent;
54      }
55      /***
56       * Method actionPerformed
57       */
58      public void actionPerformed(ActionEvent e) {
59          RtProperties prop = RtProperties.getInstance(); 
60          File dir = prop.getFolder("BulkEventFileReader.folder", false);
61          if (dir == null) {
62              dir = new File(".");
63          }
64          JFileChooser fc = new JFileChooser(dir);
65          fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
66          fc.setDialogTitle("Select directory containing data files");
67          
68          
69  
70          if (fc.showOpenDialog(this.parent) == JFileChooser.APPROVE_OPTION) {
71              prop.setProperty("BulkEventFileReader.folder",
72                      fc.getSelectedFile().getAbsolutePath());
73              
74              EventProcessor.getInstance().reset();
75              BulkEventFileReader.start();
76          }
77      }
78  
79  }