рефакторинг. переносил текущие объекты в другое место

This commit is contained in:
2024-10-13 22:08:13 +03:00
parent 09b64218bd
commit 6afa2dc892
240 changed files with 1472 additions and 1518 deletions

View File

@@ -29,22 +29,22 @@ public class AddBugReport extends AddObjectPass<BugReport> {
}
@Override
public boolean canStart(Object... args) throws Exception {
if (Current.getAccount().role.equals(AccountRole.Undefined)) {
if (Global.mainModule.getAccount().role.equals(AccountRole.Undefined)) {
Log.Writeln_("Для создания отчёта требуется регистрация");
return false;
}
if (Current.HasProject()) {
String version = Current.getProject().Home.getAbsolutePath().substring(Current.getRoot().Home.getParent().length());
if (Global.mainModule.HasProject()) {
String version = Global.mainModule.getProject().Home.getAbsolutePath().substring(Global.mainModule.getRoot().Home.getParent().length());
if (version.toCharArray()[0] == '\\') version = version.substring(1);
target = new BugReport(Current.getAccount().name, Current.getAccount().email,
target = new BugReport(Global.mainModule.getAccount().name, Global.mainModule.getAccount().email,
"Черновик отчёта об ошибке.\nЗаполните описание ошибочной ситуации, и нажмите 'Опубликовать'", version);
return true;
} else {
if (UI_.Warning("Создать отчёт об ошибке без прикрепления проекта.")) {
target = new BugReport();
target.genName();
target.sender_name = Current.getAccount().name;
target.sender_address = Current.getAccount().email;
target.sender_name = Global.mainModule.getAccount().name;
target.sender_address = Global.mainModule.getAccount().email;
target.project_version = "";
target.visualiser_version = Global.visualiser.version;
target.sapfor_version = Global.Components.get(ComponentType.Sapfor_F).version;
@@ -62,15 +62,15 @@ public class AddBugReport extends AddObjectPass<BugReport> {
}
@Override
protected void performPreparation() throws Exception {
Current.getSapfor().ResetAllAnalyses();
Global.mainModule.getSapfor().ResetAllAnalyses();
}
@Override
protected void body() throws Exception {
super.body();
if (!target.project_version.isEmpty()) {
Current.getRoot().cleanDepAndGCOVR(); //удаление депов и гкова
Global.mainModule.getRoot().cleanDepAndGCOVR(); //удаление депов и гкова
//логи во вложения.
File attachementsDir = Current.getProject().getAttachmentsDirectory();
File attachementsDir = Global.mainModule.getProject().getAttachmentsDirectory();
Vector<File> logs = new Vector<>();
logs.add(Utils_.MainLog.getLogFile());
logs.add(Paths.get(Global.ComponentsDirectory.getAbsolutePath(), "Sapfor_log.txt").toFile());
@@ -81,7 +81,7 @@ public class AddBugReport extends AddObjectPass<BugReport> {
Files.copy(file.toPath(), Paths.get(attachementsDir.getAbsolutePath(), file.getName()), StandardCopyOption.REPLACE_EXISTING);
}
//запаковка рута
passes.get(PassCode.ZipFolderPass).Do(Current.getRoot().Home.getAbsolutePath(), BugReportInterface.getArchiveFile(target).getAbsolutePath());
passes.get(PassCode.ZipFolderPass).Do(Global.mainModule.getRoot().Home.getAbsolutePath(), BugReportInterface.getArchiveFile(target).getAbsolutePath());
}
}
@Override