Object src = event.getSource();
if (src == cancelTaskMenuItem) {
if (selectedTask == null)
return;
TaskStatus status = selectedTask.getStatus();
if ((status == TaskStatus.WAITING)
|| (status == TaskStatus.PROCESSING)) {
selectedTask.cancel();
}
}
if (src == cancelAllMenuItem) {
for (WrappedTask wrappedTask : currentQueue) {
Task task = wrappedTask.getActualTask();
TaskStatus status = task.getStatus();
if ((status == TaskStatus.WAITING)
|| (status == TaskStatus.PROCESSING)) {
task.cancel();
}
}