Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/UpdateComponent.java
2023-11-19 02:12:44 +03:00

49 lines
1.9 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 Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.Global;
import Repository.Component.Component;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.PassException;
import Visual_DVM_2021.Passes.Pass_2021;
public class UpdateComponent extends Pass_2021<Component> {
@Override
protected PassCode_2021 necessary() {
return PassCode_2021.CreateComponentBackUp;
}
@Override
protected boolean resetsNecessary() {
return true;
}
@Override
protected void body() throws Exception {
PassCode_2021 subPass = PassCode_2021.Undefined;
//<editor-fold desc="получение нового файла компонента">
switch (Current.getComponent().getComponentType()) {
case Sapfor_F:
case Visualizer_2:
subPass = Global.isWindows ? PassCode_2021.DownloadComponent : PassCode_2021.BuildComponent;
break;
case Visualiser:
case Instruction:
case PerformanceAnalyzer:
subPass = PassCode_2021.DownloadComponent;
break;
}
if ((subPass != PassCode_2021.Undefined) && passes.get(subPass).Do()) {
//</editor-fold>
if (!Current.getComponent().getNewFile().exists())
throw new PassException("Не удалось получить новый файл для компонента " + Current.getComponent().getComponentType().getDescription());
//непосредственное обновление.
Current.getComponent().Update();
}
}
@Override
protected void performFinish() throws Exception {
Current.getComponent().CheckIfNeedsUpdateOrPublish();
}
@Override
protected void showDone() throws Exception {
Global.RefreshUpdatesStatus();
}
}