use of xyz.elmot.clion.openocd.OpenOcdComponent.STATUS in project clion-embedded-arm by elmot.
the class OpenOcdLauncher method startDebugProcess.
@NotNull
@Override
public CidrDebugProcess startDebugProcess(@NotNull CommandLineState commandLineState, @NotNull XDebugSession xDebugSession) throws ExecutionException {
Project project = commandLineState.getEnvironment().getProject();
File runFile = findRunFile(commandLineState);
try {
xDebugSession.stop();
OpenOcdComponent openOcdComponent = findOpenOcdAction(commandLineState.getEnvironment().getProject());
openOcdComponent.stopOpenOcd();
Future<STATUS> downloadResult = openOcdComponent.startOpenOcd(project, runFile, "reset init");
ThrowableComputable<STATUS, ExecutionException> process = () -> {
try {
ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
return downloadResult.get(10, TimeUnit.MINUTES);
} catch (InterruptedException | TimeoutException | java.util.concurrent.ExecutionException e) {
throw new ExecutionException(e);
}
};
STATUS downloadStatus = ProgressManager.getInstance().runProcessWithProgressSynchronously(process, "Firmware Download", true, getProject());
if (downloadStatus == STATUS.FLASH_ERROR) {
downloadResult.cancel(true);
throw new ExecutionException("OpenOCD cancelled");
}
return super.startDebugProcess(commandLineState, xDebugSession);
} catch (ConfigurationException e) {
Messages.showErrorDialog(getProject(), e.getLocalizedMessage(), e.getTitle());
throw new ExecutionException(e);
}
}
Aggregations