Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/CreateTestFromProject.java

42 lines
1.6 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package Visual_DVM_2021.Passes.All;
import Common.Current;
import ProjectData.Files.FileState;
import ProjectData.Files.ProjectFile;
import ProjectData.Project.db_project_info;
import TestingSystem.Common.Group.Group;
//из текущего проекта.
public class CreateTestFromProject extends CreateTestFromDirectory {
db_project_info project;
@Override
public String getIconPath() {
return "/icons/RedAdd.png";
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (args.length == 0) {
if (Current.Check(Log, Current.Group, Current.Project)) {
project = Current.getProject();
if (super.canStart(Current.getProject().Home, Current.getGroup())){
from_files_chooser = true; //чтобы опубликовал.
return true;
}
}
} else {
project = (db_project_info) args[0];
group = (Group) args[1];
//если проект не текущий, освежить его бд.
if (!Current.HasProject() || !Current.getProject().Home.equals(project.Home)) {
project.Open();
project.Close();
}
return super.canStart(project.Home, group);
}
return false;
}
@Override
public boolean isNotExcluded(ProjectFile projectFile) {
return project.db.files.containsKey(projectFile.file.getName()) &&
!project.db.files.get(projectFile.file.getName()).state.equals(FileState.Excluded);
}
}