synchronized (this) {
try {
IProcessor processor =
getSimRuntimeInfo().getComputationTask().getProcessorInfo()
.getLocal();
IRunnable run = null;
if (processor instanceof IRunnable) {
run = (IRunnable) processor;
} else {
return;
}
if (!simControllingPossible()) {
SimSystem.report(Level.INFO,
"Computing the computation task stepwise is not possible.");
return;
}
ComputationRuntimeState state = getSimRuntimeInfo().getState();
if (state == ComputationRuntimeState.RUNNING) {
run.pause();
}
// show input dialog where the user can enter the steps amount to
// forward
String slowDown =
JOptionPane.showInputDialog(
"Please enter the delay in ms after each computation step.",
delay == null ? DEFAULT_SIMSTEP_DELAY_MS : delay);
// TODO fill with the current pause value set in the run object
if (slowDown == null) {
if (state == ComputationRuntimeState.RUNNING) {
run.pause();
}
return;
}
try {
delay = new Long(slowDown);
} catch (Exception ex) {
SimSystem.report(Level.INFO, "No valid delay given!");
}
run.setDelay(delay);
if (state == ComputationRuntimeState.RUNNING) {
run.pause();
// getSimRuntimeInfo().setState(SimulationRuntimeState.RUNNING);
}
} catch (Exception e2) {
}
}