| 1 | package de.uka.ipd.sdq.codegen.simucontroller.debug; |
| 2 | |
| 3 | import org.eclipse.debug.core.ILaunch; |
| 4 | |
| 5 | import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.DockModel; |
| 6 | |
| 7 | /** |
| 8 | * An implementation of the IDebugListener interface |
| 9 | * that... TODO |
| 10 | * (this was the standard debug listener implementation which now |
| 11 | * has its own class) |
| 12 | * |
| 13 | * TODO currently, the simucontroller.debug package is exported. |
| 14 | * Maybe, to hide the implementation, provide a factory which |
| 15 | * resides in a public package |
| 16 | * |
| 17 | * @author hauck |
| 18 | * |
| 19 | */ |
| 20 | public class SimulationDebugListener implements IDebugListener { |
| 21 | |
| 22 | private SimulationDebugTarget target = null; |
| 23 | |
| 24 | ILaunch launch = null; |
| 25 | |
| 26 | public SimulationDebugListener(ILaunch launch) { |
| 27 | this.launch = launch; |
| 28 | } |
| 29 | |
| 30 | public void simulationStartsInDock(DockModel dock) { |
| 31 | target = new SimulationDebugTarget(launch,dock); |
| 32 | launch.addDebugTarget(target); |
| 33 | } |
| 34 | |
| 35 | public void simulationStoppedInDock() { |
| 36 | if (target != null) { |
| 37 | // Wait for termination, needed as termination is reported via async events by the dock |
| 38 | while (!target.isTerminated()) { |
| 39 | try { |
| 40 | Thread.sleep(100); |
| 41 | } catch (InterruptedException e) { |
| 42 | } |
| 43 | } |
| 44 | launch.removeDebugTarget(target); |
| 45 | target.dispose(); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | } |