создание группы из папки.

This commit is contained in:
2023-11-20 22:10:21 +03:00
parent 0cfa94eba8
commit 577803515e
10 changed files with 126 additions and 34 deletions

View File

@@ -1,12 +1,9 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants;
import Common.Current;
import Common.Global;
import Common.Utils.Files.VDirectoryChooser;
import Common.Utils.Utils;
import GlobalData.Settings.SettingName;
import ProjectData.Project.db_project_info;
import TestingSystem.Common.Group.Group;
import TestingSystem.Common.Test.Test;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;
@@ -14,7 +11,7 @@ import Visual_DVM_2021.Passes.Pass_2021;
import java.io.File;
public class CreateTestFromDirectory extends Pass_2021<Test> {
db_project_info project = null;
Group group= null;
int group_id;
File dir;
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки теста");
@Override
@@ -29,28 +26,22 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
protected boolean needsAnimation() {
return true;
}
void restoreBrowserPath() {
String last_dir_home =
Global.db.settings.get(SettingName.ProjectsSearchDirectory).Value;
if (!last_dir_home.isEmpty())
directoryChooser.SetCurrentDirectory(last_dir_home);
}
@Override
protected boolean canStart(Object... args) throws Exception {
group = null;
group_id = Constants.Nan;
project = null;
dir = null;
target = null;
//-
if (args.length == 0) {
restoreBrowserPath();
Utils.RestoreSelectedDirectory(directoryChooser);
if (!Current.Check(Log, Current.Group))
return false;
group = Current.getGroup();
group_id = Current.getGroup().id;
dir = directoryChooser.ShowDialog();
} else {
dir = (File) args[0];
group = (Group) args[1];
group_id = (int) args[1];
}
//-
if (dir == null)
@@ -81,6 +72,6 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
@Override
protected void performDone() throws Exception {
super.performDone();
passes.get(PassCode_2021.PublishTest).Do(project,group);
passes.get(PassCode_2021.PublishTest).Do(project,group_id);
}
}