Files
VisualSapfor/src/_VisualDVM/Passes/All/DeleteSelectedCompilationTasks.java

47 lines
1.7 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package _VisualDVM.Passes.All;
import Common.Passes.Pass;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
import java.util.Vector;
public class DeleteSelectedCompilationTasks extends Pass<Vector<CompilationTask>> {
@Override
public String getIconPath() {
return "/Common/icons/Delete.png";
}
@Override
public String getButtonText() {
return "";
}
@Override
protected boolean canStart(Object... args) throws Exception {
target = new Vector<>();
Global.mainModule.getDb().compilationTasks.Data.values().stream().filter(task -> task.isVisible() && task.isSelected() && task.isPassive()).forEach(task -> target.add(task));
if (target.isEmpty()) {
Log.Writeln_("Не отмечено ни одной задачи для удаления.");
return false;
} else return true;
}
@Override
protected void showPreparation() throws Exception {
Global.mainModule.getDb().compilationTasks.ClearUI();
}
@Override
protected void body() throws Exception {
for (CompilationTask task : target) {
for (RunTask runTask : task.getRunTasks().values()) {
Global.mainModule.getDb().Delete(runTask);
Utils_.forceDeleteWithCheck(runTask.getLocalWorkspace());
}
Global.mainModule.getDb().Delete(task);
Utils_.forceDeleteWithCheck(task.getLocalWorkspace());
}
}
@Override
protected void showFinish() throws Exception {
Global.mainModule.getDb().compilationTasks.ShowUI();
}
}