package _VisualDVM.GlobalData.Tasks.Passes;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Tasks.Supervisor.TaskSupervisor;
import _VisualDVM.Passes.ProcessPass;
public abstract class TaskLocalPass<S extends TaskSupervisor> extends ProcessPass {
    public S supervisor; //инициализация идет в конструкторе потомка.
    public TaskLocalPass(Class<S> s_class) {
        try {
            supervisor = s_class.newInstance();
        } catch (Exception e) {
            Utils_.MainLog.PrintException(e);
        }
    }
    @Override
    protected boolean needsAnimation() {
        return true;
    }
    @Override
    protected void body() throws Exception {
        supervisor.PerformTask();
    }
    @Override
    protected void performFinish() throws Exception {
        supervisor.UpdateTask();
    }
    @Override
    public void Interrupt() throws Exception {
        Global.mainModule.getProject().CreateInterruptFile();
    }
}
