no message

This commit is contained in:
2024-10-11 00:00:30 +03:00
parent a11b7711f7
commit f317ab1aa1
341 changed files with 1866 additions and 1688 deletions

View File

@@ -2,9 +2,9 @@ package _VisualDVM;
import Common.Current_;
import Common.Database.Tables.DataSet;
import Common.Mode;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import Common.Utils.Loggable;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.GlobalData.Account.Account;
import _VisualDVM.GlobalData.Account.AccountRole;
import _VisualDVM.GlobalData.GlobalDatabase;
@@ -77,57 +77,57 @@ public class Global {
public static void SynschronizeProperties() {
try {
File new_propertiesFile = new File(CommonUtils.getHomeDirectory(), "properties");
File new_propertiesFile = new File(Utils_.getHomeDirectory(), "properties");
if (new_propertiesFile.exists())
properties = (GlobalProperties) CommonUtils.jsonFromFile(new_propertiesFile, GlobalProperties.class);
CommonUtils.jsonToFile(properties, new_propertiesFile);
properties = (GlobalProperties) Utils_.jsonFromFile(new_propertiesFile, GlobalProperties.class);
Utils_.jsonToFile(properties, new_propertiesFile);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void CheckVisualiserDirectories() {
Utils.CheckDirectory(ComponentsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(CommonUtils.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(CommonUtils.getHomeDirectory(), Constants.DataDirectoryName));
Utils.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
//-
Utils.CheckDirectory(RepoDirectory = new File(CommonUtils.getHomeDirectory(), Constants.RepoDirectoryName));
Utils.CheckDirectory(BugReportsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.BugsDirectoryName));
Utils.CheckDirectory(BackUpsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.BackUpsDirectoryName));
Utils.CheckDirectory(ProjectsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.ProjectsDirectoryName));
Utils.CheckDirectory(CompilationTasksDirectory = new File(CommonUtils.getHomeDirectory(), Constants.CompilationTasksDirectoryName));
Utils.CheckDirectory(RunTasksDirectory = new File(CommonUtils.getHomeDirectory(), Constants.RunTasksDirectoryName));
Utils.CheckDirectory(StsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.StsDirectoryName));
Utils.CheckDirectory(TestsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.TestsDirectoryName));
Utils.CheckDirectory(PerformanceAnalyzerDirectory = new File(CommonUtils.getHomeDirectory(), Constants.PerformanceAnalyzerDirectoryName));
Utils.CheckDirectory(DVMPackagesDirectory = new File(CommonUtils.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
Utils.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
Utils.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
Utils.CheckDirectory(BackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.BackUpsDirectoryName));
Utils.CheckDirectory(ProjectsDirectory = new File(Utils_.getHomeDirectory(), Constants.ProjectsDirectoryName));
Utils.CheckDirectory(CompilationTasksDirectory = new File(Utils_.getHomeDirectory(), Constants.CompilationTasksDirectoryName));
Utils.CheckDirectory(RunTasksDirectory = new File(Utils_.getHomeDirectory(), Constants.RunTasksDirectoryName));
Utils.CheckDirectory(StsDirectory = new File(Utils_.getHomeDirectory(), Constants.StsDirectoryName));
Utils.CheckDirectory(TestsDirectory = new File(Utils_.getHomeDirectory(), Constants.TestsDirectoryName));
Utils.CheckDirectory(PerformanceAnalyzerDirectory = new File(Utils_.getHomeDirectory(), Constants.PerformanceAnalyzerDirectoryName));
Utils.CheckDirectory(DVMPackagesDirectory = new File(Utils_.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
//через пару версий заменить на clean.
Utils.CheckDirectory(SapforPackagesDirectory = new File(CommonUtils.getHomeDirectory(), "SapforPackages"));
Utils.CheckDirectory(MachinesDirectory = new File(CommonUtils.getHomeDirectory(), "Machines"));
Utils.CheckDirectory(SapforPackagesDirectory = new File(Utils_.getHomeDirectory(), "SapforPackages"));
Utils.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
}
public static void CheckServerDirectories() {
Utils.CheckDirectory(ComponentsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(CommonUtils.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(CommonUtils.getHomeDirectory(), Constants.DataDirectoryName));
Utils.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
//-
Utils.CheckDirectory(BugReportsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.BugsDirectoryName));
Utils.CheckDirectory(DataBackUpsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.DataBackUpsDirectoryName));
Utils.CheckDirectory(MachinesDirectory = new File(CommonUtils.getHomeDirectory(), "Machines"));
Utils.CheckDirectory(BugReportsDirectory = new File(Utils_.getHomeDirectory(), Constants.BugsDirectoryName));
Utils.CheckDirectory(DataBackUpsDirectory = new File(Utils_.getHomeDirectory(), Constants.DataBackUpsDirectoryName));
Utils.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
}
public static void CheckTestingSystemDirectories() {
Utils.CheckDirectory(ComponentsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(CommonUtils.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(CommonUtils.getHomeDirectory(), Constants.DataDirectoryName));
Utils.CheckDirectory(ComponentsDirectory = new File(Utils_.getHomeDirectory(), Constants.ComponentsDirectoryName));
Utils.CheckAndCleanDirectory(TempDirectory = new File(Utils_.getHomeDirectory(), Constants.TempDirectoryName));
Utils.CheckDirectory(DataDirectory = new File(Utils_.getHomeDirectory(), Constants.DataDirectoryName));
//-
Utils.CheckDirectory(TestsDirectory = new File(CommonUtils.getHomeDirectory(), Constants.TestsDirectoryName));
Utils.CheckDirectory(RepoDirectory = new File(CommonUtils.getHomeDirectory(), Constants.RepoDirectoryName));
Utils.CheckDirectory(DVMPackagesDirectory = new File(CommonUtils.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
Utils.CheckDirectory(SapforsDirectory = new File(CommonUtils.getHomeDirectory(), "Sapfors"));
Utils.CheckDirectory(SapforPackagesDirectory = new File(CommonUtils.getHomeDirectory(), "SapforPackages"));
Utils.CheckDirectory(TestsDirectory = new File(Utils_.getHomeDirectory(), Constants.TestsDirectoryName));
Utils.CheckDirectory(RepoDirectory = new File(Utils_.getHomeDirectory(), Constants.RepoDirectoryName));
Utils.CheckDirectory(DVMPackagesDirectory = new File(Utils_.getHomeDirectory(), Constants.DVMPackagesDirectoryName));
Utils.CheckDirectory(SapforsDirectory = new File(Utils_.getHomeDirectory(), "Sapfors"));
Utils.CheckDirectory(SapforPackagesDirectory = new File(Utils_.getHomeDirectory(), "SapforPackages"));
//CheclAndClean через неделю
Utils.CheckDirectory(MachinesDirectory = new File(CommonUtils.getHomeDirectory(), "Machines"));
Utils.CheckDirectory(MachinesDirectory = new File(Utils_.getHomeDirectory(), "Machines"));
}
public static void CreateLogAtComponentsPath() {
CommonUtils.MainLog = new Loggable() {
Utils_.MainLog = new Loggable() {
@Override
public String getLogHomePath() {
return Paths.get(System.getProperty("user.dir"), "Components").toString();
@@ -137,25 +137,25 @@ public class Global {
return "VisualDVM";
}
};
CommonUtils.MainLog.ClearLog();
Utils_.MainLog.ClearLog();
}
public static void CreateLogAtHome() {
CommonUtils.MainLog = new Loggable() {
Utils_.MainLog = new Loggable() {
@Override
public String getLogHomePath() {
return CommonUtils.getHomePath();
return Utils_.getHomePath();
}
@Override
public String getLogName() {
return mode.toString();
}
};
CommonUtils.MainLog.ClearLog();
Utils_.MainLog.ClearLog();
}
//-
public static void FinishApplication() {
try {
if (CommonUtils.db != null) CommonUtils.db.Disconnect();
if (Utils_.db != null) Utils_.db.Disconnect();
if (componentsServer.db != null)
componentsServer.db.Disconnect();
if (testingServer.db != null)
@@ -167,8 +167,8 @@ public class Global {
if (performanceAnalyzer != null)
performanceAnalyzer.Shutdown();
} catch (Exception ex) {
if (CommonUtils.MainLog != null) {
CommonUtils.MainLog.PrintException(ex);
if (Utils_.MainLog != null) {
Utils_.MainLog.PrintException(ex);
} else {
ex.printStackTrace();
}
@@ -176,11 +176,11 @@ public class Global {
System.exit(0);
}
public static void ActivateDB() throws Exception {
CommonUtils.db = new GlobalDatabase();
CommonUtils.db.Connect();
CommonUtils.db.CreateAllTables();
CommonUtils.db.prepareTablesStatements();
CommonUtils.db.Synchronize();
Utils_.db = new GlobalDatabase();
Utils_.db.Connect();
Utils_.db.CreateAllTables();
Utils_.db.prepareTablesStatements();
Utils_.db.Synchronize();
}
public static void RefreshUpdatesStatus() {
Components.RefreshUI();
@@ -225,7 +225,7 @@ public class Global {
forbidden.add(SettingName.Precompilation);
forbidden.add(SettingName.DVMConvertationOptions);
forbidden.add(SettingName.SaveModifications);
for (DBSetting setting : ((GlobalDatabase) CommonUtils.db).settings.getSettingsByOwner(ComponentType.SapforOptions)) {
for (DBSetting setting : ((GlobalDatabase) Utils_.db).settings.getSettingsByOwner(ComponentType.SapforOptions)) {
if (!forbidden.contains(setting.Name))
res_.add(setting.Value);
}
@@ -248,8 +248,8 @@ public class Global {
}
}
public static void NormalMode(int port) throws Exception {
CommonUI.active = true;
CommonUI.setTheme(new LightSPFEditorTheme());
UI_.active = true;
UI_.setTheme(new LightSPFEditorTheme());
removeOldDatabases();
CheckVisualiserDirectories();
CreateLogAtComponentsPath();
@@ -258,8 +258,8 @@ public class Global {
visualizer_2.Connect();
visualizer_2.refreshPid();
//если делать раньше, то не удастся убить сервер.
if (CommonUtils.ContainsCyrillic(CommonUtils.getHomePath())) {
CommonUI.Info("В пути к корневой папке " + CommonUtils.DQuotes(CommonUtils.getHomePath()) + "\n" +
if (Utils_.ContainsCyrillic(Utils_.getHomePath())) {
UI_.Info("В пути к корневой папке " + Utils_.DQuotes(Utils_.getHomePath()) + "\n" +
"Найдены русские буквы.\n" +
"Визуализатор завершает работу."); //
FinishApplication();
@@ -270,7 +270,7 @@ public class Global {
UI.CreateAll();
Pass.CreateAll();
//единственное меню до остальных.
CommonUI.menuBars.put(ComponentsSet.class, new ComponentsMenuBar());
UI_.menuBars.put(ComponentsSet.class, new ComponentsMenuBar());
Components = new ComponentsSet();
Current_.set(Current.ProjectView, ProjectView.Files);
Components.put(ComponentType.Visualiser, visualiser = new Visualiser());
@@ -297,10 +297,10 @@ public class Global {
do {
UI.ShowComponentsWindow();
if (flag = (!ValidateComponentsStates())) {
if (!CommonUI.Question("Найдено " + bad_state + " некорректных необходимых компонент.Работа визуализатора невозможна.\n" +
if (!UI_.Question("Найдено " + bad_state + " некорректных необходимых компонент.Работа визуализатора невозможна.\n" +
"Вернуться к окну компонент"
)) {
CommonUI.Info("Визуализатор завершает работу.");
UI_.Info("Визуализатор завершает работу.");
FinishApplication();
}
}
@@ -322,10 +322,10 @@ public class Global {
testingServer.ActivateDB();
//в проперти их!
//-- чисто чтобы создать таблицы. соединения на стороне клиента не предвидится.
if (((GlobalDatabase) CommonUtils.db).settings.get(SettingName.AutoBugReportsLoad).toBoolean())
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.AutoBugReportsLoad).toBoolean())
Pass.passes.get(PassCode.SynchronizeBugReports).Do();
//--
if (((GlobalDatabase) CommonUtils.db).settings.get(SettingName.AutoTestsLoad).toBoolean())
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.AutoTestsLoad).toBoolean())
Pass.passes.get(PassCode.SynchronizeTests).Do();
Pass.CheckAllStats();
Current.getSapfor().refreshPid(); //без сапфора сюда это все равно не дойдет.
@@ -371,7 +371,7 @@ public class Global {
//---
public static void Init(String... args) {
System.out.println("VisualSapfor.jar started..");
System.out.println("home directory is" + CommonUtils.Brackets(CommonUtils.getHomePath()));
System.out.println("home directory is" + Utils_.Brackets(Utils_.getHomePath()));
//---
SynschronizeProperties();
mode = properties.Mode;
@@ -402,8 +402,8 @@ public class Global {
} catch (Exception ex) {
System.out.println("VISUALISER FAILED");
ex.printStackTrace();
if (CommonUtils.MainLog != null)
CommonUtils.MainLog.PrintException(ex);
if (Utils_.MainLog != null)
Utils_.MainLog.PrintException(ex);
FinishApplication();
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Compiler;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Validators.DVMHelpParser;
@@ -182,10 +182,10 @@ public class Compiler extends iDBObject {
return "";
}
public String getHelpCommand() {
return CommonUtils.DQuotes(call_command) + " " + help_command;
return Utils_.DQuotes(call_command) + " " + help_command;
}
public String getVersionCommand() {
return CommonUtils.DQuotes(call_command) + " " + version_command;
return Utils_.DQuotes(call_command) + " " + version_command;
}
public String getVersionInfo(){
return "v="+version+" r="+revision;

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Compiler;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.DataSetControlForm;
import _VisualDVM.Visual.UI;
@@ -47,7 +47,7 @@ public class CompilersDBTable extends iDBTable<Compiler> {
String home = fields.tfHome.getText();
if (!home.isEmpty()) {
if (home.startsWith("/")) {
if (CommonUtils.ContainsCyrillic(home))
if (Utils_.ContainsCyrillic(home))
Log.Writeln("Расположение компилятора не может содержать кириллицу");
else {
new PathValidator(home, "Расположение компилятора", Log).Validate();
@@ -60,7 +60,7 @@ public class CompilersDBTable extends iDBTable<Compiler> {
String call_command = fields.tfCallCommand.getText();
if (call_command.isEmpty())
Log.Writeln("Команда вызова компилятора не может быть пустой");
else if (CommonUtils.ContainsCyrillic(call_command))
else if (Utils_.ContainsCyrillic(call_command))
Log.Writeln("Команда вызова компилятора не может содержать кириллицу");
else {
switch (call_command.charAt(0)) {
@@ -78,11 +78,11 @@ public class CompilersDBTable extends iDBTable<Compiler> {
//самое опасное место. теоретически тут можно ввести любую команду ОС, в том числе rm -rf
if (call_command.contains(" "))
Log.Writeln("Прямая команда вызова не может содержать пробелы");
if (!call_command.contains("+")&& CommonUtils.ContainsForbiddenName(call_command))
if (!call_command.contains("+")&& Utils_.ContainsForbiddenName(call_command))
Log.Writeln("Прямая команда вызова содержит запрещённые символы");
else {
if (Utils.isLinuxSystemCommand(call_command))
Log.Writeln(CommonUtils.DQuotes(call_command) + " является системной командой Linux");
Log.Writeln(Utils_.DQuotes(call_command) + " является системной командой Linux");
}
break;
}
@@ -96,7 +96,7 @@ public class CompilersDBTable extends iDBTable<Compiler> {
fields.tfHelpCommand.setText(Result.help_command);
fields.tfVersionCommand.setText(Result.version_command);
fields.tfHome.setText(Result.home_path);
CommonUI.TrySelect(fields.cbCompilerType, Result.type);
UI_.TrySelect(fields.cbCompilerType, Result.type);
fields.events_on = true;
}
@Override

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Compiler.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.TextField.StyledTextField;
import Common.Visual.Windows.Dialog.DialogFields;
@@ -42,7 +42,7 @@ public class CompilerFields implements DialogFields {
if (dst != null)
tfHome.setText(dst);
} else
CommonUI.Info("Назначение домашней папки поддерживается только для dvm системы.");
UI_.Info("Назначение домашней папки поддерживается только для dvm системы.");
});
tfHome.getDocument().addDocumentListener(new DocumentListener() {
@Override

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.CompilerEnvironment.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Tables.DBObjectEditor;
import Common.Visual.Fonts.VisualiserFonts;
import Common.Visual.Windows.Dialog.Text.ComboTextDialog;
@@ -7,7 +7,7 @@ import _VisualDVM.GlobalData.CompilerEnvironment.CompilerEnvironment;
public class CompilerEnvironmentValueEditor extends DBObjectEditor<CompilerEnvironment> {
@Override
public void Action() {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setText(value.value.isEmpty() ? "не задано" : value.value);
//-
ComboTextDialog dialog = new ComboTextDialog() {
@@ -20,7 +20,7 @@ public class CompilerEnvironmentValueEditor extends DBObjectEditor<CompilerEnvir
};
dialog.fields.setEditable(value.valueVariants.isEmpty());
if (!value.value.isEmpty())
CommonUI.TrySelect(dialog.fields, value.value);
UI_.TrySelect(dialog.fields, value.value);
if (dialog.ShowDialog("Изменить значение опции " + value.name,
value.valueVariants
)) {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.CompilerEnvironment.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Tables.DBObjectRenderer;
import Common.Visual.Fonts.VisualiserFonts;
import _VisualDVM.GlobalData.CompilerEnvironment.CompilerEnvironment;
@@ -8,7 +8,7 @@ public class CompilerEnvironmentValueRenderer extends DBObjectRenderer {
public void Display() {
if (value != null) {
CompilerEnvironment environment = (CompilerEnvironment) value;
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setText(environment.value.isEmpty() ? "не задано" : environment.value);
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.CompilerOption;
import Common.Database.Objects.DBObject;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import com.sun.org.glassfish.gmbal.Description;
import java.util.Arrays;
@@ -26,7 +26,7 @@ public class CompilerOption extends DBObject {
@Override
public String toString() {
return name + (hasParameter() ? (parameterSeparator +
(parameterValue.contains(" ") ? CommonUtils.DQuotes(parameterValue) : parameterValue)) : "");
(parameterValue.contains(" ") ? Utils_.DQuotes(parameterValue) : parameterValue)) : "");
}
public void CheckParameterVariants() {
for (String line : description)
@@ -34,7 +34,7 @@ public class CompilerOption extends DBObject {
}
public boolean CheckLine(String line) {
if (hasParameter()) {
Pattern DVM_PARAM_VALUES_REGEX = Pattern.compile(CommonUtils.TBrackets(parameterName) + "\\s*=\\s*" + "\\w+(\\|\\w+)+", Pattern.CASE_INSENSITIVE);
Pattern DVM_PARAM_VALUES_REGEX = Pattern.compile(Utils_.TBrackets(parameterName) + "\\s*=\\s*" + "\\w+(\\|\\w+)+", Pattern.CASE_INSENSITIVE);
Matcher matcher = DVM_PARAM_VALUES_REGEX.matcher(line);
if (matcher.find()) {
String s = line.substring(matcher.start(), matcher.end());

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.CompilerOption.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Tables.DBObjectRenderer;
import Common.Visual.Fonts.VisualiserFonts;
import _VisualDVM.GlobalData.CompilerOption.CompilerOption;
@@ -9,10 +9,10 @@ public class CompilerOptionParameterNameRenderer extends DBObjectRenderer {
if (value != null) {
CompilerOption option = (CompilerOption) value;
if (option.hasParameter()) {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreePlain));
setText(option.parameterName);
} else {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.UnknownState));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.UnknownState));
setText("нет");
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.CompilerOption.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Tables.DBObjectEditor;
import Common.Visual.Fonts.VisualiserFonts;
import Common.Visual.Windows.Dialog.Text.ComboTextDialog;
@@ -8,13 +8,13 @@ public class CompilerOptionParameterValueEditor extends DBObjectEditor<CompilerO
@Override
public void Action() {
if (value.hasParameter()) {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
//-
setText(value.parameterValue.isEmpty() ? "не задано" : value.parameterValue);
//-
ComboTextDialog dialog = new ComboTextDialog();
if (!value.parameterValue.isEmpty())
CommonUI.TrySelect(dialog.fields, value.parameterValue);
UI_.TrySelect(dialog.fields, value.parameterValue);
dialog.fields.setEditable(value.parameterVariants.isEmpty());
if (dialog.ShowDialog("Изменить значение опции " + value.name,
value.parameterVariants)) {
@@ -22,7 +22,7 @@ public class CompilerOptionParameterValueEditor extends DBObjectEditor<CompilerO
setText(value.parameterValue.isEmpty() ? "не задано" : value.parameterValue);
}
} else {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.UnknownState));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.UnknownState));
setText("нет");
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.CompilerOption.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Tables.DBObjectRenderer;
import Common.Visual.Fonts.VisualiserFonts;
import _VisualDVM.GlobalData.CompilerOption.CompilerOption;
@@ -9,10 +9,10 @@ public class CompilerOptionParameterValueRenderer extends DBObjectRenderer {
if (value != null) {
CompilerOption option = (CompilerOption) value;
if (option.hasParameter()) {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setText(option.parameterValue.isEmpty() ? "не задано" : option.parameterValue);
} else {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.UnknownState));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.UnknownState));
setText("нет");
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.DVMParameter;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
@@ -53,7 +53,7 @@ public class DVMParameterDBTable extends iDBTable<DVMParameter> {
return new DBObjectDialog<DVMParameter, DVMParameterFields>(DVMParameterFields.class) {
@Override
public void fillFields() {
CommonUI.TrySelect(fields.cbName, Result.name);
UI_.TrySelect(fields.cbName, Result.name);
fields.tfValue.setText(Result.value);
}
//https://javarush.ru/groups/posts/regulyarnye-vyrazheniya-v-java
@@ -69,16 +69,16 @@ public class DVMParameterDBTable extends iDBTable<DVMParameter> {
}
*/
if (Utils.isLinuxSystemCommand(name))
Log.Writeln(CommonUtils.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
Log.Writeln(Utils_.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
/*
if (value.contains("\"")) {
Log.Writeln("Значение переменной окружения не может содержать двойные кавычки");
}
*/
for (DVMParameter par : ((GlobalDatabase)CommonUtils.db).dvmParameters.Data.values()) {
for (DVMParameter par : ((GlobalDatabase) Utils_.db).dvmParameters.Data.values()) {
if (par.isVisible() && (Result.id != par.id) && (par.name.equals(name))) {
Log.Writeln("В конфигурации запуска уже задан параметр DVM системы с именем " + CommonUtils.Brackets(name));
Log.Writeln("В конфигурации запуска уже задан параметр DVM системы с именем " + Utils_.Brackets(name));
break;
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.EnvironmentValue;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
public class EnvironmentValue extends iDBObject {
@@ -14,6 +14,6 @@ public class EnvironmentValue extends iDBObject {
}
@Override
public String toString() {
return name + "=" + CommonUtils.DQuotes(value);
return name + "=" + Utils_.DQuotes(value);
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.EnvironmentValue;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
@@ -25,7 +25,7 @@ public class EnvironmentValuesDBTable extends iDBTable<EnvironmentValue> {
return new DBObjectDialog<EnvironmentValue, EnvironmentValueFields>(EnvironmentValueFields.class) {
@Override
public void fillFields() {
CommonUI.TrySelect(fields.cbName, Result.name);
UI_.TrySelect(fields.cbName, Result.name);
fields.tfValue.setText(Result.value);
}
//https://javarush.ru/groups/posts/regulyarnye-vyrazheniya-v-java
@@ -39,13 +39,13 @@ public class EnvironmentValuesDBTable extends iDBTable<EnvironmentValue> {
Log.Writeln("Имя переменной окружения может содержать только латинские буквы, цифры и подчёркивания");
}
if (Utils.isLinuxSystemCommand(name))
Log.Writeln(CommonUtils.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
Log.Writeln(Utils_.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
if (value.contains("\"")) {
Log.Writeln("Значение переменной окружения не может содержать двойные кавычки");
}
for (EnvironmentValue env : ((GlobalDatabase)CommonUtils.db).environmentValues.Data.values()) {
for (EnvironmentValue env : ((GlobalDatabase) Utils_.db).environmentValues.Data.values()) {
if (env.isVisible() && (Result.id != env.id) && (env.name.equals(name))) {
Log.Writeln("В конфигурации запуска уже задана переменная окружения с именем " + CommonUtils.Brackets(name));
Log.Writeln("В конфигурации запуска уже задана переменная окружения с именем " + Utils_.Brackets(name));
break;
}
}

View File

@@ -1,7 +1,7 @@
package _VisualDVM.GlobalData;
import Common.Current_;
import Common.Database.VisualiserDatabase;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -122,7 +122,7 @@ public class GlobalDatabase extends VisualiserDatabase {
try {
Update((DBObject) Current_.get(Current.Credentials));
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
//--

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Machine;
import Common.Database.Objects.iDBObject;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.GlobalData.Compiler.Compiler;
import _VisualDVM.GlobalData.User.User;
@@ -23,13 +23,13 @@ public class Machine extends iDBObject {
}
public String getFullDescription() {
return //this.equals(Constants.repository_machine) ? "Репозиторий визуализатора" :
"Машина по адресу " + CommonUtils.Brackets(getURL());
"Машина по адресу " + Utils_.Brackets(getURL());
}
public LinkedHashMap<Integer, Compiler> getCompilers() {
return CommonUtils.db.getMapByFKi(this, Compiler.class);
return Utils_.db.getMapByFKi(this, Compiler.class);
}
public LinkedHashMap<Integer, User> getUsers() {
return CommonUtils.db.getMapByFKi(this, User.class);
return Utils_.db.getMapByFKi(this, User.class);
}
@Override
public String getDialogName() {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Machine;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.DataSetControlForm;
import _VisualDVM.Visual.UI;
@@ -50,7 +50,7 @@ public class MachinesDBTable extends iDBTable<Machine> {
fields.tfName.setText(Result.name);
fields.tfAddress.setText(Result.address);
fields.sPort.setValue(Result.port);
CommonUI.TrySelect(fields.cbMachineType, Result.type);
UI_.TrySelect(fields.cbMachineType, Result.type);
}
@Override
public void ProcessResult() {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Makefile;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Utils.TextLog;
import _VisualDVM.Utils;
@@ -25,10 +25,10 @@ public class Makefile extends ModuleAnchestor {
return Current.HasMachine() && (machine_id == Current.getMachine().id);
}
public LinkedHashMap<LanguageName, Module> getActiveModules() {
return CommonUtils.db.getByFKAndGroupBy(this, Module.class, "language", LanguageName.class).values().stream().filter(Module::isSelected).collect(Collectors.toMap(module -> module.language, module -> module, (a, b) -> b, LinkedHashMap::new));
return Utils_.db.getByFKAndGroupBy(this, Module.class, "language", LanguageName.class).values().stream().filter(Module::isSelected).collect(Collectors.toMap(module -> module.language, module -> module, (a, b) -> b, LinkedHashMap::new));
}
public LinkedHashMap<LanguageName, Module> getModules() {
return CommonUtils.db.getByFKAndGroupBy(this, Module.class, "language", LanguageName.class);
return Utils_.db.getByFKAndGroupBy(this, Module.class, "language", LanguageName.class);
}
public String Generate(db_project_info project, boolean useFilesOrder, LinkedHashMap<LanguageName, Module> modules) throws Exception {
Compiler linker = getCompiler();
@@ -37,7 +37,7 @@ public class Makefile extends ModuleAnchestor {
Vector<String> titles = new Vector<>();
Vector<String> objects = new Vector<>();
Vector<String> bodies = new Vector<>();
String binary = CommonUtils.DQuotes("0"); // Utils.DQuotes(project.name);
String binary = Utils_.DQuotes("0"); // Utils.DQuotes(project.name);
for (Module module : modules.values()) {
//определить а активен ли модуль.
//выбран ли он. есть ли у него компилятор. есть ли для него программы.
@@ -61,7 +61,7 @@ public class Makefile extends ModuleAnchestor {
for (DBProjectFile program : programsToAssembly) {
//--
program.last_assembly_name = module.language.toString() + "_" + i + ".o";
String object = CommonUtils.DQuotes(program.last_assembly_name);
String object = Utils_.DQuotes(program.last_assembly_name);
module_objects.add(object);
module_body +=
object + ":\n" +
@@ -78,7 +78,7 @@ public class Makefile extends ModuleAnchestor {
++i;
}
titles.add(String.join("\n",
LANG_ + "COMMAND=" + CommonUtils.DQuotes(module_compiler.call_command) + " " + module.command,
LANG_ + "COMMAND=" + Utils_.DQuotes(module_compiler.call_command) + " " + module.command,
LANG_ + "FLAGS=" + module.flags,
LANG_ + "OBJECTS=" + String.join(" ", module_objects),
""
@@ -88,7 +88,7 @@ public class Makefile extends ModuleAnchestor {
}
}
return String.join("\n",
"LINK_COMMAND=" + CommonUtils.DQuotes(linker.call_command) + " " + command,
"LINK_COMMAND=" + Utils_.DQuotes(linker.call_command) + " " + command,
"LINK_FLAGS=" + flags + "\n",
String.join("\n", titles),
"all: " + binary,
@@ -124,7 +124,7 @@ public class Makefile extends ModuleAnchestor {
for (DBProjectFile program : programsToAssembly) {
//--
program.last_assembly_name = module.language.toString() + "_" + i + ".o";
String object = CommonUtils.DQuotes(program.last_assembly_name);
String object = Utils_.DQuotes(program.last_assembly_name);
module_objects.add(object);
module_body +=
object + ":\n" +
@@ -141,7 +141,7 @@ public class Makefile extends ModuleAnchestor {
++i;
}
titles.add(String.join("\n",
LANG_ + "COMMAND=" + CommonUtils.DQuotes(module_compiler.call_command) + " " + module.command,
LANG_ + "COMMAND=" + Utils_.DQuotes(module_compiler.call_command) + " " + module.command,
LANG_ + "FLAGS=" + module.flags,
LANG_ + "OBJECTS=" + String.join(" ", module_objects),
""
@@ -159,7 +159,7 @@ public class Makefile extends ModuleAnchestor {
//todo возможно улучшить
//https://habr.com/ru/post/211751/
public Machine getMachine() {
return CommonUtils.db.getById(Machine.class, machine_id);
return Utils_.db.getById(Machine.class, machine_id);
}
public boolean DependsToCompiler(Compiler compiler) {
if (compiler_id == compiler.id) return true;
@@ -178,7 +178,7 @@ public class Makefile extends ModuleAnchestor {
if (linker.type.equals(CompilerType.dvm)) {
if (!Current.getProject().languageName.getDVMLink().equals(command))
Log.Writeln("команда линковки " +
CommonUtils.Quotes(command) +
Utils_.Quotes(command) +
" не соответствует языку текущего проекта "
+ Current.getProject().languageName.getDescription() + "\n" +
"Используйте команду " + Current.getProject().languageName.getDVMLink());

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Module;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.Makefile.Makefile;
import _VisualDVM.ProjectData.LanguageName;
@@ -29,9 +29,9 @@ public class Module extends ModuleAnchestor {
public void Select(boolean flag) {
on = flag ? 1 : 0;
try {
CommonUtils.db.Update(this);
Utils_.db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Module;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import Common.Database.Objects.iDBObject;
import _VisualDVM.GlobalData.Compiler.Compiler;
public class ModuleAnchestor extends iDBObject {
@@ -16,16 +16,16 @@ public class ModuleAnchestor extends iDBObject {
return ((compiler = getCompiler()) == null) ? "" : compiler.getDescription();
}
public Compiler getCompiler() {
return CommonUtils.db.getById(Compiler.class, compiler_id);
return Utils_.db.getById(Compiler.class, compiler_id);
}
public String getDescription() {
String res = "";
if (getCompiler() != null) {
res += CommonUtils.Brackets(getCompiler().getDescription());
res += Utils_.Brackets(getCompiler().getDescription());
if (!command.isEmpty())
res += " " + CommonUtils.Brackets(command);
res += " " + Utils_.Brackets(command);
if (!flags.isEmpty())
res += " " + CommonUtils.Brackets(flags);
res += " " + Utils_.Brackets(flags);
}
return res;
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Module.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.Controls.StyledTextComboBox;
import Common.Visual.Windows.Dialog.DialogFields;
@@ -32,14 +32,14 @@ public class ModuleAnchestorFields implements DialogFields {
bHelp.addActionListener(e -> {
if (cbCompilers.getSelectedItem() != null) {
Pass.passes.get(PassCode.ShowCompilerHelp).Do(compiler, true);
} else CommonUI.Info("Компилятор не выбран");
} else UI_.Info("Компилятор не выбран");
});
BPickOptions.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Pass<String> pass = Pass.passes.get(PassCode.PickCompilerOptions);
if (pass.Do(compiler)) {
CommonUI.TrySelect(cbFlags, pass.target);
UI_.TrySelect(cbFlags, pass.target);
}
}
});
@@ -58,7 +58,7 @@ public class ModuleAnchestorFields implements DialogFields {
cbCompilers.addActionListener(e -> {
if (cbCompilers.getSelectedItem() instanceof Compiler) {
Compiler compiler = ((Compiler) cbCompilers.getSelectedItem());
CommonUI.TrySelect(cbCommands,
UI_.TrySelect(cbCommands,
linker ? compiler.getSpecialLinkCommand(languageName) : compiler.getSpecialCompilationCommand(languageName));
}
});

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Module.UI;
import Common.CommonConstants;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.GlobalData.Compiler.Compiler;
@@ -93,9 +93,9 @@ public class ModuleAnchestorForm<T extends ModuleAnchestor> extends DBObjectDial
}
@Override
public void fillFields() {
CommonUI.TrySelect(fields.cbFlags, Result.flags);
CommonUI.TrySelect(fields.cbCommands, Result.command);
CommonUI.TrySelect(fields.cbCompilers, Result.getCompiler());
UI_.TrySelect(fields.cbFlags, Result.flags);
UI_.TrySelect(fields.cbCommands, Result.command);
UI_.TrySelect(fields.cbCompilers, Result.getCompiler());
//--------------------------------------------
fields.setListeners(Result);
}

View File

@@ -1,7 +1,7 @@
package _VisualDVM.GlobalData.RemoteFile.UI;
import Common.Current_;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.Windows.Dialog.Dialog;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
@@ -31,7 +31,7 @@ public class RemoteFileChooser extends Dialog<String, RemoteFileChooserFields> {
try {
Refresh(session.user.connection.sftpChannel.pwd());
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
onCancel(); //закрываем окно.
}
}
@@ -69,7 +69,7 @@ public class RemoteFileChooser extends Dialog<String, RemoteFileChooserFields> {
fields.treeForm.Show();
fields.lCurrentFolder.setText(path);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
onCancel();
}
}
@@ -77,14 +77,14 @@ public class RemoteFileChooser extends Dialog<String, RemoteFileChooserFields> {
try {
Refresh(session.user.connection.sftpChannel.getHome());
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
onCancel(); //закрываем окно.
}
}
public void goUp() {
if (!root_file.full_name.equals("/")) {
Refresh(root_file.parent);
} else CommonUI.Info("Корневая папка файловой системы достигнута.");
} else UI_.Info("Корневая папка файловой системы достигнута.");
}
@Override
public void validateFields() {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.RemoteFile.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Fonts.VisualiserFonts;
import Common.Visual.Trees.StyledTreeCellRenderer;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
@@ -16,7 +16,7 @@ public class RemoteFileRenderer extends StyledTreeCellRenderer {
if (o instanceof RemoteFile) {
RemoteFile file = (RemoteFile) o;
setText(file.name);
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreePlain));
if (file.isDirectory())
setIcon(new ImageIcon(getClass().getResource("/icons/Folder.png")));
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.RunConfiguration;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import Common.Utils.TextLog;
@@ -54,7 +54,7 @@ public class RunConfiguration extends iDBObject {
try {
dim = Integer.parseInt(dim_);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
res.add(dim);
}
@@ -117,7 +117,7 @@ public class RunConfiguration extends iDBObject {
}
//---------------------------------------->
public Compiler getCompiler() {
return CommonUtils.db.getById(Compiler.class, compiler_id);
return Utils_.db.getById(Compiler.class, compiler_id);
}
public boolean isCube() {
return cube != 0;
@@ -145,16 +145,16 @@ public class RunConfiguration extends iDBObject {
public String getDescription() {
String res = "";
if (!LauncherCall.isEmpty()) {
res += CommonUtils.Brackets(LauncherCall);
res += Utils_.Brackets(LauncherCall);
if (!LauncherOptions.isEmpty())
res += " " + CommonUtils.Brackets(LauncherOptions);
res += " " + Utils_.Brackets(LauncherOptions);
} else res = "";
return res;
}
public String getLaunchScriptText(String binary_name, String task_matrix) {
String res = "";
if (!LauncherCall.isEmpty()) {
res += CommonUtils.DQuotes(LauncherCall);
res += Utils_.DQuotes(LauncherCall);
if (!LauncherOptions.isEmpty())
res += " " + LauncherOptions;
if (!task_matrix.isEmpty())
@@ -162,7 +162,7 @@ public class RunConfiguration extends iDBObject {
}
if (!res.isEmpty())
res += " ";
res += CommonUtils.DQuotes("./" + binary_name);
res += Utils_.DQuotes("./" + binary_name);
if (!args.isEmpty())
res += " " + args;
return res;
@@ -189,13 +189,13 @@ public class RunConfiguration extends iDBObject {
return "run_configuration_id";
}
public Vector<String> getEnvList() {
return CommonUtils.db.getVectorStringByFK(this, EnvironmentValue.class);
return Utils_.db.getVectorStringByFK(this, EnvironmentValue.class);
}
public Vector<String> getParList() {
return CommonUtils.db.getVectorStringByFK(this, DVMParameter.class);
return Utils_.db.getVectorStringByFK(this, DVMParameter.class);
}
public LinkedHashMap<String, String> getEnvMap() {
LinkedHashMap<Integer, EnvironmentValue> envs = CommonUtils.db.getMapByFKi(this, EnvironmentValue.class);
LinkedHashMap<Integer, EnvironmentValue> envs = Utils_.db.getMapByFKi(this, EnvironmentValue.class);
LinkedHashMap<String, String> res = new LinkedHashMap<>();
for (EnvironmentValue e : envs.values()) {
if (!res.containsKey(e.name))

View File

@@ -1,7 +1,7 @@
package _VisualDVM.GlobalData.RunConfiguration;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.DataSetControlForm;
import Common.Visual.Windows.Dialog.DBObjectDialog;
@@ -40,18 +40,18 @@ public class RunConfigurationsDBTable extends iDBTable<RunConfiguration> {
return new DBObjectDialog<RunConfiguration, RunConfigurationFields>(RunConfigurationFields.class) {
@Override
public void fillFields() {
for (Compiler compiler : ((GlobalDatabase)CommonUtils.db).compilers.Data.values()) {
for (Compiler compiler : ((GlobalDatabase) Utils_.db).compilers.Data.values()) {
if (compiler.isVisible() && compiler.type.equals(CompilerType.dvm))
fields.cbLauncherCall.addItem(compiler);
}
CommonUI.TrySelect_s(fields.cbLauncherCall, Result.LauncherCall);
CommonUI.TrySelect(fields.cbLaunchOptions, Result.LauncherOptions);
UI_.TrySelect_s(fields.cbLauncherCall, Result.LauncherCall);
UI_.TrySelect(fields.cbLaunchOptions, Result.LauncherOptions);
fields.tfArgs.setText(Result.args);
fields.cbLauncherCall.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (fields.cbLauncherCall.getSelectedItem() instanceof Compiler) {
CommonUI.TrySelect(fields.cbLaunchOptions, "run");
UI_.TrySelect(fields.cbLaunchOptions, "run");
}
}
});

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Settings;
import Common.Database.Objects.DBObject;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Visual.Menus.StableMenuItem;
import _VisualDVM.Repository.Component.ComponentType;
import Visual_DVM_2021.Passes.PassCode;
@@ -64,13 +64,13 @@ public class DBSetting extends DBObject {
public void Mark() {
switch (settingType) {
case SapforFlag:
getMenuItem().setIcon(CommonUtils.getIcon(toBoolean() ? "/icons/Pick.png" : "/icons/NotPick.png"));
getMenuItem().setIcon(Utils_.getIcon(toBoolean() ? "/icons/Pick.png" : "/icons/NotPick.png"));
break;
case PercentField:
getMenuItem().setText(Name.getDescription() + " : " + this + "%");
break;
case StringField:
String valueToShow = Value.isEmpty()? "не задано": CommonUtils.Quotes(toString());
String valueToShow = Value.isEmpty()? "не задано": Utils_.Quotes(toString());
getMenuItem().setText(Name.getDescription() + " : " + valueToShow);
break;
case IntField:

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Settings;
import Common.Database.Tables.DBTable;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Utils;
import _VisualDVM.Repository.Component.ComponentType;
@@ -43,7 +43,7 @@ public class SettingsDBTable extends DBTable<SettingName, DBSetting> {
AddSetting(new DBSetting(SettingName.Kernels, Utils.getHalfKernels(), SettingType.IntField, ComponentType.Visualiser));
AddSetting(new DBSetting(SettingName.AutoBugReportsLoad, 0, SettingType.SapforFlag, ComponentType.Visualiser, true));
AddSetting(new DBSetting(SettingName.AutoTestsLoad, 0, SettingType.SapforFlag, ComponentType.Visualiser, true));
if (CommonUtils.isWindows())
if (Utils_.isWindows())
AddSetting(new DBSetting(SettingName.LocalMakePathWindows, "C:\\MinGW\\msys\\1.0\\bin\\make.exe", SettingType.StringField, ComponentType.Visualiser));
AddSetting(new DBSetting(SettingName.SmallScreen, 0, SettingType.SapforFlag, ComponentType.Visualiser));
//совместимость. указываем явно чтобы не были видны в меню.

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Splitter;
import Common.Database.Tables.DBTable;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import javax.swing.*;
import java.lang.reflect.Field;
@@ -32,7 +32,7 @@ public class SplittersDBTable extends DBTable<String, Splitter> {
}
}
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
public void Save(Object form) {
@@ -44,7 +44,7 @@ public class SplittersDBTable extends DBTable<String, Splitter> {
getDb().Update(splitter);
}
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
}

View File

@@ -1,7 +1,7 @@
package _VisualDVM.GlobalData.Tasks.CompilationTask;
import Common.CommonConstants;
import Common.Current_;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.Global;
@@ -64,7 +64,7 @@ public class CompilationTask extends Task {
break;
}
}
CommonUtils.db.Update(this);
Utils_.db.Update(this);
}
//---------------------------------------------------
@Override
@@ -80,7 +80,7 @@ public class CompilationTask extends Task {
belongsToProject(Current.getProject());
}
public Makefile getMakefile() {
return CommonUtils.db.getById(Makefile.class, makefile_id);
return Utils_.db.getById(Makefile.class, makefile_id);
}
@Override
public String getFullCommand() {
@@ -90,7 +90,7 @@ public class CompilationTask extends Task {
LinkedHashMap<Integer, RunTask> res = new LinkedHashMap<>();
//так не получится. не правильно назвал ключевое поле. F...
// return Global.db.getMapByFKi(this, RunTask.class);
for (RunTask runTask : ((GlobalDatabase)CommonUtils.db).runTasks.Data.values()) {
for (RunTask runTask : ((GlobalDatabase) Utils_.db).runTasks.Data.values()) {
if (runTask.compilation_task_id == id)
res.put(runTask.id, runTask);
}
@@ -102,7 +102,7 @@ public class CompilationTask extends Task {
String errors = getErrors();
for (DBProjectFile file : project.db.files.Data.values()) {
if (!file.last_assembly_name.isEmpty()) {
String replacement = file.last_assembly_name + " " + CommonUtils.RBrackets(file.name);
String replacement = file.last_assembly_name + " " + Utils_.RBrackets(file.name);
output = output.replace(file.last_assembly_name, replacement);
errors = errors.replace(file.last_assembly_name, replacement);
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Passes;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.Tasks.Supervisor.TaskSupervisor;
import Visual_DVM_2021.Passes.ProcessPass;
@@ -9,7 +9,7 @@ public abstract class TaskLocalPass<S extends TaskSupervisor> extends ProcessPas
try {
supervisor = s_class.newInstance();
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
@Override

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.QueueSystem;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.GlobalData.Tasks.Task;
import _VisualDVM.GlobalData.Tasks.TaskState;
public class QueueSystem {
@@ -28,9 +28,9 @@ public class QueueSystem {
}
}
public String getCheckTaskCommand(Task task) {
return check_command + " " + CommonUtils.DQuotes(task.PID);
return check_command + " " + Utils_.DQuotes(task.PID);
}
public String getCancelTaskCommand(Task task) {
return cancel_command + " " + CommonUtils.DQuotes(task.PID);
return cancel_command + " " + Utils_.DQuotes(task.PID);
}
}

View File

@@ -1,7 +1,7 @@
package _VisualDVM.GlobalData.Tasks.RunTask;
import Common.CommonConstants;
import Common.Current_;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.Global;
@@ -39,7 +39,7 @@ public class RunTask extends Task {
super.DropResults();
Utils.forceDeleteWithCheck(getLocalStsFile());
CleanTime = 0;
CommonUtils.db.Update(this);
Utils_.db.Update(this);
}
@Override
public File getHome() {
@@ -62,18 +62,18 @@ public class RunTask extends Task {
compilation_task_id == Current.getCompilationTask().id;
}
public RunConfiguration getRunConfiguration() {
return ((GlobalDatabase)CommonUtils.db).runConfigurations.Data.get(run_configuration_id);
return ((GlobalDatabase) Utils_.db).runConfigurations.Data.get(run_configuration_id);
}
public CompilationTask getCompilationTask() {
return ((GlobalDatabase)CommonUtils.db).compilationTasks.Data.get(compilation_task_id);
return ((GlobalDatabase) Utils_.db).compilationTasks.Data.get(compilation_task_id);
}
public void UpdateLastStsName(String file_name) {
if (!last_sts_name.equals(file_name)) {
last_sts_name = file_name;
try {
CommonUtils.db.Update(this);
Utils_.db.Update(this);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
}
@@ -92,7 +92,7 @@ public class RunTask extends Task {
try {
if (p != null) CleanTime = Double.parseDouble(p);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
@Override

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Linux;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Makefile.Makefile;
import _VisualDVM.GlobalData.Tasks.CompilationTask.CompilationTask;
@@ -33,7 +33,7 @@ public class LinuxLocalCompilationSupervisor extends LinuxLocalTaskSupervisor<Co
protected void ValidateTaskResults() throws Exception {
if (getBinary().exists()) {
File renamed_binary = Paths.get(getProjectCopy().getAbsolutePath(),
CommonUtils.getDateName("spf")).toFile();
Utils_.getDateName("spf")).toFile();
task.binary_name = renamed_binary.getName();
Files.move(getBinary().toPath(), renamed_binary.toPath(), StandardCopyOption.REPLACE_EXISTING);
task.state = TaskState.Done;

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Linux;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Tasks.Supervisor.Local.LocalTaskSupervisor;
@@ -24,10 +24,10 @@ public abstract class LinuxLocalTaskSupervisor<T extends Task> extends LocalTask
User user = task.getUser();
return
String.join(" ",
CommonUtils.DQuotes(user.getStarterFile()),
CommonUtils.DQuotes(user.getLauncherFile()),
Utils_.DQuotes(user.getStarterFile()),
Utils_.DQuotes(user.getLauncherFile()),
String.valueOf(task.maxtime),
CommonUtils.DQuotes(getCoupDeGrace()),
Utils_.DQuotes(getCoupDeGrace()),
task.getFullCommand()
);
}
@@ -48,7 +48,7 @@ public abstract class LinuxLocalTaskSupervisor<T extends Task> extends LocalTask
if (task.PID.isEmpty())
throw new PassException("Ошибка при старте : идентификатор задачи не определен.");
task.StartDate = (new Date()).getTime();
pass.ShowMessage1("Задача активна, идентификатор " + CommonUtils.Brackets(task.PID));
pass.ShowMessage1("Задача активна, идентификатор " + Utils_.Brackets(task.PID));
RefreshProgress();
do {
Thread.sleep(getTaskCheckPeriod() * 1000L);

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Tasks.RunTask.RunTask;
@@ -44,7 +44,7 @@ public abstract class LocalTaskSupervisor<T extends Task> extends TaskSupervisor
return Paths.get(task.getUser().getLocalProjectsDir().getAbsolutePath(), project.getUniqKey()).toFile();
}
protected File getBinary() {
return Paths.get(getProjectCopy().getAbsolutePath(), "0" + (CommonUtils.isWindows() ? ".exe" : "")).toFile();
return Paths.get(getProjectCopy().getAbsolutePath(), "0" + (Utils_.isWindows() ? ".exe" : "")).toFile();
}
protected File getProjectOutput() {
return Paths.get(getProjectCopy().getAbsolutePath(), Constants.out_file).toFile();

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Windows;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.GlobalData.Makefile.Makefile;
@@ -19,7 +19,7 @@ public class WindowsLocalCompilationSupervisor extends WindowsLocalTaskSuperviso
}
@Override
protected String getScriptText() {
return CommonUtils.DQuotes(((GlobalDatabase)CommonUtils.db).settings.get(SettingName.LocalMakePathWindows).Value) + " 1>out.txt 2>err.txt";
return Utils_.DQuotes(((GlobalDatabase) Utils_.db).settings.get(SettingName.LocalMakePathWindows).Value) + " 1>out.txt 2>err.txt";
}
//скорее всего как то выделить подготовку к компиляции как метод предка.
@Override
@@ -45,7 +45,7 @@ public class WindowsLocalCompilationSupervisor extends WindowsLocalTaskSuperviso
protected void ValidateTaskResults() throws Exception {
if (getBinary().exists()) {
File renamed_binary = Paths.get(getProjectCopy().getAbsolutePath(),
CommonUtils.getDateName("spf") + ".exe").toFile();
Utils_.getDateName("spf") + ".exe").toFile();
task.binary_name = renamed_binary.getName();
Files.move(getBinary().toPath(), renamed_binary.toPath(), StandardCopyOption.REPLACE_EXISTING);
task.state = TaskState.Done;

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Local.Windows;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.GlobalData.Tasks.Supervisor.Local.LocalTaskSupervisor;
import _VisualDVM.GlobalData.Tasks.Task;
import _VisualDVM.GlobalData.Tasks.TaskState;
@@ -21,7 +21,7 @@ public abstract class WindowsLocalTaskSupervisor<T extends Task> extends LocalTa
try {
AbortTask();
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
task.state = TaskState.AbortedByTimeout;
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Remote;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
import _VisualDVM.GlobalData.Tasks.QueueSystem.MVS;
@@ -32,7 +32,7 @@ public class MVSRunSupervisor extends ServerRunSupervisor {
String env = String.join(" ", Current.getRunConfiguration().getEnvList());
mvs_time = (task.maxtime / 60); //в минутах
if (task.maxtime % 60 > 0) mvs_time += 1;
String res = "maxtime=" + CommonUtils.DQuotes(mvs_time) + " ./run";
String res = "maxtime=" + Utils_.DQuotes(mvs_time) + " ./run";
if (!env.isEmpty())
res = env + " " + res;
/*

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Remote;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Makefile.Makefile;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
@@ -36,7 +36,7 @@ public class RemoteCompilationSupervisor extends RemoteTaskSupervisor<Compilatio
@Override
protected void ValidateTaskResults() throws Exception {
if (pass.user.connection.Exists(getBinary())) {
RemoteFile renamed_binary = new RemoteFile(getRemoteProject().full_name, CommonUtils.getDateName("spf_" + getBinary().name));
RemoteFile renamed_binary = new RemoteFile(getRemoteProject().full_name, Utils_.getDateName("spf_" + getBinary().name));
pass.user.connection.sftpChannel.rename(getBinary().full_name, renamed_binary.full_name);
task.binary_name = renamed_binary.name;
task.state = TaskState.Done;

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Remote;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
import _VisualDVM.GlobalData.Tasks.Supervisor.TaskSupervisor;
@@ -77,10 +77,10 @@ public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSuperviso
protected String getStartCommand() {
String res =
String.join(" ",
CommonUtils.DQuotes(getStarter()),
CommonUtils.DQuotes(getLauncher()),
Utils_.DQuotes(getStarter()),
Utils_.DQuotes(getLauncher()),
String.valueOf(task.maxtime),
CommonUtils.DQuotes(getCoupDeGrace()),
Utils_.DQuotes(getCoupDeGrace()),
task.getFullCommand()
);
return res;

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.Tasks.Supervisor;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Tasks.Task;
import _VisualDVM.GlobalData.Tasks.TaskState;
@@ -16,7 +16,7 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass> {
public void ShowTaskState(){
CommonUtils.db.tables.get(task.getClass()).ShowUI(task.getPK());
Utils_.db.tables.get(task.getClass()).ShowUI(task.getPK());
}
public void Init(T task_in, P pass_in, db_project_info project_in) {
task = task_in;
@@ -25,7 +25,7 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass> {
try {
project.CleanInterruptFile();
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
protected void PrepareWorkspace() throws Exception {
@@ -96,7 +96,7 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass> {
task.state = TaskState.AbortedByUser;
ShowTaskState();
}
pass.ShowMessage1("Задача " + CommonUtils.Brackets(task.state.getDescription()));
pass.ShowMessage1("Задача " + Utils_.Brackets(task.state.getDescription()));
task.EndDate = (new Date()).getTime();
pass.ShowMessage2("Получение результатов");
AchieveResults();
@@ -119,7 +119,7 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass> {
if (task.PID.isEmpty())
throw new PassException("Ошибка при старте : идентификатор задачи не определен.");
task.StartDate = (new Date()).getTime();
pass.ShowMessage1("Задача активна, идентификатор " + CommonUtils.Brackets(task.PID));
pass.ShowMessage1("Задача активна, идентификатор " + Utils_.Brackets(task.PID));
RefreshProgress();
do {
Thread.sleep(getTaskCheckPeriod() * 1000);
@@ -132,6 +132,6 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass> {
}
}
public void UpdateTask() throws Exception {
CommonUtils.db.Update(task);
Utils_.db.Update(task);
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.GlobalData.Tasks;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Utils;
@@ -44,7 +44,7 @@ public abstract class Task extends iDBObject {
EndDate = 0;
Time = 0;
state = TaskState.Inactive;
CommonUtils.db.Update(this);
Utils_.db.Update(this);
}
//</editor-fold>
//<editor-fold desc="локальные файлы">
@@ -66,10 +66,10 @@ public abstract class Task extends iDBObject {
return new Date(EndDate);
}
public Machine getMachine() {
return CommonUtils.db.getById(Machine.class, machine_id);
return Utils_.db.getById(Machine.class, machine_id);
}
public User getUser() {
return CommonUtils.db.getById(User.class, user_id);
return Utils_.db.getById(User.class, user_id);
}
protected String getTextResult(File file) {
return (file.exists()) ? Utils.ReadAllText(file) : "файл не найден. Задача еще не выполнялась или была завершена некорректно";
@@ -92,9 +92,9 @@ public abstract class Task extends iDBObject {
if (state != state_in) {
state = state_in;
try {
CommonUtils.db.Update(this);
Utils_.db.Update(this);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.GlobalData.User.UI;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import Common.Visual.Menus.TextEditorMenu;
import Common.Visual.TextField.StyledPasswordField;
import Common.Visual.TextField.StyledTextField;
@@ -27,7 +27,7 @@ public class UserFields implements DialogFields {
public void actionPerformed(ActionEvent e) {
password_visible = !password_visible;
tfPassword.setEchoChar(password_visible ? unmask : mask);
bPasswordVisibility.setIcon(CommonUtils.getIcon("/icons/" + (password_visible ? "Show" : "Hide") + "Password.png"));
bPasswordVisibility.setIcon(Utils_.getIcon("/icons/" + (password_visible ? "Show" : "Hide") + "Password.png"));
}
});
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Visual.Menus.StableMenuItem;
import Visual_DVM_2021.Passes.PassCode;
import Common.Passes.Pass;
@@ -158,7 +158,7 @@ public class GlobalProperties {
//-
menu_item.addActionListener(e -> {
if (Pass.passes.get(PassCode.UpdateProperty).Do(fieldName, !getFlag(fieldName)))
menu_item.setIcon(CommonUtils.getIcon(getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
menu_item.setIcon(Utils_.getIcon(getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
});
menu.add(menu_item);
}
@@ -184,7 +184,7 @@ public class GlobalProperties {
}
public void Update() {
try {
CommonUtils.jsonToFile(this, getFile());
Utils_.jsonToFile(this, getFile());
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Files;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Current;
import _VisualDVM.Utils;
@@ -85,7 +85,7 @@ public class DBProjectFile extends ProjectFile {
if (data.length > 1) {
String[] data1 = data[1].split(":");
if (data1.length > 0) {
file = CommonUtils.toW(data1[0]);//.substring(1));
file = Utils_.toW(data1[0]);//.substring(1));
//первый символ тут всегда пробел. слеши всегда виндовые.
}
}
@@ -97,7 +97,7 @@ public class DBProjectFile extends ProjectFile {
lastLine = line_in;
father.db.Update(this);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
}
@@ -156,7 +156,7 @@ public class DBProjectFile extends ProjectFile {
String default_options = "";
switch (languageName) {
case fortran:
default_options += " -spf -noProject -o " + CommonUtils.DQuotes(getDepFile().getAbsolutePath());
default_options += " -spf -noProject -o " + Utils_.DQuotes(getDepFile().getAbsolutePath());
switch (style) {
case free:
default_options += " -f90";
@@ -292,7 +292,7 @@ public class DBProjectFile extends ProjectFile {
father.db.Update(this);
return true;
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
return false;
@@ -304,7 +304,7 @@ public class DBProjectFile extends ProjectFile {
father.db.Update(this);
return true;
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
return false;
@@ -316,7 +316,7 @@ public class DBProjectFile extends ProjectFile {
father.db.Update(this);
return true;
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
return false;
@@ -390,10 +390,10 @@ public class DBProjectFile extends ProjectFile {
father.db.Update(this);
}
public String getUnixName() {
return CommonUtils.toU(name);
return Utils_.toU(name);
}
public String getQObjectName() {
return CommonUtils.DQuotes(getUnixName() + ".o");
return Utils_.DQuotes(getUnixName() + ".o");
}
@Override
@@ -401,7 +401,7 @@ public class DBProjectFile extends ProjectFile {
return name;
}
public String getProjectNameWithoutExtension() {
String extension = CommonUtils.getExtension(file);
String extension = Utils_.getExtension(file);
return name.substring(0, name.length() - (extension.length() + 1));
}
public void importSettings(DBProjectFile parent, boolean sapforStyle) throws Exception {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Files;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import Common.Database.Objects.DBObject;
import _VisualDVM.ProjectData.LanguageName;
@@ -48,7 +48,7 @@ public class ProjectFile extends DBObject {
}
}
//-
switch (CommonUtils.getExtensionFromName(name_in)) {
switch (Utils_.getExtensionFromName(name_in)) {
case "f":
case "fdv":
case "for":
@@ -87,7 +87,7 @@ public class ProjectFile extends DBObject {
fileType = FileType.forbidden;
break;
case "":
if (CommonUtils.isIntegerValue(name_in)) {
if (Utils_.isIntegerValue(name_in)) {
fileType = FileType.forbidden;
} else {
state = FileState.Excluded;
@@ -130,14 +130,14 @@ public class ProjectFile extends DBObject {
return new ImageIcon(imageUrl);
}
public String getUnixName() {
return CommonUtils.toU(file.getName());
return Utils_.toU(file.getName());
}
@Override
public String toString() {
return file.getName();
}
public String getQSourceName() {
return CommonUtils.DQuotes(getUnixName());
return Utils_.DQuotes(getUnixName());
}
public String getStyleOptions() {
if (languageName == LanguageName.fortran) {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.Directives;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Visual.Editor.CaretInfo;
import _VisualDVM.ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.Providers.BaseProvider;
import _VisualDVM.ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.SapforAutoComplete;
@@ -18,7 +18,7 @@ public class BaseDirective extends BasicCompletion {
getCaretInfo().suffix_word.isEmpty() &&
name.getText().startsWith(getCaretInfo().prefix_word)
&& (!name.getText().equals(getCaretInfo().prefix_word))
&& !CommonUtils.isRBracketsBalanced(getCaretInfo().before);
&& !Utils_.isRBracketsBalanced(getCaretInfo().before);
}
//итоговая функция, определяющая наличие директивы в автозаполнении
public boolean Check() {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.Directives;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.Providers.BaseProvider;
public class IntervalDirective extends BaseDirective {
protected String prefix;
@@ -19,9 +19,9 @@ public class IntervalDirective extends BaseDirective {
}
@Override
public String getReplacementText() {
prefix = CommonUtils.removeRedundantSpaces(getCaretInfo().before.substring(0, getCaretInfo().before.length() - getCaretInfo().prefix_word.length()));
prefix = Utils_.removeRedundantSpaces(getCaretInfo().before.substring(0, getCaretInfo().before.length() - getCaretInfo().prefix_word.length()));
word = name.getText();
suffix = CommonUtils.removeRedundantSpaces(getCaretInfo().after.substring(getCaretInfo().suffix_word.length()));
suffix = Utils_.removeRedundantSpaces(getCaretInfo().after.substring(getCaretInfo().suffix_word.length()));
String pp = prefix.replace(" ", "");
String ps = suffix.replace(" ", "");
if ((!ps.isEmpty()) && (ps.charAt(0) != ','))

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.Directives;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.ProjectData.Files.UI.Editor.AutoComplete.SAPFOR.Providers.BaseProvider;
//промежуточный тип. относится ко всем директивам со скобками и требующим запятых.
public class SpecDirective extends BaseDirective {
@@ -16,9 +16,9 @@ public class SpecDirective extends BaseDirective {
}
@Override
public String getReplacementText() {
prefix = CommonUtils.removeRedundantSpaces(getCaretInfo().before.substring(0, getCaretInfo().before.length() - getCaretInfo().prefix_word.length()));
prefix = Utils_.removeRedundantSpaces(getCaretInfo().before.substring(0, getCaretInfo().before.length() - getCaretInfo().prefix_word.length()));
word = get_word();
suffix = CommonUtils.removeRedundantSpaces(getCaretInfo().after.substring(getCaretInfo().suffix_word.length()));
suffix = Utils_.removeRedundantSpaces(getCaretInfo().after.substring(getCaretInfo().suffix_word.length()));
String pp = prefix.replace(" ", "");
String ps = suffix.replace(" ", "");
if (!pp.isEmpty() && (pp.charAt(pp.length() - 1) != ',') && (pp.charAt(pp.length() - 1) != '('))

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Files.UI.Editor;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.Global;
@@ -46,7 +46,7 @@ public class SPFEditor extends BaseEditor implements SPFEditorInterface {
highlighter = (RSyntaxTextAreaHighlighter) getHighlighter();
autoComplete = new SapforAutoComplete(this);
//-------------------------
float font_size = (float) ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.EditorFontSize).toInt32();
float font_size = (float) ((GlobalDatabase) Utils_.db).settings.get(SettingName.EditorFontSize).toInt32();
setFont(getFont().deriveFont(font_size));
//-------------------------
setText(Utils.ReadAllText(file.file).replace("\r", " "));
@@ -151,7 +151,7 @@ public class SPFEditor extends BaseEditor implements SPFEditorInterface {
painter
));
} catch (BadLocationException ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
}
@@ -167,7 +167,7 @@ public class SPFEditor extends BaseEditor implements SPFEditorInterface {
Pair<Long, Integer> p = file.gcov_info.line_info.get(lineNum);
Color color = never;
if (p.getKey() > 0) {
color = (p.getValue() >= ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.GCOVLimit).toInt32()) ?
color = (p.getValue() >= ((GlobalDatabase) Utils_.db).settings.get(SettingName.GCOVLimit).toInt32()) ?
new Color(255, 255, (100 - p.getValue()), 90) : null;
}
if (color != null) {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Files.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Fonts.VisualiserFonts;
import _VisualDVM.Visual.UI;
@@ -41,7 +41,7 @@ public class FilesHyperlinksPanel extends JPanel {
}
});
Hyperlinks.setLayoutOrientation(JList.VERTICAL);
Hyperlinks.setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
Hyperlinks.setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
add(Hyperlinks, BorderLayout.CENTER);
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Files.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Global;
import Common.Visual.Fonts.VisualiserFonts;
import Common.Visual.Trees.StyledTreeCellRenderer;
@@ -23,7 +23,7 @@ public class FilesTreeCellRenderer extends StyledTreeCellRenderer {
File dir = (File) o;
setIcon(new ImageIcon(getClass().getResource("/icons/Folder.png")));
setText(dir.getName());
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreePlain));
} else if (o instanceof DBProjectFile) {
DBProjectFile file = (DBProjectFile) o;
if (Global.files_multiselection) {
@@ -32,8 +32,8 @@ public class FilesTreeCellRenderer extends StyledTreeCellRenderer {
setIcon(file.GetIcon());
}
setText(file.file.getName());
if (file.IsMain()) setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeBold));
else setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreePlain));
if (file.IsMain()) setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreeBold));
else setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreePlain));
if (file.state.equals(FileState.Excluded)) {
Map attributes = getFont().getAttributes();
attributes.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);

View File

@@ -1,7 +1,7 @@
package _VisualDVM.ProjectData.Messages;
import Common.Current_;
import Common.Mode;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.GlobalDatabase;
@@ -31,7 +31,7 @@ public class Message extends FileObject {
(Global.mode != Mode.Normal)) {
value = value_in;
} else {
value = !((GlobalDatabase)CommonUtils.db).settings.get(SettingName.TRANSLATE_MESSAGES).toBoolean() ? value_in : decodeRussianMessage(value_in);
value = !((GlobalDatabase) Utils_.db).settings.get(SettingName.TRANSLATE_MESSAGES).toBoolean() ? value_in : decodeRussianMessage(value_in);
}
}
// last code - 183
@@ -397,9 +397,9 @@ public class Message extends FileObject {
}
} while (idx != -1);
if (sum != splited.length && !message.equals("")) {
CommonUtils.CopyToClipboard(message);
Utils_.CopyToClipboard(message);
throw new PassException("Ошибка при декодировании сообщений на русском языке\n" +
"message=" + CommonUtils.Brackets(message));
"message=" + Utils_.Brackets(message));
}
idx = 0;
String result = "";

View File

@@ -1,6 +1,6 @@
package _VisualDVM.ProjectData.Messages.Recommendations;
import Common.Database.Objects.iDBObject;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.GlobalData.Settings.SettingName;
import Visual_DVM_2021.Passes.PassCode;
import com.sun.org.glassfish.gmbal.Description;
@@ -19,18 +19,18 @@ public class MessageRecommendation extends iDBObject {
public MessageRecommendation(PassCode passCode_in) {
type = RecommendationType.Transformation;
argName = passCode_in.toString();
text = "Выполните преобразование " + CommonUtils.Quotes(passCode_in.getDescription());
text = "Выполните преобразование " + Utils_.Quotes(passCode_in.getDescription());
}
public MessageRecommendation(SettingName settingName_in, String settingValue_in) {
type = RecommendationType.Setting;
argName = settingName_in.toString();
argValue = settingValue_in;
if (argValue.equals("1"))
text = "Включите настройку SAPFOR " + CommonUtils.Quotes(settingName_in.getDescription());
text = "Включите настройку SAPFOR " + Utils_.Quotes(settingName_in.getDescription());
else if (argValue.equals("0"))
text = "Отключите настройку SAPFOR " + CommonUtils.Quotes(settingName_in.getDescription());
text = "Отключите настройку SAPFOR " + Utils_.Quotes(settingName_in.getDescription());
else
text = "Задайте значение " + CommonUtils.DQuotes(argValue) + " для настройки SAPFOR " + CommonUtils.Quotes(settingName_in.getDescription());
text = "Задайте значение " + Utils_.DQuotes(argValue) + " для настройки SAPFOR " + Utils_.Quotes(settingName_in.getDescription());
}
public MessageRecommendation(String text_in) {
type = RecommendationType.Text;

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.Project.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import Common.Visual.Selectable;
@@ -42,7 +42,7 @@ public class VersionsTreeCellRenderer extends StyledTreeCellRenderer {
}
}
setForeground(tree.getForeground());
setFont(CommonUI.getTheme().Fonts.get(
setFont(UI_.getTheme().Fonts.get(
version.isNew ? VisualiserFonts.NewVersion : VisualiserFonts.TreePlain));
setText(version.getTitle());
return this;

View File

@@ -1,8 +1,8 @@
package _VisualDVM.ProjectData.Project;
import Common.CommonConstants;
import Common.Current_;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Constants;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
@@ -172,13 +172,13 @@ public class db_project_info extends DBObject {
parent = parent_in;
name = parent.GenerateVersionName(letter_in);
languageName = parent.languageName;
style = ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
style = ((GlobalDatabase) Utils_.db).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
description = description_in;
original = original_in;
Home = Paths.get(parent_in.Home.getAbsolutePath(), name).toFile();
parent.SaveVersionToBuild(name);
if (!Home.mkdir()) throw new PassException("Не удалось создать папку для версии");
creationDate = CommonUtils.getDateNumber(); //----------------------------------------------------------------------------->>>
creationDate = Utils_.getDateNumber(); //----------------------------------------------------------------------------->>>
CreateVisualiserData();
parent.AddVersion(this);
//если это делать раньше, папка версии учтется как подпапка.
@@ -191,7 +191,7 @@ public class db_project_info extends DBObject {
name = Home.getName();
description = description_;
if (create_data) {
creationDate = CommonUtils.getDateNumber(); //----------------------------------------------------------------------------->>>
creationDate = Utils_.getDateNumber(); //----------------------------------------------------------------------------->>>
CreateVisualiserData();
}
}
@@ -208,7 +208,7 @@ public class db_project_info extends DBObject {
if (stored_info == null) {
name = Home.getName();
description = "";
creationDate = CommonUtils.getDateNumber(); //----------------------------------------------------------------------------->>>
creationDate = Utils_.getDateNumber(); //----------------------------------------------------------------------------->>>
db.Insert(this);
} else
ExtractStoredInfo(stored_info);
@@ -252,7 +252,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public void UpdatefgResistance(int resistance_in) {
@@ -260,7 +260,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public void UpdatefgScreen(double screen_in) {
@@ -268,7 +268,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public void UpdateCompilationMaxtime(int ct_in) {
@@ -276,7 +276,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public void UpdateRunMaxtime(int rt_in) {
@@ -284,7 +284,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
//</editor-fold>
@@ -301,7 +301,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public void SwitchFilterMultiplied() {
@@ -309,15 +309,15 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public boolean IsMCopy() {
String lname = name.toLowerCase();
return (lname.startsWith("m") && CommonUtils.isIntegerValue(lname.substring(1)));
return (lname.startsWith("m") && Utils_.isIntegerValue(lname.substring(1)));
}
public String getTitle() {
return name + " " + CommonUtils.DQuotes(description);
return name + " " + Utils_.DQuotes(description);
}
public File getProjFile() {
return Paths.get(Home.getAbsolutePath(), Constants.data, Constants.spf).toFile();
@@ -452,7 +452,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
public boolean UpdateLanguage(LanguageName lang_in) {
@@ -543,7 +543,7 @@ public class db_project_info extends DBObject {
db.Update(this);
return true;
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
return false;
}
@@ -551,14 +551,14 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public void UpdateDVMCount() {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public boolean UpdateAddictedCount() {
@@ -566,7 +566,7 @@ public class db_project_info extends DBObject {
db.Update(this);
return true;
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
return false;
}
@@ -678,8 +678,8 @@ public class db_project_info extends DBObject {
public boolean FolderNotExists(File new_directory, File subdir, TextLog passLog) {
for (File pf : getSubdirectoriesSimple(subdir)) {
if (pf.getName().equals(new_directory.getName())) {
passLog.Writeln("В папке " + CommonUtils.Brackets(subdir.getAbsolutePath()) + "\n" +
"уже существует папка с именем " + CommonUtils.Brackets(new_directory.getName()));
passLog.Writeln("В папке " + Utils_.Brackets(subdir.getAbsolutePath()) + "\n" +
"уже существует папка с именем " + Utils_.Brackets(new_directory.getName()));
return false;
}
}
@@ -700,7 +700,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
public mxGraphComponent DrawFunctionsGraph() {
@@ -718,8 +718,8 @@ public class db_project_info extends DBObject {
}
public boolean CheckAttachmentFile(File f, TextLog Log) {
Utils.validateFileShortNewName(f.getName(), Log);
if (CommonUtils.getFileSizeMegaBytes(f) > 2)
Log.Writeln_("Размер вложения " + CommonUtils.Brackets(f.getName()) + " превышает 2 Мb");
if (Utils_.getFileSizeMegaBytes(f) > 2)
Log.Writeln_("Размер вложения " + Utils_.Brackets(f.getName()) + " превышает 2 Мb");
return Log.isEmpty();
}
public boolean CheckAllAttachments(TextLog Log) {
@@ -848,7 +848,7 @@ public class db_project_info extends DBObject {
for (String key_ : versions.keySet()) {
String[] data_ = key_.split(letter);
String last = data_[data_.length - 1];
if (CommonUtils.isIntegerValue(last)) {
if (Utils_.isIntegerValue(last)) {
int vn = Integer.parseInt(last);
if (vn > max_vn)
max_vn = vn;
@@ -866,7 +866,7 @@ public class db_project_info extends DBObject {
for (DBProjectFile file : parent.db.files.Data.values()) {
Files.copy(file.file.toPath(),
Paths.get(Home.getAbsolutePath(),
CommonUtils.isWindows() ? file.name :
Utils_.isWindows() ? file.name :
file.name.replace('\\', '/')));
}
}
@@ -906,7 +906,7 @@ public class db_project_info extends DBObject {
}
}
public void createEmptyVersion(String versionLetter, String versionDescription) throws Exception {
boolean needsM = ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.SaveModifications).toBoolean();
boolean needsM = ((GlobalDatabase) Utils_.db).settings.get(SettingName.SaveModifications).toBoolean();
if (needsM)
createModification();
last_version = new db_project_info(
@@ -924,7 +924,7 @@ public class db_project_info extends DBObject {
last_version.description = description_in;
last_version.original = last_modification.name;
last_version.Home = versionDirectory;
last_version.creationDate = CommonUtils.getDateNumber(); //----------------------------------------------------------------------------->>>
last_version.creationDate = Utils_.getDateNumber(); //----------------------------------------------------------------------------->>>
last_version.CreateVisualiserData();
this.AddVersion(last_version);
}
@@ -1090,7 +1090,7 @@ public class db_project_info extends DBObject {
for (DBProjectFile file : db.files.Data.values()) {
File src_file = file.file;
File dst_file = Paths.get(dst.getAbsolutePath(),
CommonUtils.isWindows() ? file.name :
Utils_.isWindows() ? file.name :
file.name.replace('\\', '/')).toFile();
Files.copy(src_file.toPath(), dst_file.toPath());
}
@@ -1128,7 +1128,7 @@ public class db_project_info extends DBObject {
String[] splited = packed_messages.split("\\|");
int numberOfFiles = Integer.parseInt(splited[idx++]);
for (int i = 0; i < numberOfFiles; ++i) {
String message_file = CommonUtils.toW(splited[idx++]); //для ключа.
String message_file = Utils_.toW(splited[idx++]); //для ключа.
int numberOfMessages = Integer.parseInt(splited[idx++]);
if (!db.files.Data.containsKey(message_file)) {
throw new PassException("Ошибка при распаковке сообщений: файл: [" +
@@ -1162,7 +1162,7 @@ public class db_project_info extends DBObject {
String[] localSplit = splited[idx++].split(" ");
int m_type = Integer.parseInt(localSplit[0]);
if (m_type == 1) {
CommonUI.Info(packed_messages);
UI_.Info(packed_messages);
return true;
}
}
@@ -1235,7 +1235,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
for (ParallelRegion parallelRegion : parallelRegions.Data.values())
parallelRegion.UpdateLoopsCount();
@@ -1244,7 +1244,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
for (ParallelRegion parallelRegion : parallelRegions.Data.values())
parallelRegion.UpdateFunctionsCount();
@@ -1254,7 +1254,7 @@ public class db_project_info extends DBObject {
try {
db.Update(this);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
for (ParallelRegion parallelRegion : parallelRegions.Data.values())
parallelRegion.UpdateArraysCount();

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Arrays;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
// это то что отображается в боковом графе файла. не путать с сапфоровским ProjectArray
@@ -13,6 +13,6 @@ public class ArrayDecl extends FileObjectWithMessages {
}
@Override
public String Description() {
return array_loc.getDescription() + " массив " + CommonUtils.Brackets(array_name);
return array_loc.getDescription() + " массив " + Utils_.Brackets(array_name);
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Arrays;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Tables.DataSet;
import Common.Visual.DataSetControlForm;
@@ -39,7 +39,7 @@ public class ArraysSet extends DataSet<Long, ProjectArray> {
@Override
protected void AdditionalInitColumns() {
columns.get(0).setVisible(false);
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.ShowFullArraysDeclarations).toBoolean()) {
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.ShowFullArraysDeclarations).toBoolean()) {
columns.get(4).setRenderer(RendererHyperlinks);
columns.get(4).setEditor(EditorHyperlinks);
} else {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Arrays;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import Common.Utils.Index;
@@ -103,7 +103,7 @@ public class ProjectArray extends DBObject {
int numDeclPlaces = Integer.parseInt(localSplited[2]);
int idxPl = 3;
for (int i = 0; i < numDeclPlaces; ++i, idxPl += 2) {
String declFile = CommonUtils.toW(localSplited[idxPl]);
String declFile = Utils_.toW(localSplited[idxPl]);
DBProjectFile file = Current.getProject().db.files.Data.get(declFile);
int declLine = Integer.parseInt(localSplited[idxPl + 1]);
//declPlaces.add(new Pair<>(declFile, declLine));
@@ -318,7 +318,7 @@ public class ProjectArray extends DBObject {
default:
break;
}
res += CommonUtils.ending(i == binary.length() - 1);
res += Utils_.ending(i == binary.length() - 1);
}
}
return res;
@@ -358,7 +358,7 @@ public class ProjectArray extends DBObject {
}
@Override
public ImageIcon GetDisabledIcon() {
return CommonUtils.getIcon("/icons/Arrays/" + State.toString() + ".png");
return Utils_.getIcon("/icons/Arrays/" + State.toString() + ".png");
}
@Override
public void select(boolean flag) {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Arrays.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Tables.RendererCell;
import Common.Visual.Fonts.VisualiserFonts;
import _VisualDVM.ProjectData.SapforData.Arrays.Templates.TemplateDimension;
@@ -14,7 +14,7 @@ public class DimensionRenderer extends RendererCell<TemplateDimension> {
public void Display() {
if (value != null) {
setText(value.state.getMaskDescription());
setFont(value.isBlocked() ? CommonUI.getTheme().Fonts.get(VisualiserFonts.Disabled) : CommonUI.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setFont(value.isBlocked() ? UI_.getTheme().Fonts.get(VisualiserFonts.Disabled) : UI_.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
}
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Arrays.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Tables.DBObjectEditor;
import Common.Visual.Fonts.VisualiserFonts;
import _VisualDVM.Visual.UI;
@@ -17,7 +17,7 @@ public class DimensionStateChanger extends DBObjectEditor<TemplateDimension> {
}
@Override
public void Action() {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Hyperlink));
value.SwitchState();
setText(value.state.getMaskDescription());
UI.getVersionsWindow().getVariantsWindow().ShowFilteredVariantsCount();

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Arrays.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.ControlForm;
import Common.Visual.Tables.Grid.GridAnchestor;
@@ -26,7 +26,7 @@ public class DimensionsTableForm extends ControlForm<StyledTable> {
@Override
public void Clear() {
super.Clear();
CommonUI.Clear(content);
UI_.Clear(content);
}
@Override
public void CreateControl() {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Arrays.UI;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Fonts.VisualiserFonts;
import Common.Visual.Trees.StyledTreeCellRenderer;
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
@@ -14,9 +14,9 @@ public class RulesTreeCellRenderer extends StyledTreeCellRenderer {
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
Object o = ((DefaultMutableTreeNode) value).getUserObject();
if (o instanceof String) {
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Distribution));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Distribution));
} else if (o instanceof ParallelRegion)
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
setForeground(tree.getForeground());
return this;
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.iDBObject;
import _VisualDVM.Visual.UI;
@@ -18,7 +18,7 @@ public abstract class FileObject extends iDBObject {
}
@Override
public String getSelectionText() {
return "файл " + CommonUtils.Brackets(file) + " строка: " + line;
return "файл " + Utils_.Brackets(file) + " строка: " + line;
}
public DBProjectFile getFather() {
return Current.getProject().db.files.Data.get(file);

View File

@@ -1,6 +1,6 @@
package _VisualDVM.ProjectData.SapforData.Functions;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
import Visual_DVM_2021.Passes.PassCode;
@@ -25,14 +25,14 @@ public class FuncCall extends FileObjectWithMessages {
}
@Override
public String Description() {
return "вызов " + CommonUtils.Brackets(funcName);
return "вызов " + Utils_.Brackets(funcName);
}
@Override
public void Select(boolean flag) {
if (Pass.passes.get(PassCode.SPF_GetGraphFunctions).isDone()) {
super.Select(flag);
} else {
CommonUI.Info("Для подстановки функций требуется выполнить проход " + CommonUtils.DQuotes(PassCode.SPF_GetGraphFunctions.getDescription()));
UI_.Info("Для подстановки функций требуется выполнить проход " + Utils_.DQuotes(PassCode.SPF_GetGraphFunctions.getDescription()));
}
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.ProjectData.SapforData.Functions;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import Visual_DVM_2021.Passes.PassCode;
import Common.Passes.Pass;
@@ -29,7 +29,7 @@ public class FuncCallH extends FuncCall {
}
@Override
public String getSelectionText() {
return "вызов " + CommonUtils.Brackets(funcName) + " в строке " + line;
return "вызов " + Utils_.Brackets(funcName) + " в строке " + line;
}
@Override
public void SelectAllChildren(boolean select) {
@@ -41,7 +41,7 @@ public class FuncCallH extends FuncCall {
if (Pass.passes.get(PassCode.SPF_GetGraphFunctions).isDone()) {
super.Select(flag);
} else {
CommonUI.Info("Для подстановки функций требуется выполнить проход " + CommonUtils.DQuotes(PassCode.SPF_GetGraphFunctions.getDescription()));
UI_.Info("Для подстановки функций требуется выполнить проход " + Utils_.DQuotes(PassCode.SPF_GetGraphFunctions.getDescription()));
}
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Functions;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import Common.Utils.Index;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
@@ -52,7 +52,7 @@ public class FuncInfo extends FileObjectWithMessages {
//--
@Override
public String getSelectionText() {
return type.getDescription() + " " + CommonUtils.Brackets(funcName);
return type.getDescription() + " " + Utils_.Brackets(funcName);
}
public boolean isMain() {
return type.equals(FunctionType.Main);
@@ -64,7 +64,7 @@ public class FuncInfo extends FileObjectWithMessages {
}
@Override
public ImageIcon GetDisabledIcon() {
return CommonUtils.getIcon("/icons/Function.png");
return Utils_.getIcon("/icons/Function.png");
}
@Override
public void SelectAllChildren(boolean select) {
@@ -77,6 +77,6 @@ public class FuncInfo extends FileObjectWithMessages {
}
@Override
public String Description() {
return type.getDescription() + " " + CommonUtils.Brackets(funcName);
return type.getDescription() + " " + Utils_.Brackets(funcName);
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Functions.UI.Graph;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.ControlForm;
import com.mxgraph.swing.mxGraphComponent;
@@ -22,6 +22,6 @@ public class FunctionsGraphForm extends ControlForm<mxGraphComponent> {
@Override
public void Clear() {
super.Clear();
CommonUI.Clear(content);
UI_.Clear(content);
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.ProjectData.SapforData.Functions.UI.Graph;
import Common.Current_;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Visual.Menus.VisualiserMenuItem;
import Common.Visual.Menus.StyledPopupMenu;
@@ -33,7 +33,7 @@ public class FunctionsGraphMenu extends StyledPopupMenu {
@Override
public void CheckElementsVisibility() {
if (Current.HasSelectedFunction()) {
changeCurrent.setText("Назначить процедуру " + CommonUtils.DQuotes(Current.getSelectionFunction().funcName) + " текущей.");
changeCurrent.setText("Назначить процедуру " + Utils_.DQuotes(Current.getSelectionFunction().funcName) + " текущей.");
changeCurrent.setEnabled(true);
} else {
changeCurrent.setText("Невозможно назначить текущую процедуру: узел графа не выбран");

View File

@@ -1,7 +1,7 @@
package _VisualDVM.ProjectData.SapforData.Functions.UI.Graph;
import Common.Current_;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.ProjectData.SapforData.Functions.FuncCoordinates;
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
@@ -244,7 +244,7 @@ public class FunctionsGraphUI extends mxGraph {
break;
case Standard:
case NotFound:
CommonUI.Info("процедура " + CommonUtils.Brackets(func_name) + " " + fi.type.getDescription());
UI_.Info("процедура " + Utils_.Brackets(func_name) + " " + fi.type.getDescription());
break;
}
break;

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Functions.UI.Graph;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import com.mxgraph.swing.mxGraphComponent;
import javafx.util.Pair;
@@ -44,7 +44,7 @@ public class GraphInfo {
Vector<String> edges = new Vector<>();
for (String name : vertexMap.keySet()) {
for (String neighbor : vertexMap.get(name)) {
edges.add(CommonUtils.Brackets(name + "," + neighbor));
edges.add(Utils_.Brackets(name + "," + neighbor));
}
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Includes;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.ProjectData.SapforData.FileObject;
public class DependencyInfo extends FileObject {
public DependencyInfo(String file_in) {
@@ -7,7 +7,7 @@ public class DependencyInfo extends FileObject {
}
@Override
public String getSelectionText() {
return "включение: " + CommonUtils.Brackets(file);
return "включение: " + Utils_.Brackets(file);
}
//мб на будущее расширить, в какой строке находится команда икнлудить файл.
// но это уже к Сапфору

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Includes;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.ProjectData.SapforData.FileObject;
import javax.swing.*;
@@ -19,7 +19,7 @@ public class FileInfo extends FileObject {
}
@Override
public ImageIcon GetDisabledIcon() {
return CommonUtils.getIcon("/icons/File.png");
return Utils_.getIcon("/icons/File.png");
}
@Override
public void SelectAllChildren(boolean select) {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ProjectData.SapforData.Regions;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import Common.Utils.Index;
@@ -39,7 +39,7 @@ public class ParallelRegion extends DBObject {
//распаковка Lines -----------------------------------------------
//---------------------------------------------------------------
for (int i = 0; i < lines_size; ++i) {
String line_file = CommonUtils.toW(localSplited[1]);
String line_file = Utils_.toW(localSplited[1]);
int line_list_size = Integer.parseInt(localSplited[2]);
Vector<Pair<Integer, Integer>> current_lines = new Vector<>(line_list_size);
for (int k = 0; k < line_list_size; ++k) {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository.BugReport;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.rDBObject;
@@ -64,7 +64,7 @@ public class BugReport extends rDBObject {
project_version = version_in;
visualiser_version = Global.visualiser.version;
sapfor_version = Global.Components.get(ComponentType.Sapfor_F).version;
sapfor_settings = ((GlobalDatabase)CommonUtils.db).settings.getSapforSettingsText();
sapfor_settings = ((GlobalDatabase) Utils_.db).settings.getSapforSettingsText();
percentage = 0;
description = description_in;
date = new Date().getTime();

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository.BugReport;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import Common.Utils.TextLog;
@@ -61,7 +61,7 @@ public class BugReportInterface {
return true;
}
public static String getMailTitlePrefix(BugReport object) {
return "Ошибка " + CommonUtils.Brackets(object.id) + ", автор " + CommonUtils.Brackets(object.sender_name) + " : ";
return "Ошибка " + Utils_.Brackets(object.id) + ", автор " + Utils_.Brackets(object.sender_name) + " : ";
}
public static Vector<String> getRecipients(BugReport object) {
Vector<String> res = new Vector<>();

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Repository.Component;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import Common.Database.Objects.DBObject;
import _VisualDVM.Global;
@@ -28,7 +28,7 @@ public abstract class Component extends DBObject implements Loggable {
VFileChooser fileChooser = null; ///для ручной установки.
public VFileChooser getFileChooser() {
return (fileChooser == null) ? (fileChooser = new VFileChooser("выбор файла для компонента " +
CommonUtils.Brackets(getComponentType().getDescription()), CommonUtils.getExtension(getFile())))
Utils_.Brackets(getComponentType().getDescription()), Utils_.getExtension(getFile())))
: fileChooser;
}
//--
@@ -87,7 +87,7 @@ public abstract class Component extends DBObject implements Loggable {
}
public boolean isValidVersion(TextLog Log, String desc) {
if (version == CommonConstants.Nan) {
Log.Writeln_("Не определена версия " + desc + " компонента " + CommonUtils.Brackets(getComponentType().getDescription()));
Log.Writeln_("Не определена версия " + desc + " компонента " + Utils_.Brackets(getComponentType().getDescription()));
return false;
}
return true;

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository.Component;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import Common.Visual.Menus.DataMenuBar;
import _VisualDVM.Visual.Menus.VisualiserMenu;
import Common.Visual.Fonts.VisualiserFonts;
@@ -12,7 +12,7 @@ public class ComponentsMenuBar extends DataMenuBar {
new VisualiserMenu(
"Восстановление предыдущей версии компонента", "/icons/Resurrect.png") {
{
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.Menu));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.Menu));
add(Pass.passes.get(PassCode.ResurrectComponent).createMenuItem());
add(Pass.passes.get(PassCode.ResurrectComponentFromServer).createMenuItem());
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository.Component;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Utils;
import java.text.DateFormat;
@@ -51,7 +51,7 @@ public class Instruction extends Component {
DateFormat df = new SimpleDateFormat("MMM dd yyyy HH:mm:ss", Locale.ENGLISH);
date_text = df.format(getFile().lastModified());
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
}

View File

@@ -1,12 +1,12 @@
package _VisualDVM.Repository.Component;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
public abstract class OSDComponent extends Component {
@Override
public String getFileName() {
return getComponentType().toString() + (CommonUtils.isWindows() ? ".exe" : "");
return getComponentType().toString() + (Utils_.isWindows() ? ".exe" : "");
}
@Override
public String getNewFileName() {
return getComponentType().toString() + "_new" + (CommonUtils.isWindows() ? ".exe" : "");
return getComponentType().toString() + "_new" + (Utils_.isWindows() ? ".exe" : "");
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Repository.Component.PerformanceAnalyzer;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import _VisualDVM.Global;
import analyzer.common.MessageJtoJ;
@@ -103,7 +103,7 @@ public class PerformanceAnalyzer extends Component {
return null;
});
Utils.startScript(Global.TempDirectory, Global.ComponentsDirectory, "analyzer",
"java -jar -Dprism.order=sw "+ CommonUtils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort()+ " --version" );
"java -jar -Dprism.order=sw "+ Utils_.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort()+ " --version" );
//-
server_thread.join();
} catch (Exception ex) {
@@ -125,7 +125,7 @@ public class PerformanceAnalyzer extends Component {
try {
Utils.startScript(Global.TempDirectory, Global.ComponentsDirectory, "analyzer",
"java -jar -Dprism.order=sw "+ CommonUtils.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort());
"java -jar -Dprism.order=sw "+ Utils_.DQuotes(Global.performanceAnalyzer.getFile()) + " --port "+ getPort());
//-
} catch (Exception ex) {
ex.printStackTrace();
@@ -144,7 +144,7 @@ public class PerformanceAnalyzer extends Component {
}
public void Start() {
if (isActive) {
CommonUI.Info("Анализатор уже запущен");
UI_.Info("Анализатор уже запущен");
} else {
main_thread = new Thread(this::ServerBody);
main_thread.start();

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository.Component.Sapfor;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Current;
import java.io.BufferedReader;
@@ -47,7 +47,7 @@ public class MessagesServer {
if (serverSocket != null)
serverSocket.close();
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public int getPort() {

View File

@@ -1,7 +1,7 @@
package _VisualDVM.Repository.Component.Sapfor;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Constants;
import _VisualDVM.Current;
import _VisualDVM.GlobalData.GlobalDatabase;
@@ -140,8 +140,8 @@ public abstract class Sapfor extends OSDComponent {
RunAnalysis("SPF_GetVersionAndBuildDate", -1, "", "");
Visualizer_2.UnpackVersionInfo(this, getResult());
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
CommonUI.Error("Не удалось получить версию компонента " + CommonUtils.DQuotes(getComponentType().getDescription()));
Utils_.MainLog.PrintException(e);
UI_.Error("Не удалось получить версию компонента " + Utils_.DQuotes(getComponentType().getDescription()));
}
}
public abstract String getUpdateCommand();
@@ -169,9 +169,9 @@ public abstract class Sapfor extends OSDComponent {
RunAnalysis("SPF_StatisticAnalyzer",
-1,
"",
CommonUtils.DQuotes(src.getAbsolutePath()) +
Utils_.DQuotes(src.getAbsolutePath()) +
" "
+ CommonUtils.DQuotes(dst.getAbsolutePath())
+ Utils_.DQuotes(dst.getAbsolutePath())
);
}
public void Restart() throws Exception {
@@ -185,7 +185,7 @@ public abstract class Sapfor extends OSDComponent {
public void cd(File directory_in) throws Exception {
if (RunAnalysis("SPF_ChangeDirectory", -1, directory_in.getAbsolutePath(), "") != 0)
throw new PassException("Sapfor: Не удалось перейти в папку "
+ CommonUtils.Brackets(directory_in.getAbsolutePath()) +
+ Utils_.Brackets(directory_in.getAbsolutePath()) +
"\n" + "Код возврата: " + getErrorCode());
}
public String getResult() {
@@ -257,7 +257,7 @@ public abstract class Sapfor extends OSDComponent {
}
} else if (z == 1) file_text = sub;
else if (z == 2) {
ModifiedFiles.put(CommonUtils.toW(sub), file_text);
ModifiedFiles.put(Utils_.toW(sub), file_text);
file_text = null;
}
codeIdx += count;
@@ -336,7 +336,7 @@ public abstract class Sapfor extends OSDComponent {
Utils.WriteToFile(file, OldFiles.get(name));
}
OldFiles.clear();
} else CommonUI.Info("Сохранение файлов отсутствует.");
} else UI_.Info("Сохранение файлов отсутствует.");
}
if (cuf != null)
Pass.passes.get(PassCode.OpenCurrentFile).Do(cuf);
@@ -353,20 +353,20 @@ public abstract class Sapfor extends OSDComponent {
for (PassCode code : getAnalysesCodes())
(Pass.passes.get(code)).Reset();
//------------------------------------------------------------------------------------------>>>> пакетный режим.
if (CommonUI.isActive()) {
if (UI_.isActive()) {
Pass.passes.get(PassCode.Precompilation).Reset();
Pass.passes.get(PassCode.SPF_GetGCovInfo).Reset();
}
Global.enable_text_changed = false;
Global.transformationPermission = TransformationPermission.None;
if ((CommonUI.isActive()) && (UI.HasMainWindow()) && (UI.getVersionsWindow() != null))
if ((UI_.isActive()) && (UI.HasMainWindow()) && (UI.getVersionsWindow() != null))
UI.getVersionsWindow().BlockVariants();
}
//--------------------------------------------------------------------------->>
//временный (?) проход, по тихому получить размерность теста, предварительно выполнив тихий парс.
//тут все одноразовое. считаем что таблицы бд уже заполнены как надо.
public LanguageStyle getStyle() throws Exception {
return ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
return ((GlobalDatabase) Utils_.db).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed;
}
//----------
public static Vector<PassCode> getScenariosCodes() {
@@ -411,12 +411,12 @@ public abstract class Sapfor extends OSDComponent {
//------------------------------------------------------------------------------------------------------------------
public String getConsoleFlags() throws Exception {
Vector<String> res = new Vector<>();
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.FREE_FORM).toBoolean())
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.FREE_FORM).toBoolean())
res.add("-f90");
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.STATIC_SHADOW_ANALYSIS).toBoolean())
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.STATIC_SHADOW_ANALYSIS).toBoolean())
res.add("-sh");
res.add("-shwidth " + ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.MAX_SHADOW_WIDTH));
if (((GlobalDatabase)CommonUtils.db).settings.get(SettingName.KEEP_SPF_DIRECTIVES).toBoolean())
res.add("-shwidth " + ((GlobalDatabase) Utils_.db).settings.get(SettingName.MAX_SHADOW_WIDTH));
if (((GlobalDatabase) Utils_.db).settings.get(SettingName.KEEP_SPF_DIRECTIVES).toBoolean())
res.add("-keepSPF");
return String.join(" ", res);
}
@@ -457,16 +457,16 @@ public abstract class Sapfor extends OSDComponent {
Utils.delete_with_check(outputFile);
Utils.delete_with_check(errorsFile);
//---
File file = new File(data_workspace, name + (CommonUtils.isWindows() ? ".bat" : ".sh"));
File file = new File(data_workspace, name + (Utils_.isWindows() ? ".bat" : ".sh"));
FileUtils.write(file,
CommonUtils.DQuotes(sapfor_drv)
Utils_.DQuotes(sapfor_drv)
+ (flags.isEmpty() ? "" : (" " + flags))
+ " -noLogo"
+ " " + command +
" 1>" +
CommonUtils.DQuotes(outputFile.getAbsolutePath()) +
Utils_.DQuotes(outputFile.getAbsolutePath()) +
" 2>" +
CommonUtils.DQuotes(errorsFile.getAbsolutePath()),
Utils_.DQuotes(errorsFile.getAbsolutePath()),
Charset.defaultCharset());
if (!file.setExecutable(true))
throw new Exception("Не удалось сделать файл скрипта " + name + " исполняемым!");
@@ -480,8 +480,8 @@ public abstract class Sapfor extends OSDComponent {
exit_code = process.waitFor();
flag = true;
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
CommonUtils.sleep(1000);
Utils_.MainLog.PrintException(ex);
Utils_.sleep(1000);
}
}
while (!flag);
@@ -531,7 +531,7 @@ public abstract class Sapfor extends OSDComponent {
public static File temp_copy = null;
public static File getTempCopy(File src) throws Exception {
if (temp_copy == null || !temp_copy.exists()) {
temp_copy = Utils.getTempFileName("SAPFOR" + (CommonUtils.isWindows() ? ".exe" : ""));
temp_copy = Utils.getTempFileName("SAPFOR" + (Utils_.isWindows() ? ".exe" : ""));
FileUtils.copyFile(src, temp_copy);
temp_copy.setExecutable(true);
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository.Component;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Settings.SettingName;
@@ -76,8 +76,8 @@ public class Visualiser extends Component {
System.exit(0);
}
public File getWorkspace() {
if (!((GlobalDatabase)CommonUtils.db).settings.get(SettingName.Workspace).toString().isEmpty()) {
File workspace = new File(((GlobalDatabase)CommonUtils.db).settings.get(SettingName.Workspace).toString());
if (!((GlobalDatabase) Utils_.db).settings.get(SettingName.Workspace).toString().isEmpty()) {
File workspace = new File(((GlobalDatabase) Utils_.db).settings.get(SettingName.Workspace).toString());
if (workspace.exists())
return workspace;
else

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Repository.Component;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import Common.Passes.PassException;
@@ -40,7 +40,7 @@ public class Visualizer_2 extends OSDComponent {
}
@Override
public String getHome() {
return CommonUtils.getHomePath();
return Utils_.getHomePath();
}
@Override
public void GetVersionInfo() {
@@ -48,7 +48,7 @@ public class Visualizer_2 extends OSDComponent {
Command("get_version: ");
UnpackVersionInfo(this, response);
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
public void refreshPid(){
@@ -58,7 +58,7 @@ public class Visualizer_2 extends OSDComponent {
PID = response;
// UI.Info("SERVER PID = "+Utils.Brackets(PID));
} catch (Exception e) {
CommonUtils.MainLog.PrintException(e);
Utils_.MainLog.PrintException(e);
}
}
@Override
@@ -66,7 +66,7 @@ public class Visualizer_2 extends OSDComponent {
super.Update();
SendRequest("update_server: ");
ReplaceOldFile();
CommonUI.Info("Сервер успешно обновлен.\n" +
UI_.Info("Сервер успешно обновлен.\n" +
"Визуализатор завершает работу.\n" +
"Для продолжения перезапустите визуализатор вручную.");
System.exit(0);
@@ -120,7 +120,7 @@ public class Visualizer_2 extends OSDComponent {
case "NOT_FOUND":
case "WRONG":
case "SEG_FAULT":
throw new PassException("Команда серверу SAPFOR вернула " + CommonUtils.Brackets(response));
throw new PassException("Команда серверу SAPFOR вернула " + Utils_.Brackets(response));
default:
break;
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import java.io.File;
import java.io.Serializable;
@@ -18,6 +18,6 @@ public class EmailMessage implements Serializable {
targets.addAll(targets_in);
}
public void addAttachement(File f) throws Exception {
files.put(f.getName(), CommonUtils.fileToBytes(f));
files.put(f.getName(), Utils_.fileToBytes(f));
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
import Common.Passes.PassException;
@@ -21,7 +21,7 @@ public abstract class RepositoryClient {
try {
if (isPrintOn()) {
FileWriter testLog = new FileWriter(getClass().getSimpleName() + "_Log.txt", true);
String dmessage = CommonUtils.Brackets(new Date()) + " " + message;
String dmessage = Utils_.Brackets(new Date()) + " " + message;
System.out.println(dmessage);
testLog.write(dmessage + "\n");
testLog.close();
@@ -59,7 +59,7 @@ public abstract class RepositoryClient {
return ServerCommand(code_in, "", null);
}
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
throw new PassException(CommonUtils.Brackets(new Date().toString())+" Ошибка взаимодействия с сервером " + code_in);
throw new PassException(Utils_.Brackets(new Date().toString())+" Ошибка взаимодействия с сервером " + code_in);
}
public abstract void perform() throws Exception;
public void Perform(){
@@ -68,7 +68,7 @@ public abstract class RepositoryClient {
} catch (Exception ex) {
ex.printStackTrace();
} finally {
CommonUtils.sleep(getSleepMillis());
Utils_.sleep(getSleepMillis());
}
}
}

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import Common.Database.Objects.DBObject;
import Common.Database.Database;
@@ -74,7 +74,7 @@ public abstract class RepositoryServer<D extends Database> {
if (printOn) {
try {
Log = new FileWriter("Log.txt", true);
String dmessage = CommonUtils.Brackets("SESSION -> ") + new Date() +
String dmessage = Utils_.Brackets("SESSION -> ") + new Date() +
" " + message;
Log.write(dmessage + "\n");
Log.close();
@@ -102,7 +102,7 @@ public abstract class RepositoryServer<D extends Database> {
LinkedHashMap<String, File> innerFiles = new LinkedHashMap<>();
for (String aName : message_in.files.keySet()) {
File f = Utils.getTempFileName(aName);
CommonUtils.bytesToFile(message_in.files.get(aName), f);
Utils_.bytesToFile(message_in.files.get(aName), f);
innerFiles.put(aName, f);
}
Vector<String> targets_ = new Vector<>(message_in.targets);
@@ -151,9 +151,9 @@ public abstract class RepositoryServer<D extends Database> {
Transport.send(message);
done = true;
} catch (Exception ex) {
System.out.println("Исключение во время отправки сообщения абоненту " + CommonUtils.Brackets(target));
System.out.println("Исключение во время отправки сообщения абоненту " + Utils_.Brackets(target));
ex.printStackTrace();
CommonUtils.sleep(1000);
Utils_.sleep(1000);
} finally {
attempts--;
}
@@ -210,20 +210,20 @@ public abstract class RepositoryServer<D extends Database> {
switch (code) {
//<editor-fold desc="файлы и почта">
case ReadFile:
Print("Отправить клиенту текст файла по пути " + CommonUtils.Brackets(request.arg));
Print("Отправить клиенту текст файла по пути " + Utils_.Brackets(request.arg));
response = new ServerExchangeUnit_2021(ServerCode.OK, "", Utils.ReadAllText(new File(request.arg)));
break;
case SendFile:
//нам пришел файл.
Print("Получить от клиента файл, и распаковать его по пути " + CommonUtils.Brackets(request.arg));
Print("Получить от клиента файл, и распаковать его по пути " + Utils_.Brackets(request.arg));
request.Unpack(); //распаковка идет по его аргу-пути назначения
response = new ServerExchangeUnit_2021(ServerCode.OK);
break;
case ReceiveFile:
Print("Отправить клиенту файл по пути " + CommonUtils.Brackets(request.arg));
Print("Отправить клиенту файл по пути " + Utils_.Brackets(request.arg));
response = new ServerExchangeUnit_2021(ServerCode.OK);
File file = new File(request.arg);
response.object = file.exists() ? CommonUtils.fileToBytes(file) : null;
response.object = file.exists() ? Utils_.fileToBytes(file) : null;
break;
case Email:
Print("Отправка сообщения электронной почты");

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Repository.Server;
import Common.Database.Objects.DBObject;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Utils;
import _VisualDVM.GlobalData.Account.Account;
@@ -99,9 +99,9 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
Print("Отправить клиенту архив всех архивов баг репортов");
response = new ServerExchangeUnit_2021(ServerCode.OK);
ZipFolderPass zip = new ZipFolderPass();
File archives = new File(CommonUtils.getDateName("Bugs"));
File archives = new File(Utils_.getDateName("Bugs"));
if (zip.Do("Bugs", archives.getAbsolutePath())) {
response.object = CommonUtils.fileToBytes(archives);
response.object = Utils_.fileToBytes(archives);
Print("Архив успешно запакован");
} else throw new RepositoryRefuseException("Не удалось запаковать архивы");
break;
@@ -135,24 +135,24 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
case ReceiveBugReportsDatabase:
Print("Получить базу данных баг репортов");
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = CommonUtils.fileToBytes(db.getFile());
response.object = Utils_.fileToBytes(db.getFile());
break;
case ReceiveBugReport:
Print("Скачать баг репорт по ключу " + request.arg);
File bugArchive = Paths.get(CommonUtils.getHomePath(), "Bugs", request.arg).toFile();
File bugArchive = Paths.get(Utils_.getHomePath(), "Bugs", request.arg).toFile();
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = CommonUtils.fileToBytes(bugArchive);
response.object = Utils_.fileToBytes(bugArchive);
break;
case SendBugReport:
Print("Отправить баг репорт " + request.arg);
File bugArchive1 = Paths.get(CommonUtils.getHomePath(), "Bugs", request.arg).toFile();
CommonUtils.bytesToFile((byte[]) request.object, bugArchive1);
File bugArchive1 = Paths.get(Utils_.getHomePath(), "Bugs", request.arg).toFile();
Utils_.bytesToFile((byte[]) request.object, bugArchive1);
response = new ServerExchangeUnit_2021(ServerCode.OK);
break;
//</editor-fold>
case GetComponentsBackups:
Print("Получить список сохраненных версий компонента " + request.arg);
File backupsDirectory = Paths.get(CommonUtils.getHomePath(), "Components", request.arg, "Backups").toFile();
File backupsDirectory = Paths.get(Utils_.getHomePath(), "Components", request.arg, "Backups").toFile();
//--
if (backupsDirectory.exists()) {
File[] files = backupsDirectory.listFiles(File::isFile);
@@ -182,9 +182,9 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
3
);
Print("Опубликовать компонент " + sComponentType);
File componentFile = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType, componentFileName).toFile();
File versionFile = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType, "version.txt").toFile();
File backupsFolder = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType, "Backups").toFile();
File componentFile = Paths.get(Utils_.getHomePath(), "Components", sComponentType, componentFileName).toFile();
File versionFile = Paths.get(Utils_.getHomePath(), "Components", sComponentType, "version.txt").toFile();
File backupsFolder = Paths.get(Utils_.getHomePath(), "Components", sComponentType, "Backups").toFile();
//0 архивация старой версии, если она есть.
if (componentFile.exists()) {
String versionText = "";
@@ -200,11 +200,11 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
FileUtils.moveFile(componentFile, backupFile);
}
//1 распаковка компонента
CommonUtils.bytesToFile((byte[]) request.object, componentFile);
Utils_.bytesToFile((byte[]) request.object, componentFile);
//2 запись версии компонента
FileUtils.writeStringToFile(versionFile, sComponentVersion);
//3 запись в журнал компонента
File changesLog = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType, "changes.txt").toFile();
File changesLog = Paths.get(Utils_.getHomePath(), "Components", sComponentType, "changes.txt").toFile();
FileWriter writer = new FileWriter(changesLog.getAbsolutePath(), true);
BufferedWriter bufferWriter = new BufferedWriter(writer);
bufferWriter.write(componentChangeRecord);
@@ -217,11 +217,11 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
String sComponentType_ = packed_[0];
String sComponentMinimalVersion = packed_[1];
Print("Поднять минимальную версию компонента " + sComponentType_);
File minimal_versionFile = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType_, "minimal_version.txt").toFile();
File minimal_versionFile = Paths.get(Utils_.getHomePath(), "Components", sComponentType_, "minimal_version.txt").toFile();
FileUtils.writeStringToFile(minimal_versionFile, sComponentMinimalVersion);
//-
//3 запись в журнал компонента
File changesLog_ = Paths.get(CommonUtils.getHomePath(), "Components", sComponentType_, "changes.txt").toFile();
File changesLog_ = Paths.get(Utils_.getHomePath(), "Components", sComponentType_, "changes.txt").toFile();
FileWriter writer_ = new FileWriter(changesLog_.getAbsolutePath(), true);
BufferedWriter bufferWriter_ = new BufferedWriter(writer_);
bufferWriter_.write("Минимальная версия поднята до " + sComponentMinimalVersion + "\n");
@@ -233,10 +233,10 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
case ReceiveComponent:
String[] packed1 = request.arg.split("\n");
//тип/имя файла
File componentFile1 = Paths.get(CommonUtils.getHomePath(), "Components", packed1[0], packed1[1]).toFile();
File componentFile1 = Paths.get(Utils_.getHomePath(), "Components", packed1[0], packed1[1]).toFile();
Print("Получить компонент " + packed1[0]);
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = CommonUtils.fileToBytes(componentFile1);
response.object = Utils_.fileToBytes(componentFile1);
break;
default:
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
@@ -246,8 +246,8 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
LinkedHashMap<ComponentType, String> response_actual_versions_ = new LinkedHashMap<>();
for (String sType : types) {
ComponentType componentType = ComponentType.valueOf(sType);
File vFile = Paths.get(CommonUtils.getHomePath(), "Components", sType, "version.txt").toFile();
String v_string = CommonUtils.removeCharacters(
File vFile = Paths.get(Utils_.getHomePath(), "Components", sType, "version.txt").toFile();
String v_string = Utils_.removeCharacters(
Utils.ReadAllText(vFile),
"\n", "\r"
);
@@ -262,8 +262,8 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
LinkedHashMap<ComponentType, String> response_minimal_versions_ = new LinkedHashMap<>();
for (String sType : types_) {
ComponentType componentType = ComponentType.valueOf(sType);
File vFile = Paths.get(CommonUtils.getHomePath(), "Components", sType, "minimal_version.txt").toFile();
String mv_string = CommonUtils.removeCharacters(
File vFile = Paths.get(Utils_.getHomePath(), "Components", sType, "minimal_version.txt").toFile();
String mv_string = Utils_.removeCharacters(
Utils.ReadAllText(vFile),
"\n", "\r"
);
@@ -275,7 +275,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
case GetComponentChangesLog:
Print("Получить журнал изменений компонента " + request.arg);
response = new ServerExchangeUnit_2021(ServerCode.OK);
response.object = CommonUtils.fileToBytes(Paths.get(CommonUtils.getHomePath(), "Components", request.arg, "changes.txt").toFile());
response.object = Utils_.fileToBytes(Paths.get(Utils_.getHomePath(), "Components", request.arg, "changes.txt").toFile());
break;
case CheckURLRegistered:
Print("Проверить учетную запись на машине");
@@ -308,17 +308,17 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
File program = Paths.get(project.getAbsolutePath(), fileName).toFile();
//--
File convertedProgram = Paths.get(program.getParent(),
CommonUtils.getFileNameWithoutExtension(program) + ".DVMH." +
Utils_.getFileNameWithoutExtension(program) + ".DVMH." +
(projectLanguage.equals(LanguageName.fortran) ? "f" : "c")
).toFile();
String command =
CommonUtils.DQuotes(server_dvm_drv) + " " +
Utils_.DQuotes(server_dvm_drv) + " " +
projectLanguage.getDVMCompile() + "dv " +
options + " "
+ CommonUtils.DQuotes(program.getName());
+ Utils_.DQuotes(program.getName());
//--
File fileWorkspace = program.getParentFile();
Process process = Utils.startScript(workspace, fileWorkspace, CommonUtils.getDateName("convert_script"), command);
Process process = Utils.startScript(workspace, fileWorkspace, Utils_.getDateName("convert_script"), command);
process.waitFor();
String convertationOut = Utils.readAllOutput(process);
convertationOut = convertationOut.replace(program.getName(), fileName); //для учета пути.
@@ -337,7 +337,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
response.arg = String.join("\n", badFiles) + "|" + output;
File resultArchive = new File(workspace, projectName + "_result.zip");
if (ComponentsServer.zip.Do(project.getAbsolutePath(), resultArchive.getAbsolutePath())) {
response.object = CommonUtils.fileToBytes(resultArchive);
response.object = Utils_.fileToBytes(resultArchive);
} else
throw new RepositoryRefuseException("Внутренняя ошибка. Не удалось запаковать версию");
//--
@@ -417,7 +417,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
//-------------------------------------
Thread.sleep(60000);
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
}
});

View File

@@ -1,5 +1,5 @@
package _VisualDVM.Repository.Server;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import java.io.File;
import java.io.Serializable;
@@ -29,13 +29,13 @@ public class ServerExchangeUnit_2021 implements Serializable {
}
//--------
public void Unpack() throws Exception {
CommonUtils.bytesToFile((byte[]) object, new File(arg));
Utils_.bytesToFile((byte[]) object, new File(arg));
}
public void Unpack(File file) throws Exception {
CommonUtils.bytesToFile((byte[]) object, file);
Utils_.bytesToFile((byte[]) object, file);
}
public void Print() {
System.out.println("codeName=" + CommonUtils.Brackets(codeName));
System.out.println("codeName=" + Utils_.Brackets(codeName));
System.out.println(arg);
}
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.Repository.Subscribes.UI;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Global;
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.GlobalData.Account.AccountRole;
@@ -21,11 +21,11 @@ public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields>
public void validateFields() {
if (fields.tfName.getText().isEmpty())
Log.Writeln("Имя учётной записи не может быть пустым");
CommonUtils.validateEmail(fields.tfAddress.getText(), Log);
Utils_.validateEmail(fields.tfAddress.getText(), Log);
if (fields.tfAddress.getText().isEmpty())
Log.Writeln_("Адрес электронной почты не может быть пустым");
if (!title_text.equals("Регистрация") && (fields.tfAddress.isEditable() && Global.componentsServer.db.subscribers.Data.containsKey(fields.tfAddress.getText()))) {
Log.Writeln_("Адрес электронной почты " + CommonUtils.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
Log.Writeln_("Адрес электронной почты " + Utils_.Brackets(fields.tfAddress.getText()) + " уже есть в списке.");
}
}
@Override
@@ -33,7 +33,7 @@ public class SubscriberForm extends DBObjectDialog<Subscriber, SubscriberFields>
fields.tfName.setText(Result.name);
fields.tfAddress.setText(Result.address);
fields.cbMail.setSelected(Result.mailOn!=0);
CommonUI.TrySelect(fields.cbRole, Result.role);
UI_.TrySelect(fields.cbRole, Result.role);
}
@Override
public void SetEditLimits() {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ServerObjectsCache;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.TestingSystem.Common.Configuration.Configuration;
import _VisualDVM.TestingSystem.Common.Group.Group;
@@ -24,21 +24,21 @@ public class ConfigurationCache extends VisualCache {
if (configuration.packedGroupsJson.isEmpty()) {
groupsJson = new GroupsJson(); //просто пустой
} else {
groupsJson = CommonUtils.gson.fromJson(configuration.packedGroupsJson, GroupsJson.class);
groupsJson = Utils_.gson.fromJson(configuration.packedGroupsJson, GroupsJson.class);
}
//--
if (testsJson == null) {
if (configuration.packedTestsJson.isEmpty())
testsJson = new TestsJson(); //просто пустой
else
testsJson = CommonUtils.gson.fromJson(configuration.packedTestsJson, TestsJson.class);
testsJson = Utils_.gson.fromJson(configuration.packedTestsJson, TestsJson.class);
}
//-
if (settingsJson == null) {
if (configuration.packedSettingsJson.isEmpty())
settingsJson = new SettingsArrayJson(); //просто пустой
else
settingsJson = CommonUtils.gson.fromJson(configuration.packedSettingsJson, SettingsArrayJson.class);
settingsJson = Utils_.gson.fromJson(configuration.packedSettingsJson, SettingsArrayJson.class);
}
//-
LinkedHashMap<String, Vector<String>> gmap = new LinkedHashMap<>();

View File

@@ -1,5 +1,5 @@
package _VisualDVM.ServerObjectsCache;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.TestingSystem.Common.Configuration.Json.ConfigurationJson;
import _VisualDVM.TestingSystem.Common.Configuration.Json.ConfigurationsJson;
import _VisualDVM.TestingSystem.Common.TestingPackage.TestingPackage;
@@ -12,7 +12,7 @@ public class PackageCache extends VisualCache{
if (testingPackage.packedConfigurationsJson.isEmpty())
configurationsJson = new ConfigurationsJson(); //просто пустой
else
configurationsJson = CommonUtils.gson.fromJson(testingPackage.packedConfigurationsJson, ConfigurationsJson.class);
configurationsJson = Utils_.gson.fromJson(testingPackage.packedConfigurationsJson, ConfigurationsJson.class);
//---
configurationsDescriptions=new Vector<>();
for(ConfigurationJson configurationJson: configurationsJson.array)

View File

@@ -1,7 +1,7 @@
package _VisualDVM.TestingSystem.Common.Configuration;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.riDBObject;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import Common.Utils.TextLog;
import _VisualDVM.TestingSystem.Common.Group.Group;
import _VisualDVM.TestingSystem.Common.Group.Json.GroupsJson;
@@ -33,7 +33,7 @@ public class Configuration extends riDBObject {
autoTesting = (autoTesting == 0) ? 1 : 0;
}
public ImageIcon GetAutoIcon() {
return CommonUtils.getIcon("/Common/icons/" + (autoTesting == 1 ? "RedPick" : "NotPick") + ".png");
return Utils_.getIcon("/Common/icons/" + (autoTesting == 1 ? "RedPick" : "NotPick") + ".png");
}
//--
@Description("DEFAULT ''")
@@ -44,13 +44,13 @@ public class Configuration extends riDBObject {
public String packedSettingsJson = "";
//--
public void saveGroupsAsJson(Vector<Group> groups) {
packedGroupsJson = CommonUtils.gson.toJson(new GroupsJson(groups));
packedGroupsJson = Utils_.gson.toJson(new GroupsJson(groups));
}
public void saveTestsAsJson(Vector<Test> tests) {
packedTestsJson = CommonUtils.gson.toJson(new TestsJson(tests));
packedTestsJson = Utils_.gson.toJson(new TestsJson(tests));
}
public void saveSettingsAsJson(Vector<Settings> settings) {
packedSettingsJson = CommonUtils.gson.toJson(new SettingsArrayJson(settings));
packedSettingsJson = Utils_.gson.toJson(new SettingsArrayJson(settings));
}
//--
@Override

View File

@@ -1,6 +1,6 @@
package _VisualDVM.TestingSystem.Common.Group;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.riDBObject;
@@ -46,7 +46,7 @@ public class Group extends riDBObject {
@Override
public void select(boolean flag) {
super.select(flag);
if (CommonUI.isActive())
if (UI_.isActive())
UI.getMainWindow().ShowCheckedTestsCount();
}
//--
@@ -67,7 +67,7 @@ public class Group extends riDBObject {
int i = 1;
for (ProjectFile program : programs.get(language)) {
//--
String object = CommonUtils.DQuotes(language + "_" + i + ".o");
String object = Utils_.DQuotes(language + "_" + i + ".o");
module_objects.add(object);
module_body +=
object + ":\n" +
@@ -84,7 +84,7 @@ public class Group extends riDBObject {
++i;
}
titles.add(String.join("\n",
LANG_ + "COMMAND=" + CommonUtils.DQuotes(dvm_drv) + " " +
LANG_ + "COMMAND=" + Utils_.DQuotes(dvm_drv) + " " +
language.getDVMCompile(),
LANG_ + "FLAGS=" + flags_in,
LANG_ + "OBJECTS=" + String.join(" ", module_objects),
@@ -100,12 +100,12 @@ public class Group extends riDBObject {
Vector<String> titles = new Vector<>();
Vector<String> objects = new Vector<>();
Vector<String> bodies = new Vector<>();
String binary = CommonUtils.DQuotes("0");
String binary = Utils_.DQuotes("0");
//----->>
generateForLanguage(dvm_drv, programs, language, titles, objects, bodies, flags_in);
//----->>
return String.join("\n",
"LINK_COMMAND=" + CommonUtils.DQuotes(dvm_drv) + " " +
"LINK_COMMAND=" + Utils_.DQuotes(dvm_drv) + " " +
language.getDVMLink(),
"LINK_FLAGS=" + flags_in + "\n",
String.join("\n", titles),

View File

@@ -1,5 +1,5 @@
package _VisualDVM.TestingSystem.Common.Group;
import Common.Visual.CommonUI;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Visual.DataSetControlForm;
import Common.Visual.Windows.Dialog.DBObjectDialog;
@@ -120,8 +120,8 @@ public class GroupsDBTable extends iDBTable<Group> {
@Override
public void fillFields() {
fields.tfName.setText(Result.description);
CommonUI.TrySelect(fields.cbType, Result.type);
CommonUI.TrySelect(fields.cbLanguage, Result.language);
UI_.TrySelect(fields.cbType, Result.type);
UI_.TrySelect(fields.cbLanguage, Result.language);
}
@Override
public void ProcessResult() {

View File

@@ -1,5 +1,5 @@
package _VisualDVM.TestingSystem.Common.Group;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import Common.Visual.Menus.DataMenuBar;
import Common.Visual.Controls.MenuBarButton;
@@ -29,7 +29,7 @@ public class GroupsMenuBar extends DataMenuBar {
});
}
public void Mark() {
setIcon(CommonUtils.getIcon(GroupsDBTable.filterMyOnly ? "/icons/Pick.png" : "/icons/NotPick.png"));
setIcon(Utils_.getIcon(GroupsDBTable.filterMyOnly ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
});
}

View File

@@ -2,7 +2,7 @@ package _VisualDVM.TestingSystem.Common.MachineProcess;
import Common.CommonConstants;
import Common.Database.Objects.DBObject;
import Common.Mode;
import Common.Utils.CommonUtils;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.GlobalProperties;
import _VisualDVM.Utils;
@@ -33,9 +33,9 @@ public class MachineProcess extends DBObject {
userName = p.user_name;
userPassword = p.user_password;
userWorkspace = p.user_workspace;
testingSystemRoot =CommonUtils.getHomePath();
testingSystemRoot = Utils_.getHomePath();
serverName = Global.testingServer.name;
id = CommonUtils.getDateName(machineAddress + "_" + machinePort + "_" + userName);
id = Utils_.getDateName(machineAddress + "_" + machinePort + "_" + userName);
}
@Override
public Object getPK() {
@@ -86,7 +86,7 @@ public class MachineProcess extends DBObject {
InetAddress localAddress = InetAddress.getByName(Global.properties.ServerAddress);
local = localAddress.getHostAddress().equals(address.getHostAddress());
} catch (Exception ex) {
CommonUtils.MainLog.PrintException(ex);
Utils_.MainLog.PrintException(ex);
}
return local;
}
@@ -96,21 +96,21 @@ public class MachineProcess extends DBObject {
File workspace = getWorkspace();
Utils.CheckAndCleanDirectory(workspace);
//копирование визуализатора
File src = new File(CommonUtils.getHomeDirectory(), "TestingSystem.jar");
File src = new File(Utils_.getHomeDirectory(), "TestingSystem.jar");
File supervisor = new File(workspace, "VisualSapfor.jar");
FileUtils.copyFile(src, supervisor);
//создание настроек
GlobalProperties properties = new GlobalProperties(Global.properties);
properties.Mode = Mode.MachineQueue;
CommonUtils.jsonToFile(properties, new File(workspace, "properties"));
Utils_.jsonToFile(properties, new File(workspace, "properties"));
Vector<String> args = new Vector<>();
args.add(CommonUtils.DQuotes(machineAddress));
args.add(CommonUtils.DQuotes(machinePort));
args.add(CommonUtils.DQuotes(userName));
args.add(CommonUtils.DQuotes(userPassword));
args.add(CommonUtils.DQuotes(userWorkspace));
args.add(CommonUtils.DQuotes(testingSystemRoot));
args.add(CommonUtils.DQuotes(Global.testingServer.name));
args.add(Utils_.DQuotes(machineAddress));
args.add(Utils_.DQuotes(machinePort));
args.add(Utils_.DQuotes(userName));
args.add(Utils_.DQuotes(userPassword));
args.add(Utils_.DQuotes(userWorkspace));
args.add(Utils_.DQuotes(testingSystemRoot));
args.add(Utils_.DQuotes(Global.testingServer.name));
//--
Utils.startScript(workspace, workspace,
"start",

View File

@@ -1,7 +1,7 @@
package _VisualDVM.TestingSystem.Common.Test;
import Common.CommonConstants;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Current;
import Common.Database.Objects.DBObject;
import Common.Database.Objects.riDBObject;
@@ -54,7 +54,7 @@ public class Test extends riDBObject {
@Override
public void select(boolean flag) {
super.select(flag);
if (CommonUI.isActive())
if (UI_.isActive())
UI.getMainWindow().ShowCheckedTestsCount();
}
//---
@@ -95,7 +95,7 @@ public class Test extends riDBObject {
if (testArchive.exists())
FileUtils.forceDelete(testArchive);
//--
CommonUtils.bytesToFile(project_archive_bytes, tmpArchive); // распаковка байтов.
Utils_.bytesToFile(project_archive_bytes, tmpArchive); // распаковка байтов.
//--
UnzipFolderPass unzipFolderPass = new UnzipFolderPass();
if (!unzipFolderPass.Do(

View File

@@ -1,6 +1,6 @@
package _VisualDVM.TestingSystem.Common;
import Common.Utils.CommonUtils;
import Common.Visual.CommonUI;
import Common.Utils.Utils_;
import Common.Visual.UI_;
import _VisualDVM.Global;
import Common.Visual.Controls.MenuBarButton;
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
@@ -45,7 +45,7 @@ public class TestingBar extends VisualiserMenuBar {
});
}
public void Mark() {
setIcon(CommonUtils.getIcon(Global.properties.EmailOnTestingProgress ? "/icons/Pick.png" : "/icons/NotPick.png"));
setIcon(Utils_.getIcon(Global.properties.EmailOnTestingProgress ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
});
//--
@@ -66,7 +66,7 @@ public class TestingBar extends VisualiserMenuBar {
});
}
public void Mark() {
setIcon(CommonUtils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
setIcon(Utils_.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
});
//--
@@ -75,13 +75,13 @@ public class TestingBar extends VisualiserMenuBar {
sCheckTime.setMaximumSize(new Dimension(60, 26));
sCheckTime.setModel(new SpinnerNumberModel(Global.properties.CheckTestingIntervalSeconds, 10, 3600, 1));
sCheckTime.setValue(Global.properties.CheckTestingIntervalSeconds);
CommonUI.MakeSpinnerRapid(sCheckTime, e -> {
UI_.MakeSpinnerRapid(sCheckTime, e -> {
Global.properties.updateField("CheckTestingIntervalSeconds", sCheckTime.getValue());
if (Global.properties.AutoCheckTesting) TestingServer.ResetTimer();
});
add(new JLabel(" сек ") {
{
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
setFont(UI_.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
}
});
addSeparator();
@@ -89,7 +89,7 @@ public class TestingBar extends VisualiserMenuBar {
addPasses(PassCode.StartTestingServer, PassCode.ShutdownTestingServer, PassCode.PublishTestingServer);
}
public void ShowAutoCheckTesting() {
autorefreshButton.setIcon(CommonUtils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
autorefreshButton.setIcon(Utils_.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
public void showServerAdminLabel(boolean flag) {
serverAdminLabel.setVisible(flag);

Some files were not shown because too many files have changed in this diff Show More