final ListenerToLog log = getLog();
try
{
SimulationEngine.eclipseEnvironment = true;
final SimulationEngine engine = getEngine();
UIJob listeners = new UIJob("Set Listeners")
{
@Override
public IStatus runInUIThread(IProgressMonitor monitor)
{
final String engineViewId = IDebugConstants.ENGINE_VIEW_ID;
final InfoTableView engineView = getInfoTableView(engineViewId);
views.add(engineView);
engine.engineListeners.add(new EngineListener(engineView));
if (showDebugInfo)
{
final String messageViewId = IDebugConstants.MESSAGE_VIEW_ID;
final String simulationViewId = IDebugConstants.SIMULATION_VIEW_ID;
final InfoTableView messageView = getInfoTableView(messageViewId);
final InfoTableView simulationView = getInfoTableView(simulationViewId);
views.add(messageView);
views.add(simulationView);
engine.messageListeners.add(new MessageListener(messageView));
engine.simulationListeners.add(new SimulationListener(simulationView));
for (InfoTableView view : views)
{
view.refreshPackTable();
}
}
return new Status(IStatus.OK, IDebugConstants.PLUGIN_ID, "Listeners OK");
}
};
listeners.schedule();
if (enableLogging)
{
engine.engineListeners.add(log);
engine.messageListeners.add(log);
engine.simulationListeners.add(log);
engine.variablesSyncListeners.add(log);
}
if (!remoteDebug)
{
File libSearchRoot = new File(project.getLocation().toFile(), "lib");
engine.setDeSimulationLauncher(new VdmRtBundleLauncher(deFile, deUrl.getPort(), libSearchRoot));// new
} else
{
deUrl = new URL(IDebugConstants.DEFAULT_DE_ENDPOINT.replaceAll("PORT", Integer.valueOf(8080).toString()));
engine.setDeSimulationLauncher(new VdmRtLauncher(5000));
}
final int deDebugPort = findFreePort();
ModelConfig deModel = getDeModelConfig(project, deDebugPort);
engine.setDeModel(deModel);
engine.setDeEndpoint(deUrl);
if (!useRemoteCtSimulator)
{
// engine.setCtSimulationLauncher(new
// Clp20SimStatelessProgramLauncher(ctFile));
// engine.setCtSimulationLauncher(new
// Clp20SimProgramLauncher(ctFile));
engine.setCtSimulationLauncher(selectClp20SimLauncher(engine, ctFile));
engine.setCtEndpoint(new URL(IDebugConstants.DEFAULT_CT_ENDPOINT));
} else
{
engine.setCtSimulationLauncher(new DummyLauncher("CT simulator"));
engine.setCtEndpoint(ctUrl);
}
ModelConfig ctModel = getCtModelConfig(ctFile);
engine.setCtModel(ctModel);
setCtSettings(engine);
setCtImplementations(engine);
engine.setOutputFolder(outputFolder);
engine.debug(debug);
engine.addProcessCreationListener(new IProcessCreationListener()
{
public void processCreated(String name, Process p)
{
launch.addProcess(DebugPlugin.newProcess(launch, p, name));
}