рефакторинг.
реализовал добавление выделенных файлов в текущую группу, в качестве тестов.
This commit is contained in:
68
src/Visual_DVM_2021/Passes/All/PublishTests.java
Normal file
68
src/Visual_DVM_2021/Passes/All/PublishTests.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import TestingSystem.Common.Test.Test;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public abstract class PublishTests extends TestingSystemPass<Vector<Test>> {
|
||||
protected Group group;
|
||||
//----
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishObjects, null, target));
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
passes.get(PassCode_2021.SynchronizeTests).Do();
|
||||
}
|
||||
@Override
|
||||
protected void FocusResult() {
|
||||
UI.getMainWindow().FocusTests();
|
||||
}
|
||||
//--
|
||||
protected abstract PassCode_2021 getCreateTestCode();
|
||||
protected abstract String getNoFilesMessage();
|
||||
//--
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
Vector<File> files = (Vector<File>) args[0];
|
||||
group = (Group) args[1];
|
||||
target = new Vector<>();
|
||||
//---------------------
|
||||
if (files.isEmpty()) {
|
||||
Log.Writeln_("Не найдено " + getNoFilesMessage() + " для формирования тестов.");
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
Pass_2021 createTestPass = passes.get(getCreateTestCode());
|
||||
//---
|
||||
for (File file : files) {
|
||||
if (createTestPass.Do(file, group))
|
||||
target.add((Test) createTestPass.target);
|
||||
}
|
||||
//---
|
||||
if (target.isEmpty()) {
|
||||
Log.Writeln_("Не удалось создать ни одного теста.");
|
||||
return false;
|
||||
}
|
||||
//---
|
||||
return UI.Question("В группу " + Utils.Brackets(group.description) +
|
||||
"\nбудет добавлено " + target.size() + " тестов.\nПродолжить");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user