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

@@ -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;
}