45 lines
1.4 KiB
Java
45 lines
1.4 KiB
Java
package _VisualDVM.Passes.All;
|
|
import Common.Visual.Controls.PassButton;
|
|
import _VisualDVM.Global;
|
|
import _VisualDVM.Passes.Server.TestingServerPass;
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
|
import _VisualDVM.Utils;
|
|
|
|
import javax.swing.*;
|
|
import java.io.File;
|
|
public class SynchronizeTests extends TestingServerPass<Object> {
|
|
File new_db_file;
|
|
@Override
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
return Global.mainModule.getAccount().CheckRegistered(Log)&&SendRequest(ServerCode.ReceiveTestsDatabase);
|
|
}
|
|
@Override
|
|
public String getIconPath() {
|
|
return "/icons/ComponentsActual.png";
|
|
}
|
|
@Override
|
|
public JButton createButton() {
|
|
return new PassButton(this);
|
|
}
|
|
@Override
|
|
protected void showPreparation() throws Exception {
|
|
getServer().db.DropUI();
|
|
}
|
|
@Override
|
|
protected void body() throws Exception {
|
|
request.server_response.Unpack(new_db_file = Utils.getTempFileName("tdb"));
|
|
}
|
|
@Override
|
|
protected void performDone() throws Exception {
|
|
super.performDone();
|
|
getServer().db.ReplaceFileAndReconnect(new_db_file);
|
|
}
|
|
@Override
|
|
protected void showDone() throws Exception {
|
|
if (Global.mainModule.getUI().hasMainWindow()) {
|
|
getServer().db.ResetUI();
|
|
Global.mainModule.getUI().getMainWindow().ShowCheckedTestsCount();
|
|
}
|
|
}
|
|
}
|