промежуточный. небольшой рефакторинг. наследие DBProjectFile от ProjectFile.
This commit is contained in:
18
.idea/workspace.xml
generated
18
.idea/workspace.xml
generated
@@ -7,19 +7,15 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforVersionComparisonForm.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/ProjectData/Files/ProjectFile.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Current.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Current.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Constants.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ProjectData/Files/DBProjectFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Files/DBProjectFile.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ProjectData/Project/db_project_info.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ProjectData/Project/db_project_info.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/Json/SapforVersion_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/Json/SapforVersion_json.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTask/SapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTask/SapforTask.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackageInterface.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackageInterface.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackageTree.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTasksPackage/SapforTasksPackageTree.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/ComparisonForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/ComparisonForm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackageFields.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackageFields.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackageForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackageForm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackagesComparisonForm.form" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackagesComparisonForm.form" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackagesComparisonForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/SapforPackagesComparisonForm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.form" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.form" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -117,11 +113,11 @@
|
||||
<recent name="C:\Users\misha\Documents\visual_dvm_2020\src\files\Planner" />
|
||||
</key>
|
||||
<key name="MoveMembersDialog.RECENTS_KEY">
|
||||
<recent name="TestingSystem.TestingServer" />
|
||||
<recent name="Common.Constants" />
|
||||
<recent name="SapforTestingSystem.SapforTask.SapforTask" />
|
||||
<recent name="TestingSystem.TestingServer" />
|
||||
<recent name="Common.Constants.Constants" />
|
||||
<recent name="Constants" />
|
||||
<recent name="Common.Utils.InterruptThread" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\misha\Documents\visual_dvm_2020\src\Visual_DVM_2021\Passes\UI" />
|
||||
|
||||
@@ -41,6 +41,22 @@ public class Constants {
|
||||
};
|
||||
public static final int parser_group = -1;
|
||||
public static final int compiler_group = -2;
|
||||
// DBProjectFile
|
||||
public static final String no_data = "Нет данных";
|
||||
public static final String dep = ".dep";
|
||||
public static final String out = ".out";
|
||||
public static final String err = ".err";
|
||||
public static final String makefile = "Makefile";
|
||||
//db_project_info
|
||||
public static final String launch_script_name = "run";
|
||||
public static final String default_binary_name = "0";
|
||||
public static final String spf = "spf.proj";
|
||||
public static final String options = "options";
|
||||
public static final String gcov = "gcov";
|
||||
public static final String attachments = "attachments";
|
||||
public static final String statistic = "statistic";
|
||||
public static final String unknown_metric = " — ";
|
||||
|
||||
//--
|
||||
//https://losst.ru/komandy-terminala-linux
|
||||
public static String[] linux_system_commands = new String[]{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ProjectData.Files;
|
||||
import Common.Constants;
|
||||
import Common.Current;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.GCOV.GCOV_info;
|
||||
@@ -17,62 +16,41 @@ import ProjectData.SapforData.Functions.FuncCall;
|
||||
import ProjectData.SapforData.Functions.FuncInfo;
|
||||
import ProjectData.SapforData.Loops.Loop;
|
||||
import Visual_DVM_2021.UI.Main.FileForm;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
//по файлам нет смысла делать совместимость.
|
||||
//так что переименую
|
||||
public class DBProjectFile extends DBObject {
|
||||
public static final String no_data = "Нет данных";
|
||||
public static final String dep = ".dep";
|
||||
public static final String out = ".out";
|
||||
public static final String err = ".err";
|
||||
//</editor-fold>
|
||||
//<editor-fold desc="хранимые в бд поля">
|
||||
|
||||
@Description("PRIMARY KEY, UNIQUE") @Expose
|
||||
public class DBProjectFile extends ProjectFile {
|
||||
@Description("PRIMARY KEY, UNIQUE")
|
||||
public String name; //имя относительно корневой папки проекта. нужно только как ключ для бд!!
|
||||
@Description("IGNORE")
|
||||
public String last_assembly_name = ""; //имя объектника.
|
||||
//--------------------------------------
|
||||
//в сотальных случаях используем file.
|
||||
@Expose
|
||||
public FileType fileType = FileType.none;
|
||||
@Expose
|
||||
public LanguageName languageName = LanguageName.n;
|
||||
@Expose
|
||||
public LanguageStyle style = LanguageStyle.none;
|
||||
public String options = ""; //пользовательские опции для парсера.
|
||||
// public int caretPosition = 0;
|
||||
//---
|
||||
@Description("DEFAULT 0")
|
||||
public int lastLine = 0;
|
||||
@Description("DEFAULT ''")
|
||||
public String GCOVLog = "";
|
||||
//---
|
||||
public FileState state = FileState.Undefined; //состояние файла.
|
||||
public int isMain = 0; //содержит ли ГПЕ
|
||||
@Description("IGNORE")
|
||||
public int lines_count = 0;
|
||||
@Description("IGNORE")
|
||||
public boolean NeedsSave = false;
|
||||
@Description("IGNORE")
|
||||
public String LoopGraphTitle = no_data;
|
||||
public String LoopGraphTitle = Constants.no_data;
|
||||
@Description("IGNORE")
|
||||
public String CallGraphTitle = no_data;
|
||||
public String CallGraphTitle = Constants.no_data;
|
||||
@Description("IGNORE")
|
||||
public String ArrayGraphTitle = no_data;
|
||||
public String ArrayGraphTitle = Constants.no_data;
|
||||
public db_project_info father = null;
|
||||
public File file = null;
|
||||
public DefaultMutableTreeNode node = null; //узел файла в дереве
|
||||
public FileForm form = null; //отображение.
|
||||
//сообщения.
|
||||
@@ -144,111 +122,11 @@ public class DBProjectFile extends DBObject {
|
||||
//для совместимости пусть палки будут от винды всегда.
|
||||
name = path.substring(father.Home.getAbsolutePath().length() + 1).replace('/', '\\');
|
||||
}
|
||||
public void AutoDetectProperties() {
|
||||
//проверка запретных имен.
|
||||
String[] forbiddenNames = new String[]{
|
||||
Constants.INTERRUPT,
|
||||
db_project_info.launch_script_name,
|
||||
db_project_info.default_binary_name,
|
||||
//--
|
||||
Constants.DONE,
|
||||
Constants.TIMEOUT,
|
||||
Constants.out_file,
|
||||
Constants.err_file,
|
||||
Constants.time_file,
|
||||
"Makefile"
|
||||
};
|
||||
for (String forbidden : forbiddenNames) {
|
||||
if (file.getName().equalsIgnoreCase(forbidden)) {
|
||||
fileType = FileType.forbidden;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//-
|
||||
switch (Utils.getExtension(file)) {
|
||||
case "f":
|
||||
case "fdv":
|
||||
case "for":
|
||||
case "f77":
|
||||
fileType = FileType.program;
|
||||
languageName = LanguageName.fortran;
|
||||
style = LanguageStyle.fixed;
|
||||
break;
|
||||
case "f90":
|
||||
fileType = FileType.program;
|
||||
languageName = LanguageName.fortran;
|
||||
style = LanguageStyle.free;
|
||||
break;
|
||||
case "c":
|
||||
case "cdv":
|
||||
fileType = FileType.program;
|
||||
languageName = LanguageName.c;
|
||||
break;
|
||||
case "cpp":
|
||||
fileType = FileType.program;
|
||||
languageName = LanguageName.cpp;
|
||||
break;
|
||||
case "h":
|
||||
fileType = FileType.header;
|
||||
break;
|
||||
case "fh":
|
||||
fileType = FileType.header;
|
||||
languageName = LanguageName.fortran;
|
||||
break;
|
||||
case "o":
|
||||
case "gcda":
|
||||
case "gcno":
|
||||
case "gcov":
|
||||
case "exe":
|
||||
case "pdf":
|
||||
fileType = FileType.forbidden;
|
||||
break;
|
||||
case "":
|
||||
if (Utils.isDigit(file.getName())) {
|
||||
fileType = FileType.forbidden;
|
||||
} else {
|
||||
state = FileState.Excluded;
|
||||
fileType = FileType.none;
|
||||
languageName = LanguageName.n;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//все остальное считаем исключенными из рассмотрения.
|
||||
//если юзеру надо сам их разблочит.
|
||||
state = FileState.Excluded;
|
||||
fileType = FileType.none;
|
||||
languageName = LanguageName.n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMakefile() {
|
||||
return file.getName().equalsIgnoreCase("makefile");
|
||||
}
|
||||
public String ImageKey() {
|
||||
//icons/files/Excludeddata.png
|
||||
String pref = "/icons/files/";
|
||||
String body;
|
||||
switch (fileType) {
|
||||
case program:
|
||||
body = state.toString() + languageName.toString();
|
||||
break;
|
||||
case data:
|
||||
body= "Undefined"; // иных состояний у данных не бывает. ситуация возникает если по ошибке поменяли тип
|
||||
//нормальных файлов с сообщениями на дату.
|
||||
break;
|
||||
default:
|
||||
body = state.toString();
|
||||
break;
|
||||
}
|
||||
return pref + body + fileType + ".png";
|
||||
}
|
||||
public ImageIcon GetIcon() {
|
||||
URL imageUrl = getClass().getResource(ImageKey());
|
||||
if (imageUrl == null) {
|
||||
System.out.println(ImageKey() + "not found");
|
||||
}
|
||||
return new ImageIcon(imageUrl);
|
||||
}
|
||||
|
||||
public boolean isActiveProgram() {
|
||||
return fileType.equals(FileType.program)
|
||||
&& languageName.equals(father.languageName) && !state.equals(FileState.Excluded);
|
||||
@@ -261,13 +139,13 @@ public class DBProjectFile extends DBObject {
|
||||
return isActiveProgram() || isActiveHeader();
|
||||
}
|
||||
public File getDepFile() {
|
||||
return Paths.get(father.getOptionsDirectory().getAbsolutePath(), getLocalName() + dep).toFile();
|
||||
return Paths.get(father.getOptionsDirectory().getAbsolutePath(), getLocalName() + Constants.dep).toFile();
|
||||
}
|
||||
public File getParserOutFile() {
|
||||
return Paths.get(father.getOptionsDirectory().getAbsolutePath(), getLocalName() + out).toFile();
|
||||
return Paths.get(father.getOptionsDirectory().getAbsolutePath(), getLocalName() + Constants.out).toFile();
|
||||
}
|
||||
public File getParserErrFile() {
|
||||
return Paths.get(father.getOptionsDirectory().getAbsolutePath(), getLocalName() + err).toFile();
|
||||
return Paths.get(father.getOptionsDirectory().getAbsolutePath(), getLocalName() + Constants.err).toFile();
|
||||
}
|
||||
public File getOptionsFile() {
|
||||
String path = file.getAbsolutePath().substring(father.Home.getAbsolutePath().length());
|
||||
@@ -340,14 +218,14 @@ public class DBProjectFile extends DBObject {
|
||||
lines_count = 0;
|
||||
isMain = 0;
|
||||
CleanMessages();
|
||||
LoopGraphTitle = no_data;
|
||||
LoopGraphTitle = Constants.no_data;
|
||||
LoopNests.clear();
|
||||
;
|
||||
AllLoops.clear();
|
||||
CallGraphTitle = no_data;
|
||||
CallGraphTitle = Constants.no_data;
|
||||
function_decls.clear();
|
||||
relativeHeaders.clear();
|
||||
ArrayGraphTitle = no_data;
|
||||
ArrayGraphTitle = Constants.no_data;
|
||||
array_decls.clear();
|
||||
gcov_info.clear();
|
||||
}
|
||||
|
||||
136
src/ProjectData/Files/ProjectFile.java
Normal file
136
src/ProjectData/Files/ProjectFile.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package ProjectData.Files;
|
||||
import Common.Constants;
|
||||
import Common.Database.DBObject;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.LanguageName;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
//возможно, в дальнейшем унаследовать от него DBProjectFile, но пока лучше не трогать то что работает.
|
||||
public class ProjectFile extends DBObject {
|
||||
public File file = null; //собственно, файл на который ссылаемся.
|
||||
public FileType fileType = FileType.none;
|
||||
public LanguageName languageName = LanguageName.n;
|
||||
public LanguageStyle style = LanguageStyle.none;
|
||||
public FileState state = FileState.Undefined; //состояние файла.
|
||||
public ProjectFile() {
|
||||
}
|
||||
public ProjectFile(File file_in){
|
||||
file = file_in;
|
||||
AutoDetectProperties();
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
return file.getName();
|
||||
}
|
||||
public void AutoDetectProperties() {
|
||||
//проверка запретных имен.
|
||||
String[] forbiddenNames = new String[]{
|
||||
Constants.INTERRUPT,
|
||||
Constants.launch_script_name,
|
||||
Constants.default_binary_name,
|
||||
//--
|
||||
Constants.DONE,
|
||||
Constants.TIMEOUT,
|
||||
Constants.out_file,
|
||||
Constants.err_file,
|
||||
Constants.time_file,
|
||||
"Makefile"
|
||||
};
|
||||
for (String forbidden : forbiddenNames) {
|
||||
if (file.getName().equalsIgnoreCase(forbidden)) {
|
||||
fileType = FileType.forbidden;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//-
|
||||
switch (Utils.getExtension(file)) {
|
||||
case "f":
|
||||
case "fdv":
|
||||
case "for":
|
||||
case "f77":
|
||||
fileType = FileType.program;
|
||||
languageName = LanguageName.fortran;
|
||||
style = LanguageStyle.fixed;
|
||||
break;
|
||||
case "f90":
|
||||
fileType = FileType.program;
|
||||
languageName = LanguageName.fortran;
|
||||
style = LanguageStyle.free;
|
||||
break;
|
||||
case "c":
|
||||
case "cdv":
|
||||
fileType = FileType.program;
|
||||
languageName = LanguageName.c;
|
||||
break;
|
||||
case "cpp":
|
||||
fileType = FileType.program;
|
||||
languageName = LanguageName.cpp;
|
||||
break;
|
||||
case "h":
|
||||
fileType = FileType.header;
|
||||
break;
|
||||
case "fh":
|
||||
fileType = FileType.header;
|
||||
languageName = LanguageName.fortran;
|
||||
break;
|
||||
case "o":
|
||||
case "gcda":
|
||||
case "gcno":
|
||||
case "gcov":
|
||||
case "exe":
|
||||
case "pdf":
|
||||
fileType = FileType.forbidden;
|
||||
break;
|
||||
case "":
|
||||
if (Utils.isDigit(file.getName())) {
|
||||
fileType = FileType.forbidden;
|
||||
} else {
|
||||
state = FileState.Excluded;
|
||||
fileType = FileType.none;
|
||||
languageName = LanguageName.n;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//все остальное считаем исключенными из рассмотрения.
|
||||
//если юзеру надо сам их разблочит.
|
||||
state = FileState.Excluded;
|
||||
fileType = FileType.none;
|
||||
languageName = LanguageName.n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public String ImageKey() {
|
||||
//icons/files/Excludeddata.png
|
||||
String pref = "/icons/files/";
|
||||
String body;
|
||||
switch (fileType) {
|
||||
case program:
|
||||
body = state.toString() + languageName.toString();
|
||||
break;
|
||||
case data:
|
||||
body = "Undefined"; // иных состояний у данных не бывает. ситуация возникает если по ошибке поменяли тип
|
||||
//нормальных файлов с сообщениями на дату.
|
||||
break;
|
||||
default:
|
||||
body = state.toString();
|
||||
break;
|
||||
}
|
||||
return pref + body + fileType + ".png";
|
||||
}
|
||||
public ImageIcon GetIcon() {
|
||||
URL imageUrl = getClass().getResource(ImageKey());
|
||||
if (imageUrl == null) {
|
||||
System.out.println(ImageKey() + "not found");
|
||||
}
|
||||
return new ImageIcon(imageUrl);
|
||||
}
|
||||
public String getUnixName() {
|
||||
return Utils.toU(file.getName());
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return file.getName();
|
||||
}
|
||||
}
|
||||
@@ -49,14 +49,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
public class db_project_info extends DBObject {
|
||||
public static Vector<db_project_info> newVersions = new Vector<>();
|
||||
public static final String launch_script_name = "run";
|
||||
public static final String default_binary_name = "0";
|
||||
public static final String spf = "spf.proj";
|
||||
public static final String options = "options";
|
||||
public static final String gcov = "gcov";
|
||||
public static final String attachments = "attachments";
|
||||
public static final String statistic = "statistic";
|
||||
private static final String unknown_metric = " — ";
|
||||
//--
|
||||
public DefaultMutableTreeNode align_rules_root = new DefaultMutableTreeNode("");
|
||||
public DefaultMutableTreeNode includes_root = new DefaultMutableTreeNode("");
|
||||
@@ -264,7 +256,7 @@ public class db_project_info extends DBObject {
|
||||
Global.properties.ProjectDBName).toString());
|
||||
}
|
||||
public static String recommendAnalysis(PassCode_2021 code_in) {
|
||||
return unknown_metric + " примените анализатор \"" + code_in.getDescription() + "\"";
|
||||
return Constants.unknown_metric + " примените анализатор \"" + code_in.getDescription() + "\"";
|
||||
}
|
||||
/*
|
||||
public boolean isGCOVDone() {
|
||||
@@ -344,19 +336,19 @@ public class db_project_info extends DBObject {
|
||||
return name + " " + Utils.DQuotes(description);
|
||||
}
|
||||
public File getProjFile() {
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, spf).toFile();
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, Constants.spf).toFile();
|
||||
}
|
||||
public File getDataDirectory() {
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data).toFile();
|
||||
}
|
||||
public File getOptionsDirectory() {
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, options).toFile();
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, Constants.options).toFile();
|
||||
}
|
||||
public File getGCOVDirectory() {
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, gcov).toFile();
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, Constants.gcov).toFile();
|
||||
}
|
||||
public File getAttachmentsDirectory() {
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, attachments).toFile();
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, Constants.attachments).toFile();
|
||||
}
|
||||
public File getAnalyzerDirectory() {
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, Global.PerformanceAnalyzer).toFile();
|
||||
@@ -373,7 +365,7 @@ public class db_project_info extends DBObject {
|
||||
return res;
|
||||
}
|
||||
public File getStatisticDirectory() {
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, statistic).toFile();
|
||||
return Paths.get(Home.getAbsolutePath(), Constants.data, Constants.statistic).toFile();
|
||||
}
|
||||
public db_project_info find_version_r(File v_home) {
|
||||
if (Home.equals(v_home)) return this;
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
package SapforTestingSystem.Json;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Files.FileType;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Serializable;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Vector;
|
||||
public class SapforVersion_json implements Serializable {
|
||||
@Expose
|
||||
public String version = "";
|
||||
@Expose
|
||||
public String description = "";
|
||||
//поля для отображения деревьев.
|
||||
public File Home = null;
|
||||
public Vector<DBProjectFile> files = null;
|
||||
//-
|
||||
public SapforVersion_json(String version_in, String description_in) {
|
||||
version = version_in;
|
||||
description = description_in;
|
||||
@@ -23,9 +30,23 @@ public class SapforVersion_json implements Serializable {
|
||||
public String toString() {
|
||||
return Home.getName() + " : " + Utils.Brackets(description);
|
||||
}
|
||||
public File Home = null;
|
||||
public void initHome(File configurationRoot) {
|
||||
public void init(File configurationRoot) {
|
||||
String relativePath = Global.isWindows ? Utils.toW(version) : version;
|
||||
Home = Paths.get(configurationRoot.getAbsolutePath(), relativePath).toFile();
|
||||
files = new Vector<>();
|
||||
//--
|
||||
File[] files_ = Home.listFiles();
|
||||
if (files_ != null) {
|
||||
for (File file: files_){
|
||||
if (file.isFile()) {
|
||||
DBProjectFile dbProjectFile = new DBProjectFile();
|
||||
dbProjectFile.file = file;
|
||||
dbProjectFile.AutoDetectProperties();
|
||||
if (dbProjectFile.fileType.equals(FileType.forbidden)) {
|
||||
files.add(dbProjectFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class SapforTask extends DBObject {
|
||||
//------------------------------------>>
|
||||
@@ -50,6 +52,45 @@ public class SapforTask extends DBObject {
|
||||
//-----------
|
||||
public SapforTask() {
|
||||
}
|
||||
/*
|
||||
public static Vector<DefaultMutableTreeNode> getTaskConfigurationDescription(SapforTask task) {
|
||||
Vector<DefaultMutableTreeNode> res = new Vector<>();
|
||||
DefaultMutableTreeNode codesNode = new DefaultMutableTreeNode("Проходы");
|
||||
Vector<String> codes = new Vector<>(Arrays.asList(task.codes.split(" ")));
|
||||
for (String code_s : codes)
|
||||
codesNode.add(new DefaultMutableTreeNode(PassCode_2021.valueOf(code_s).getDescription()));
|
||||
res.add(codesNode);
|
||||
DefaultMutableTreeNode flagsNode = new DefaultMutableTreeNode("Флаги");
|
||||
flagsNode.add(new DefaultMutableTreeNode(task.flags));
|
||||
res.add(flagsNode);
|
||||
return res;
|
||||
}
|
||||
*/
|
||||
public DefaultMutableTreeNode getVersionsTree(File configurationRoot) {
|
||||
DefaultMutableTreeNode root = null;
|
||||
DefaultMutableTreeNode child = null;
|
||||
DefaultMutableTreeNode parent = null;
|
||||
//--
|
||||
for (SapforVersion_json version_json : versions) {
|
||||
version_json.init(configurationRoot);
|
||||
child = new DefaultMutableTreeNode(version_json);
|
||||
if (parent == null) {
|
||||
root = child;
|
||||
parent = child;
|
||||
} else {
|
||||
parent.add(child);
|
||||
parent = child;
|
||||
}
|
||||
}
|
||||
if (parent != null) {
|
||||
for (SapforVersion_json version_json : variants) {
|
||||
version_json.init(configurationRoot);
|
||||
parent.add(new DefaultMutableTreeNode(version_json));
|
||||
}
|
||||
}
|
||||
//--
|
||||
return root;
|
||||
}
|
||||
public void Reset() {
|
||||
state = TaskState.Inactive;
|
||||
versions.clear();
|
||||
|
||||
@@ -2,81 +2,18 @@ package SapforTestingSystem.SapforTasksPackage;
|
||||
import Common.Constants;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import ProjectData.Files.FileType;
|
||||
import SapforTestingSystem.Json.SapforTasksResults_json;
|
||||
import SapforTestingSystem.Json.SapforVersion_json;
|
||||
import SapforTestingSystem.SapforTask.SapforTask;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class SapforTasksPackageInterface {
|
||||
public static File getPackageArchive(SapforTasksPackage package_in) {
|
||||
return new File(Global.SapforPackagesDirectory, package_in.id + ".zip");
|
||||
}
|
||||
public static Vector<DBProjectFile> getProjectFiles(String dir_in) {
|
||||
Vector<DBProjectFile> res = new Vector<>();
|
||||
//получить список файлов которые могут быть файлами проекта в заданной папке
|
||||
//гарантированно нет вложенных.
|
||||
File dir = new File(dir_in);
|
||||
File[] files = dir.listFiles();
|
||||
//-
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isFile()) {
|
||||
DBProjectFile projectFile = new DBProjectFile();
|
||||
projectFile.file = file;
|
||||
projectFile.AutoDetectProperties();
|
||||
if (!projectFile.fileType.equals(FileType.forbidden)) {
|
||||
res.add(projectFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static Vector<DefaultMutableTreeNode> getTaskConfigurationDescription(SapforTask task) {
|
||||
Vector<DefaultMutableTreeNode> res = new Vector<>();
|
||||
DefaultMutableTreeNode codesNode = new DefaultMutableTreeNode("Проходы");
|
||||
Vector<String> codes = new Vector<>(Arrays.asList(task.codes.split(" ")));
|
||||
for (String code_s : codes)
|
||||
codesNode.add(new DefaultMutableTreeNode(PassCode_2021.valueOf(code_s).getDescription()));
|
||||
res.add(codesNode);
|
||||
DefaultMutableTreeNode flagsNode = new DefaultMutableTreeNode("Флаги");
|
||||
flagsNode.add(new DefaultMutableTreeNode(task.flags));
|
||||
res.add(flagsNode);
|
||||
return res;
|
||||
}
|
||||
public static DefaultMutableTreeNode getTaskVersionsTree(File configurationRoot, SapforTask task) {
|
||||
DefaultMutableTreeNode root = null;
|
||||
DefaultMutableTreeNode child = null;
|
||||
DefaultMutableTreeNode parent = null;
|
||||
//--
|
||||
for (SapforVersion_json version_json : task.versions) {
|
||||
version_json.initHome(configurationRoot);
|
||||
child = new DefaultMutableTreeNode(version_json);
|
||||
if (parent == null) {
|
||||
root = child;
|
||||
parent = child;
|
||||
} else {
|
||||
parent.add(child);
|
||||
parent = child;
|
||||
}
|
||||
}
|
||||
if (parent != null) {
|
||||
for (SapforVersion_json version_json : task.variants) {
|
||||
version_json.initHome(configurationRoot);
|
||||
parent.add(new DefaultMutableTreeNode(version_json));
|
||||
}
|
||||
}
|
||||
//--
|
||||
return root;
|
||||
}
|
||||
public static DefaultMutableTreeNode getTreeRoot(SapforTasksPackage package_in) {
|
||||
|
||||
SapforTasksResults_json results_json = getLocalResults(package_in);
|
||||
@@ -100,8 +37,7 @@ public class SapforTasksPackageInterface {
|
||||
*/
|
||||
DefaultMutableTreeNode taskNode = new DefaultMutableTreeNode(task.test_description);
|
||||
//--
|
||||
taskNode.add(getTaskVersionsTree(
|
||||
new File(getLocalWorkspace(package_in), configuration_id), task));
|
||||
taskNode.add(task.getVersionsTree(new File(getLocalWorkspace(package_in), configuration_id)));
|
||||
//--
|
||||
groupNode.add(taskNode);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package SapforTestingSystem.SapforTasksPackage;
|
||||
import Common.Current;
|
||||
import Common.UI.Trees.DataTree;
|
||||
import Common.UI.UI;
|
||||
import ProjectData.Files.DBProjectFile;
|
||||
import SapforTestingSystem.Json.SapforVersion_json;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.io.File;
|
||||
public class SapforTasksPackageTree extends DataTree {
|
||||
Current current;
|
||||
public SapforTasksPackageTree(DefaultMutableTreeNode root_in, Current current_in) {
|
||||
@@ -30,18 +28,11 @@ public class SapforTasksPackageTree extends DataTree {
|
||||
public void SelectionAction(TreePath e) {
|
||||
System.out.println("Select");
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getLastPathComponent();
|
||||
Current.set(Current.ProjectNode, node);
|
||||
// Current.set(Current.ProjectNode, node);
|
||||
Object o = node.getUserObject();
|
||||
if (o instanceof File) {
|
||||
Current.set(Current.SelectedDirectory, o);
|
||||
Current.set(Current.SelectedFile, null);
|
||||
UI.getMainWindow().getProjectWindow().ShowNoSelectedFile();
|
||||
} else if (o instanceof DBProjectFile) {
|
||||
Current.set(Current.SelectedFile, o);
|
||||
File file = ((DBProjectFile) o).file;
|
||||
Current.set(Current.SelectedDirectory, file.getParentFile());
|
||||
UI.getMainWindow().getProjectWindow().ShowSelectedFile();
|
||||
}
|
||||
UI.getMainWindow().getProjectWindow().ShowSelectedDirectory();
|
||||
if (o instanceof SapforVersion_json) {
|
||||
Current.set(current, o);
|
||||
System.out.println(((SapforVersion_json)o).Home);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user