void (ExternalSystemTaskNotificationEvent event) { if (event instanceof ExternalSystemBuildEvent) { BuildEvent buildEvent = ((ExternalSystemBuildEvent)event).getBuildEvent(); if (buildEvent instanceof FileDownloadedEventImpl) { long duration = ((FileDownloadedEventImpl)buildEvent).getDuration(); String operationName = buildEvent.getMessage(); String text = String.format("%s, took %s", operationName, formatDuration(duration)); myListener.onTaskOutput(myTaskId, "\r" + text + "\n", true); } if (buildEvent instanceof FileDownloadEventImpl) { long progress = ((FileDownloadEventImpl)buildEvent).getProgress(); long total = ((FileDownloadEventImpl)buildEvent).getTotal(); String operationName = buildEvent.getMessage(); String text = String.format("%s (%s / %s)", operationName, formatFileSize(progress), formatFileSize(total)); if (((FileDownloadEventImpl)buildEvent).isFirstInGroup()) { myListener.onTaskOutput(myTaskId, text, true); } else { myListener.onTaskOutput(myTaskId, "\r" + text, true); } } } }