2024-10-14 12:14:01 +03:00
|
|
|
package _VisualDVM.Passes.All;
|
2024-10-14 15:19:13 +03:00
|
|
|
import Common.Visual.Controls.PassButton;
|
2024-10-13 22:08:13 +03:00
|
|
|
import _VisualDVM.Global;
|
2025-02-04 16:36:33 +03:00
|
|
|
import _VisualDVM.Passes.Server.TestingServerPass;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
2024-10-14 15:19:13 +03:00
|
|
|
import _VisualDVM.Utils;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
2023-12-21 17:42:20 +03:00
|
|
|
import javax.swing.*;
|
2023-09-17 22:13:42 +03:00
|
|
|
import java.io.File;
|
2025-02-04 16:36:33 +03:00
|
|
|
public class SynchronizeTests extends TestingServerPass<Object> {
|
2023-09-17 22:13:42 +03:00
|
|
|
File new_db_file;
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2025-02-04 16:06:49 +03:00
|
|
|
return Global.mainModule.getAccount().CheckRegistered(Log)&&SendRequest(ServerCode.ReceiveTestsDatabase);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
return "/icons/ComponentsActual.png";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2023-12-21 17:42:20 +03:00
|
|
|
public JButton createButton() {
|
|
|
|
|
return new PassButton(this);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2023-09-17 22:13:42 +03:00
|
|
|
protected void showPreparation() throws Exception {
|
2025-02-04 16:06:49 +03:00
|
|
|
getServer().db.DropUI();
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
2025-02-04 16:06:49 +03:00
|
|
|
protected void body() throws Exception {
|
|
|
|
|
request.server_response.Unpack(new_db_file = Utils.getTempFileName("tdb"));
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
super.performDone();
|
2025-02-04 16:06:49 +03:00
|
|
|
getServer().db.ReplaceFileAndReconnect(new_db_file);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void showDone() throws Exception {
|
2024-10-15 02:32:52 +03:00
|
|
|
if (Global.mainModule.getUI().hasMainWindow()) {
|
2025-02-04 16:06:49 +03:00
|
|
|
getServer().db.ResetUI();
|
2024-10-15 02:32:52 +03:00
|
|
|
Global.mainModule.getUI().getMainWindow().ShowCheckedTestsCount();
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|