Files
VisualSapfor/src/_VisualDVM/Passes/All/UpdateComponent.java
2025-02-18 16:21:20 +03:00

50 lines
1.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package _VisualDVM.Passes.All;
import Common.Passes.Pass;
import Common.Passes.PassException;
import Common.Utils.Utils_;
import _VisualDVM.ComponentsServer.Component.Component;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
public class UpdateComponent extends Pass<Component> {
@Override
protected PassCode necessary() {
return PassCode.CreateComponentBackUp;
}
@Override
protected boolean resetsNecessary() {
return true;
}
@Override
protected void body() throws Exception {
target = Global.components.getUI().getCurrent();
PassCode subPassCode = null;
//<editor-fold desc="получение нового файла компонента">
switch (target.getComponentType()) {
case Sapfor_F:
case Visualizer_2:
subPassCode = Utils_.isWindows() ? PassCode.DownloadComponent : PassCode.BuildComponent;
break;
case Visualiser:
case Instruction:
case PerformanceAnalyzer:
subPassCode = PassCode.DownloadComponent;
break;
}
if ((subPassCode != null) && Global.mainModule.getPass(subPassCode).Do()) {
//</editor-fold>
if (!target.getNewFile().exists())
throw new PassException("Не удалось получить новый файл для компонента " + target.getComponentType().getDescription());
//непосредственное обновление.
target.Update();
}
}
@Override
protected void performFinish() throws Exception {
target.CheckIfNeedsUpdateOrPublish();
}
@Override
protected void showDone() throws Exception {
Global.components.refreshUpdatesStatus();
}
}