Files
VisualSapfor/src/_VisualDVM/Passes/All/ShowCompilerVersion.java

69 lines
2.3 KiB
Java
Raw Normal View History

2024-10-14 12:14:01 +03:00
package _VisualDVM.Passes.All;
import Common.MainModule_;
2024-10-14 15:19:13 +03:00
import Common.Passes.Pass;
2024-10-12 00:17:51 +03:00
import _VisualDVM.Global;
2024-10-09 22:21:57 +03:00
import _VisualDVM.GlobalData.Compiler.Compiler;
import _VisualDVM.GlobalData.Machine.Machine;
2024-10-09 22:21:57 +03:00
import _VisualDVM.GlobalData.Machine.MachineType;
2024-10-14 12:14:01 +03:00
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Visual.Windows.ReadOnlyMultilineTextForm;
2024-10-09 23:37:58 +03:00
public class ShowCompilerVersion extends Pass<String> {
Pass<String> subpass;
2023-09-17 22:13:42 +03:00
boolean needsShow = true;
Compiler compiler;
//-
@Override
public String getIconPath() {
return "/icons/versions/Version.png";
}
@Override
public String getButtonText() {
return "";
}
@Override
protected boolean canStart(Object... args) throws Exception {
target = null;
if (args.length == 0) {
if (MainModule_.instance.getDb().getTable(Compiler.class).getUI().Check(Log)) {
compiler = MainModule_.instance.getDb().getTable(Compiler.class).getUI().getCurrent();
2023-09-17 22:13:42 +03:00
needsShow = true;
return true;
}
} else if (args.length == 2) {
compiler = (Compiler) args[0];
needsShow = (boolean) args[1];
return true;
}
return false;
}
@Override
protected void body() throws Exception {
subpass = null;
compiler.ResetVersion();
if (MainModule_.instance.getDb().getTable(Machine.class).getUI().getCurrent().type.equals(MachineType.Local)) {
2024-10-14 15:19:13 +03:00
subpass = Global.mainModule.getPass(PassCode.LocalSingleCommand);
2023-09-17 22:13:42 +03:00
} else {
2024-10-14 15:19:13 +03:00
subpass = Global.mainModule.getPass(PassCode.RemoteSingleCommand);
2023-09-17 22:13:42 +03:00
}
if (subpass != null) {
if (compiler.versionLoaded = subpass.Do(compiler.getVersionCommand())) {
target = subpass.target;
compiler.versionText = target;
compiler.ParseVersion();
}
}
}
@Override
protected boolean validate() {
return (subpass != null) && (target != null);
}
@Override
protected void showDone() throws Exception {
if (needsShow) {
(Global.mainModule.getDb()).compilers.RefreshUI();
2023-09-17 22:13:42 +03:00
ReadOnlyMultilineTextForm ff = new ReadOnlyMultilineTextForm();
ff.ShowDialog("Версия", target);
}
}
}