рефакторинг массовых удалений объектов

This commit is contained in:
2024-10-16 18:58:23 +03:00
parent cf660d26ea
commit 788bd67201
21 changed files with 170 additions and 53 deletions

View File

@@ -22,7 +22,7 @@ public class CompareDVMRunTasks extends Pass<Vector<DVMRunTask>> {
master = null;
slave = null;
//--
target = Global.testingServer.db.dvmRunTasks.getCheckedItems();
target = Global.testingServer.db.dvmRunTasks.getSelectedItems();
if (target.size() == 2) {
if (UI.Question("Назначить задачу " + Utils_.Brackets(target.get(0).getPK()) + " эталоном" +
"\n(в случае отказа, будет назначена задача " + Utils_.Brackets(target.get(1).getPK()) + ")")) {

View File

@@ -22,7 +22,7 @@ public class CompareSapforPackages extends Pass<Vector<SapforPackage>> {
master = null;
slave = null;
//--
target = Global.testingServer.db.sapforPackages.getCheckedItems();
target = Global.testingServer.db.sapforPackages.getSelectedItems();
if (target.size() == 2) {
if (UI.Question("Назначить пакет " + Utils_.Brackets(target.get(0).getPK()) + " эталоном" +
"\n(в случае отказа, будет назначен пакет " + Utils_.Brackets(target.get(1).getPK()) + ")")) {

View File

@@ -13,18 +13,18 @@ public class DeleteSelectedFiles extends Pass {
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (Global.mainModule.getProject().db.files.getCheckedCount() == 0) {
if (Global.mainModule.getProject().db.files.getSelectedCount() == 0) {
Log.Writeln_("Не отмечено ни одного файла.");
return false;
}
return UI.Warning("Удалить " + Global.mainModule.getProject().db.files.getCheckedCount() + " файлов.");
return UI.Warning("Удалить " + Global.mainModule.getProject().db.files.getSelectedCount() + " файлов.");
}
@Override
protected void performPreparation() throws Exception {
boolean hasCurrent = false;
boolean hasSelected = false;
if (Global.mainModule.HasFile()) {
for (DBProjectFile file : Global.mainModule.getProject().db.files.getCheckedItems()) {
for (DBProjectFile file : Global.mainModule.getProject().db.files.getSelectedItems()) {
if (Global.mainModule.getFile().file.equals(file.file))
hasCurrent = true;
if (Global.mainModule.getSelectedFile().file.equals(file.file))
@@ -44,7 +44,7 @@ public class DeleteSelectedFiles extends Pass {
}
@Override
protected void body() throws Exception {
for (DBProjectFile file : Global.mainModule.getProject().db.files.getCheckedItems()) {
for (DBProjectFile file : Global.mainModule.getProject().db.files.getSelectedItems()) {
ShowMessage1(file.name);
Global.mainModule.getUI().getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(file.node);
Global.mainModule.getProject().db.Delete(file);

View File

@@ -16,7 +16,7 @@ public class ExcludeSelectedFiles extends Pass<Vector<DBProjectFile>> {
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора файлов.");
return false;
}
target = Global.mainModule.getProject().db.files.getCheckedItems();
target = Global.mainModule.getProject().db.files.getSelectedItems();
if (target.isEmpty()) {
Log.Writeln_("Не отмечено ни одного файла.");
return false;

View File

@@ -58,8 +58,8 @@ public class ExportDVMPackageToExcel extends Pass<Vector<DVMPackage>> {
styles = null;
target = null;
//--
if (Global.testingServer.db.dvmPackages.getCheckedCount() > 0) {
target = Global.testingServer.db.dvmPackages.getCheckedItems();
if (Global.testingServer.db.dvmPackages.getSelectedCount() > 0) {
target = Global.testingServer.db.dvmPackages.getSelectedItems();
} else {
if (Global.mainModule.Check(Log, Current.DVMPackage)) {
target = new Vector<>();

View File

@@ -16,7 +16,7 @@ public class IncludeSelectedFiles extends Pass<Vector<DBProjectFile>> {
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора файлов.");
return false;
}
target = Global.mainModule.getProject().db.files.getCheckedItems();
target = Global.mainModule.getProject().db.files.getSelectedItems();
if (target.isEmpty()) {
Log.Writeln_("Не отмечено ни одного файла.");
return false;

View File

@@ -43,11 +43,10 @@ public class StartSelectedDVMConfigurations extends PublishServerObject<TestingS
if (!Global.mainModule.getCompiler().versionLoaded)
Global.mainModule.getPass(PassCode.ShowCompilerVersion).Do(Global.mainModule.getCompiler(), false);
//-----
Vector<DVMConfiguration> configurations = Global.testingServer.db.dvm_configurations.getCheckedOrCurrent();
if (configurations.isEmpty()) {
Log.Writeln_("Не отмечено ни одной конфигурации, или отсутствует текущая конфигурация.");
if (!Global.testingServer.db.dvm_configurations.CheckSelectedOrCurrent(Log)){
return false;
}
Vector<DVMConfiguration> configurations = Global.testingServer.db.dvm_configurations.getSelectedOrCurrent();
//---
target = new DVMPackage(
Global.mainModule.getAccount(),

View File

@@ -35,11 +35,10 @@ public class StartSelectedSAPFORConfigurations extends PublishServerObject<Testi
return false;
}
//--
configurations = Global.testingServer.db.sapforConfigurations.getCheckedOrCurrent();
if (configurations.isEmpty()) {
Log.Writeln_("Не отмечено ни одной конфигурации, или отсутствует текущая конфигурация.");
if (!Global.testingServer.db.sapforConfigurations.CheckSelectedOrCurrent(Log)){
return false;
}
configurations = Global.testingServer.db.sapforConfigurations.getSelectedOrCurrent();
target = new SapforPackage(Global.mainModule.getAccount(),
Global.mainModule.getServerSapfor(),
configurations,

View File

@@ -22,18 +22,18 @@ public class UpdateSelectedComponents extends Pass<Vector<Component>> {
protected boolean canStart(Object... args) throws Exception {
target = new Vector<>();
//------------------------
if (Global.Components.getCheckedCount() == 0) {
if (Global.Components.getSelectedCount() == 0) {
Log.Writeln_("Не отмечено ни одного компонента!");
return false;
}
target = Global.Components.getCheckedItems();
target = Global.Components.getSelectedItems();
return true;
}
@Override
public String getStartDescription() {
Vector<String> question = new Vector<>();
question.add("Обновить компоненты");
for (Component component : Global.Components.getCheckedItems()) {
for (Component component : Global.Components.getSelectedItems()) {
question.add(component.getComponentType().getDescription());
}
return String.join("\n", question);