View Javadoc

1   package net.sf.jameleon.ui;
2   
3   import java.io.File;
4   
5   import javax.swing.JOptionPane;
6   
7   import net.sf.jameleon.bean.TestCase;
8   
9   public class TestCaseDocsExecutor extends Thread {
10      private File script;
11      private TestCasePane tcp;
12      private ProgressDialog dialog;
13  
14      public TestCaseDocsExecutor(File script, TestCasePane tcp) {
15          this.script = script;
16          this.tcp = tcp;
17      }
18  
19      public void setProgressDialog(ProgressDialog pg){
20          dialog = pg;
21      }
22  
23      public void run() {
24          TestCase tc = null;
25          try {
26              tc = new TestCase();
27              tc.readFromScript("file:"+script.getAbsolutePath());
28          } catch (Throwable e) {
29              e.printStackTrace();
30              String msg = e.getMessage();
31                JOptionPane.showMessageDialog(
32                    tcp,
33                    msg,
34                    "Error Parsing Script",
35                    JOptionPane.ERROR_MESSAGE);
36  
37          } finally {
38              if (dialog != null) {
39                  dialog.taskCompleted();
40              }
41              tcp.setTestCaseInfo(tc);
42          }
43      }
44  
45  }
46