рефакторинг

This commit is contained in:
2023-09-29 21:46:08 +03:00
parent 12898b07bb
commit 760707e6fb
41 changed files with 510 additions and 486 deletions

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Current;
import Common.UI.UI;
import Common.UI.Windows.Dialog.Text.FileNameForm;
@@ -30,7 +31,7 @@ public class AddFile extends ChangeFilePass<DBProjectFile> {
if (Utils.ContainsForbiddenName(fileName)) {
Log.Writeln_("Имя файла " + Utils.Brackets(fileName)
+ " содержит запрещенные символы." +
"\n" + Utils.all_forbidden_characters_string);
"\n" + Constants.all_forbidden_characters_string);
return false;
}
} else {

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Current;
import Common.Utils.Utils;
import ProjectData.Files.DBProjectFile;
@@ -43,7 +44,7 @@ public class OpenSapforTest extends Pass_2021<SapforTaskResult> {
public MessageError unpackMessage(String line_in) throws Exception {
MessageError res = new MessageError();
res.file = "";
res.line = Utils.Nan;
res.line = Constants.Nan;
res.value = "";
String line = line_in.substring(9);
System.out.println(line);

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Utils.Utils;
import ProjectData.Project.db_project_info;
import SapforTestingSystem.Json.SapforVersion_json;
@@ -22,7 +23,7 @@ public class PerformSapforTasksPackage extends Pass_2021<SapforScenario_json> {
File task;
//---
Process process = null;
int exit_code = Utils.Nan;
int exit_code = Constants.Nan;
//----
File outputFile = null;
File errorsFile = null;
@@ -75,7 +76,7 @@ public class PerformSapforTasksPackage extends Pass_2021<SapforScenario_json> {
}
protected boolean performSapforScript(String name, File workspace, String flags, String command, String outName, String errName) throws Exception {
process = null;
exit_code = Utils.Nan;
exit_code = Constants.Nan;
//---
File data_workspace = new File(workspace, db_project_info.data);
Utils.CheckDirectory(data_workspace);

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Global;
import Common.Utils.Utils;
import ProjectData.Project.db_project_info;
@@ -25,7 +26,7 @@ public class PerformScenario extends Pass_2021<SapforScenario_json> {
File task;
//---
Process process = null;
int exit_code = Utils.Nan;
int exit_code = Constants.Nan;
//----
File outputFile = null;
File errorsFile = null;
@@ -95,7 +96,7 @@ public class PerformScenario extends Pass_2021<SapforScenario_json> {
}
protected boolean performSapforScript(String name, File workspace, String flags, String command, String outName, String errName) throws Exception {
process = null;
exit_code = Utils.Nan;
exit_code = Constants.Nan;
//---
File data_workspace = new File(workspace, db_project_info.data);
Utils.CheckDirectory(data_workspace);

View File

@@ -1,8 +1,8 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Current;
import Common.Global;
import Common.UI.Windows.Dialog.Dialog;
import Common.Utils.Utils;
import GlobalData.Compiler.Compiler;
import GlobalData.Compiler.CompilerType;
import GlobalData.CompilerEnvironment.CompilerEnvironment;
@@ -29,7 +29,7 @@ public class PickCompilerEnvironments extends Pass_2021<String> {
protected boolean canStart(Object... args) throws Exception {
if (Current.Check(Log, Current.RunConfiguration)) {
RunConfiguration configuration = Current.getRunConfiguration();
if (configuration.compiler_id == Utils.Nan) {
if (configuration.compiler_id == Constants.Nan) {
Log.Writeln_("Отсутвует DVM компилятор, связанный с текущей конфигурацией запуска.\n" +
"Если конфигурация содержит вызов DVM компилятора, но была создана на версии 801 и ниже,\n" +
"войдите в окно её редактирования,нажмите ОК, а затем повторите попытку.");

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants.Constants;
import Common.Current;
import Common.Global;
import Common.UI.UI;
@@ -89,7 +90,7 @@ public class Precompilation extends Pass_2021<db_project_info> {
prepareForParse(); //---->
//-
performanceTime = 0;
exitCode = Utils.Nan;
exitCode = Constants.Nan;
//------------------
workspace = Paths.get(Global.TempDirectory.getAbsolutePath(), Utils.getDateName("precompilation")).toFile();
FileUtils.forceMkdir(workspace);
@@ -138,8 +139,8 @@ public class Precompilation extends Pass_2021<db_project_info> {
protected static void unpackPrecompilationMessages(db_project_info target, String text) throws Exception {
boolean messageStarted = false;
String messageFile = "";
int messageLine = Utils.Nan;
int messageType = Utils.Nan;
int messageLine = Constants.Nan;
int messageType = Constants.Nan;
Vector<String> messageText = new Vector<>();
String[] nw = text.split("\n");
for (String S : nw) {
@@ -155,7 +156,7 @@ public class Precompilation extends Pass_2021<db_project_info> {
messageText.add(S.substring(6));
messageType = 2;
}
if (messageType != Utils.Nan) {
if (messageType != Constants.Nan) {
target.db.files.Data.get(messageFile).CreateAndAddNewMessage(messageType, String.join("\n", messageText), messageLine, Message.parser_group);
messageStarted = false;
} else {
@@ -170,7 +171,7 @@ public class Precompilation extends Pass_2021<db_project_info> {
if (data.length > 1) {
messageFile = name;
messageLine = Integer.parseInt(data[1]);
messageType = Utils.Nan;
messageType = Constants.Nan;
messageText = new Vector<>();
messageStarted = true;
}

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes;
import Common.Constants.Constants;
import Common.Global;
import Common.Utils.Utils;
@@ -10,13 +11,13 @@ import java.util.LinkedHashMap;
import java.util.Vector;
public abstract class ProcessPass<T> extends Pass_2021<T> {
public Process process = null;
public int exit_code = Utils.Nan;
public int exit_code = Constants.Nan;
public LinkedHashMap<String, String> envs = new LinkedHashMap<>();
public Vector<String> output = new Vector<>();
protected String process_path = "";
public void CreateProcess(String exec_path_in, File workspace, String ... command) throws Exception {
output.clear();
exit_code = Utils.Nan;
exit_code = Constants.Nan;
process_path = exec_path_in;
ProcessBuilder procBuilder = new ProcessBuilder(process_path);
//-