package _VisualDVM.Passes.All;
import Common.Visual.UI_;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
import _VisualDVM.Visual.UI;
public class SPF_GetArrayDistribution extends SPF_GetArrayDistributionOnlyAnalysis {
    @Override
    protected void performDone() throws Exception {
        super.performDone();
        SapforAnalysis code_analysis = (SapforAnalysis) Global.mainModule.getPass(PassCode.SPF_GetArrayDistributionOnlyAnalysis);
        if (!code_analysis.isDone()) {
            code_analysis.setDone();
            code_analysis.MarkAsDone();
        }
    }
    @Override
    protected void showDone() throws Exception {
        super.showDone();
        UI.getVersionsWindow().UnblockVariants();
        UI.getVersionsWindow().getVariantsWindow().ShowVariants();
    }
    @Override
    protected void FocusResult() {
        super.FocusResult();
        UI.getMainWindow().getProjectWindow().FocusVersions();
        UI.getVersionsWindow().FocusDistribution();
    }
    @Override
    protected boolean canStart(Object... args) throws Exception {
        if (Global.mainModule.getDb().settings.get(SettingName.MPI_PROGRAM).toBoolean()) {
            UI_.Info("Включена настройка SAPFOR 'MPI программа'." +
                    "\nПостроение распределения данных невозможно.");
            Global.mainModule.getPass(PassCode.SPF_SharedMemoryParallelization).Do();
            return false;
        }
        return super.canStart(args);
    }
    @Override
    public String getDescription() {
        return Global.mainModule.getPassDescription(getName());
    }
}
