2024-10-14 12:14:01 +03:00
|
|
|
|
package _VisualDVM.Passes.All;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import Common.Passes.Pass;
|
|
|
|
|
|
import Common.Passes.PassException;
|
2024-10-11 00:00:30 +03:00
|
|
|
|
import Common.Utils.Utils_;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import _VisualDVM.Global;
|
2024-10-14 12:14:01 +03:00
|
|
|
|
import _VisualDVM.Passes.PassCode;
|
2024-10-14 15:19:13 +03:00
|
|
|
|
import _VisualDVM.Repository.Component.Component;
|
2024-10-09 23:37:58 +03:00
|
|
|
|
public class UpdateComponent extends Pass<Component> {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
@Override
|
2024-10-09 23:37:58 +03:00
|
|
|
|
protected PassCode necessary() {
|
|
|
|
|
|
return PassCode.CreateComponentBackUp;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean resetsNecessary() {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void body() throws Exception {
|
2024-10-10 14:29:54 +03:00
|
|
|
|
PassCode subPassCode = null;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
//<editor-fold desc="получение нового файла компонента">
|
2024-10-13 22:08:13 +03:00
|
|
|
|
switch (Global.mainModule.getComponent().getComponentType()) {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
case Sapfor_F:
|
|
|
|
|
|
case Visualizer_2:
|
2024-10-11 00:00:30 +03:00
|
|
|
|
subPassCode = Utils_.isWindows() ? PassCode.DownloadComponent : PassCode.BuildComponent;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
break;
|
|
|
|
|
|
case Visualiser:
|
|
|
|
|
|
case Instruction:
|
|
|
|
|
|
case PerformanceAnalyzer:
|
2024-10-10 14:29:54 +03:00
|
|
|
|
subPassCode = PassCode.DownloadComponent;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2024-10-13 23:55:03 +03:00
|
|
|
|
if ((subPassCode != null) && Global.mainModule.getPass(subPassCode).Do()) {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
//</editor-fold>
|
2024-10-13 22:08:13 +03:00
|
|
|
|
if (!Global.mainModule.getComponent().getNewFile().exists())
|
|
|
|
|
|
throw new PassException("Не удалось получить новый файл для компонента " + Global.mainModule.getComponent().getComponentType().getDescription());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
//непосредственное обновление.
|
2024-10-13 22:08:13 +03:00
|
|
|
|
Global.mainModule.getComponent().Update();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performFinish() throws Exception {
|
2024-10-13 22:08:13 +03:00
|
|
|
|
Global.mainModule.getComponent().CheckIfNeedsUpdateOrPublish();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void showDone() throws Exception {
|
2024-10-22 20:16:57 +03:00
|
|
|
|
Global.components.RefreshUpdatesStatus();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|