1 20 21 package JFlex.gui; 22 23 import JFlex.*; 24 25 import java.io.File ; 26 27 28 35 public class GeneratorThread extends Thread { 36 37 38 private static volatile boolean running = false; 39 40 41 String inputFile; 42 43 44 String outputDir; 45 46 47 MainFrame parent; 48 49 57 public GeneratorThread(MainFrame parent, String inputFile, 58 String outputDir) { 59 this.parent = parent; 60 this.inputFile = inputFile; 61 this.outputDir = outputDir; 62 } 63 64 65 68 public void run() { 69 if (running) { 70 Out.error(ErrorMessages.ALREADY_RUNNING); 71 parent.generationFinished(false); 72 } 73 else { 74 running = true; 75 setPriority(MIN_PRIORITY); 76 try { 77 if (!outputDir.equals("")) { 78 Options.setDir(outputDir); 79 } 80 Main.generate(new File (inputFile)); 81 Out.statistics(); 82 parent.generationFinished(true); 83 } 84 catch (GeneratorException e) { 85 Out.statistics(); 86 parent.generationFinished(false); 87 } 88 finally { 89 running = false; 90 } 91 } 92 } 93 } 94 | Popular Tags |