package _VisualDVM.Passes.All;
import Common.CommonConstants;
import Common.Passes.Pass;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.TestingSystem.DVM.DVMTasks.DVMRunTask;
public class CompareDVMRunTaskToEthalon extends Pass<DVMRunTask> {
    DVMRunTask ethalon = null;
    @Override
    public String getIconPath() {
        return "/icons/Comparsion.png";
    }
    @Override
    public String getButtonText() {
        return "";
    }
    @Override
    protected boolean canStart(Object... args) throws Exception {
        target = null;
        ethalon = null;
        if (Global.testingServer.db.dvmRunTasks.getUI().CheckCurrent(Log)) {
            //есть ли эталон у этой задачи.
            target = Global.testingServer.db.dvmRunTasks.getUI().getCurrent();
            if (target.ethalon_id != CommonConstants.Nan && Global.testingServer.db.dvmRunTasks.containsKey(target.ethalon_id)) {
                ethalon = Global.testingServer.db.dvmRunTasks.get(target.ethalon_id);
                return true;
            } else Log.Writeln_("Не найдено эталона для задачи " + Utils_.Brackets(target.id) + " !");
        }
        return false;
    }
    @Override
    protected void body() throws Exception {
        Global.mainModule.getUI().getMainWindow().getTestingWindow().CompareCurrentDVMTaskToEthalon(ethalon, target);
    }
    @Override
    protected void showFinish() throws Exception {
        Global.mainModule.getUI().getMainWindow().getTestingWindow().FocusTestingTasksComparison();
    }
}
