use of net.sf.mzmine.taskcontrol.impl.WrappedTask in project mzmine2 by mzmine.
the class TaskProgressTable method actionPerformed.
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent event) {
TaskControllerImpl taskController = (TaskControllerImpl) MZmineCore.getTaskController();
WrappedTask[] currentQueue = taskController.getTaskQueue().getQueueSnapshot();
Task selectedTask = null;
int selectedRow = taskTable.getSelectedRow();
if ((selectedRow < currentQueue.length) && (selectedRow >= 0))
selectedTask = currentQueue[selectedRow].getActualTask();
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();
}
}
}
if (src == highPriorityMenuItem) {
if (selectedTask == null)
return;
taskController.setTaskPriority(selectedTask, TaskPriority.HIGH);
}
if (src == normalPriorityMenuItem) {
if (selectedTask == null)
return;
taskController.setTaskPriority(selectedTask, TaskPriority.NORMAL);
}
}
Aggregations