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

70 lines
2.2 KiB
Java
Raw Normal View History

package Visual_DVM_2021.Passes.All;
2024-10-09 23:37:58 +03:00
import Common.Current_;
import Common.Utils.CommonUtils;
2024-10-09 22:01:19 +03:00
import _VisualDVM.Current;
2024-10-08 22:33:49 +03:00
import Common.Visual.Windows.Dialog.Text.ReadOnlyMultilineTextForm;
2024-10-09 22:21:57 +03:00
import _VisualDVM.GlobalData.Compiler.Compiler;
import _VisualDVM.GlobalData.GlobalDatabase;
import _VisualDVM.GlobalData.Machine.MachineType;
2024-10-09 23:37:58 +03:00
import Visual_DVM_2021.Passes.PassCode;
import Visual_DVM_2021.Passes.Pass;
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) {
2024-10-09 23:37:58 +03:00
if (Current_.Check(Log, Current.Compiler)) {
2023-09-17 22:13:42 +03:00
compiler = Current.getCompiler();
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 (Current.getMachine().type.equals(MachineType.Local)) {
2024-10-09 23:37:58 +03:00
subpass = passes.get(PassCode.LocalSingleCommand);
2023-09-17 22:13:42 +03:00
} else {
2024-10-09 23:37:58 +03:00
subpass = passes.get(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) {
((GlobalDatabase)CommonUtils.db).compilers.RefreshUI();
2023-09-17 22:13:42 +03:00
ReadOnlyMultilineTextForm ff = new ReadOnlyMultilineTextForm();
ff.ShowDialog("Версия", target);
}
}
}