рефакторинг удаления пакета

This commit is contained in:
2023-11-18 02:37:56 +03:00
parent f52139a8b5
commit 022ece9c49
4 changed files with 38 additions and 48 deletions

View File

@@ -1,52 +1,32 @@
package Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.UI.UI;
import Common.Utils.Utils;
import TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
import TestingSystem.DVM.TasksPackage.TasksPackageState;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
public class DeleteSapforTasksPackage extends TestingSystemPass<SapforTasksPackage> {
@Override
public String getIconPath() {
return "/icons/Delete.png";
import TestingSystem.SAPFOR.SapforTasksPackage.SapforTasksPackage;
import Visual_DVM_2021.Passes.Server.DeleteServerAccountObject;
public class DeleteSapforTasksPackage extends DeleteServerAccountObject<SapforTasksPackage> {
public DeleteSapforTasksPackage() {
super(SapforTasksPackage.class);
}
@Override
public String getButtonText() {
return "";
public boolean checkActivity() {
if (!target.state.equals(TasksPackageState.Done) && !target.state.equals(TasksPackageState.Aborted)) {
Log.Writeln_("Нельзя удалить активный пакет!");
return false;
}
return true;
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (Current.Check(Log, Current.SapforTasksPackage)) {
target = Current.getSapforTasksPackage();
if (!target.state.equals(TasksPackageState.Done) && !target.state.equals(TasksPackageState.Aborted)) {
Log.Writeln_("Нельзя удалить активный пакет!");
} else
return true;
}
return false;
return super.canStart(args) && checkActivity();
}
@Override
protected void showPreparation() throws Exception {
UI.getMainWindow().getTestingWindow().DropSapforComparison();
}
@Override
protected void ServerAction() throws Exception {
DeleteAccountObject(target);
}
@Override
protected void performDone() throws Exception {
super.performDone();
Utils.delete_with_check(target.getLocalWorkspace());
passes.get(PassCode_2021.SynchronizeTestsTasks).Do();
}
}
/*
@Override
protected void performPreparation() throws Exception {
if (Current.hasUI()&&Current.HasSapforTasksPackage()) {
UI.getMainWindow().getTestingWindow().RemoveSapforPackageFromComparison();
}
*/