package me.srvstr.logic; import java.lang.reflect.InvocationTargetException; import javax.swing.JOptionPane; import me.srvstr.ui.editors.code.CodeEditor; public class GyteProcessor extends Thread { private GyteController gyteController; private CodeEditor editor; private Program program; public GyteProcessor(GyteController gyteController, CodeEditor editor) { this.gyteController = gyteController; this.editor = editor; } public void run() { this.editor.setProgramStatus(true); try { this.program.getMainMethod().invoke(this.program.getProgram(), new Object[] { this.gyteController }); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { if (!(e.getCause() instanceof me.srvstr.run.ForcedStopException)) { System.err.println("The Gyte-Processors Thread did not respond in time and killed"); } } System.out.println("> Gyte-Processor has finished"); this.editor.setProgramStatus(false); } public void dispatchProgram(Program program) { this.program = program; synchronized (this) { start(); } } public void halt() { interrupt(); try { join(2000L); if (isAlive()) { stop(); } } catch (InterruptedException interruptedException) { } catch (SecurityException death) { JOptionPane.showMessageDialog(null, "The Thread running GYTEBOTS code needed to be stopped by ThreadDeath", "Error - stopping Thread", 0); } } } /* * Location: * /home/teridax/Projects/Gytebot/GYTEBOT.jar!/org/logic/GyteProcessor.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */