Обратная сортировка версий сапфора и коммит старых измений
This commit is contained in:
@@ -15,9 +15,9 @@ import Visual_DVM_2021.Passes.Pass_2021;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки теста");
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/OpenProject.png";
|
||||
@@ -32,9 +32,30 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
}
|
||||
Group group = null;
|
||||
File dir = null;
|
||||
boolean from_directory_chooser = false;
|
||||
boolean from_files_chooser = false;
|
||||
//--
|
||||
void saveDirectory() {
|
||||
Pass_2021.passes.get(PassCode_2021.UpdateSetting).Do(SettingName.ProjectsSearchDirectory,
|
||||
(dir.getParentFile() == null) ? dir.getAbsolutePath() : dir.getParent()
|
||||
);
|
||||
}
|
||||
Vector<File> files = null;
|
||||
protected boolean selectFiles() {
|
||||
VDirectoryChooser directoryChooser = new VDirectoryChooser("Выбор домашней папки теста");
|
||||
Utils.RestoreSelectedDirectory(directoryChooser);
|
||||
dir = directoryChooser.ShowDialog();
|
||||
if (dir == null) {
|
||||
Log.Writeln_("Папка не выбрана.");
|
||||
return false;
|
||||
} else {
|
||||
files = new Vector<>(Arrays.asList(dir.listFiles()));
|
||||
saveDirectory();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//--
|
||||
Vector<ProjectFile> project_files = new Vector<>();
|
||||
protected boolean initTarget() throws Exception{
|
||||
protected boolean initTarget() throws Exception {
|
||||
target = new Test();
|
||||
target.sender_address = Current.getAccount().email;
|
||||
target.sender_name = Current.getAccount().name;
|
||||
@@ -44,26 +65,23 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
files = null;
|
||||
if (args.length == 0) {
|
||||
from_directory_chooser = true;
|
||||
//--
|
||||
from_files_chooser = true;
|
||||
if (!Current.Check(Log, Current.Group))
|
||||
return false;
|
||||
Utils.RestoreSelectedDirectory(directoryChooser);
|
||||
dir = directoryChooser.ShowDialog();
|
||||
group = Current.getGroup();
|
||||
if (dir == null) {
|
||||
Log.Writeln_("Папка не выбрана.");
|
||||
if (!selectFiles())
|
||||
return false;
|
||||
} else {
|
||||
Pass_2021.passes.get(PassCode_2021.UpdateSetting).Do(SettingName.ProjectsSearchDirectory, dir.getParent());
|
||||
}
|
||||
//-
|
||||
} else {
|
||||
from_directory_chooser = false;
|
||||
from_files_chooser = false;
|
||||
dir = (File) args[0];
|
||||
group = (Group) args[1];
|
||||
files = new Vector<>(Arrays.asList(dir.listFiles()));
|
||||
}
|
||||
//---
|
||||
File[] files = dir.listFiles();
|
||||
int subdirs = 0;
|
||||
int bad = 0;
|
||||
int active_programs = 0;
|
||||
@@ -192,7 +210,7 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
if (from_directory_chooser)
|
||||
if (from_files_chooser)
|
||||
passes.get(PassCode_2021.PublishTest).Do(target);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user