1 19 20 26 package org.enhydra.dods.wizard; 27 28 import java.awt.Dimension ; 29 import java.awt.Toolkit ; 30 import java.io.BufferedReader ; 31 import java.io.InputStreamReader ; 32 import org.enhydra.dods.generator.ErrorReader; 33 34 40 public class ExecThread extends Thread { 41 42 TraceDialog td = null; public ExecThread() { 44 td = new TraceDialog(DefaultDODSWizard.frame, "Building ..."); 45 } 46 47 public void run() { 48 TraceDialog td = new TraceDialog(DefaultDODSWizard.frame, "Building ..."); 49 Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); 50 51 td.setLocation((dimension.width - td.getSize().width) / 2, 52 (dimension.height - td.getSize().height) / 2 - 10); 53 td.setVisible(true); 54 td.setDefaultFocus(); 55 try { 56 57 ErrorReader errorReader; 58 59 Process process; 60 BufferedReader buffer; 61 BufferedReader error; 62 String s; 63 64 process = DefaultDODSWizard.getGenerator().generateAll(true); 65 if (process != null) { 66 buffer = new BufferedReader (new InputStreamReader (process.getInputStream())); 67 error = new BufferedReader (new InputStreamReader (process.getErrorStream())); 68 (new ErrorReader(error, true)).start(); 69 while ((s = buffer.readLine()) != null) { 70 td.appendLine(s + "\n"); 71 } 72 process.waitFor(); 73 int k = process.exitValue(); 74 } 75 td.setButtonName("OK"); 76 td.setTitle("Building (Done)"); 77 DefaultDODSWizard.getGenerator().postGenerate(); 78 } catch (Exception e) { 79 e.printStackTrace(); 80 } 81 } 82 } 83 | Popular Tags |