2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-09 23:37:58 +03:00
|
|
|
import Common.Current_;
|
2024-10-07 14:22:52 +03:00
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Current;
|
2024-10-08 22:33:49 +03:00
|
|
|
import Common.Visual.Windows.Dialog.Text.ReadOnlyMultilineTextForm;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Utils;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.Repository.Component.Component;
|
|
|
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
|
|
|
|
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
2023-11-19 02:12:44 +03:00
|
|
|
import Visual_DVM_2021.Passes.Server.ComponentsRepositoryPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
public class ShowComponentChangesLog extends ComponentsRepositoryPass<Component> {
|
|
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
return "/icons/Log.png";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
File res;
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2024-10-09 23:37:58 +03:00
|
|
|
if (Current_.Check(Log, Current.Component)) {
|
2023-09-17 22:13:42 +03:00
|
|
|
target = Current.getComponent();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void performPreparation() throws Exception {
|
|
|
|
|
res = Utils.getTempFileName("component_changes");
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
Command(new ServerExchangeUnit_2021(ServerCode.GetComponentChangesLog, target.getComponentType().toString()));
|
2024-10-07 22:04:09 +03:00
|
|
|
CommonUtils.bytesToFile((byte[]) response.object, res);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean validate() {
|
|
|
|
|
return res.exists();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void showDone() throws Exception {
|
|
|
|
|
ReadOnlyMultilineTextForm ff = new ReadOnlyMultilineTextForm();
|
|
|
|
|
List<String> lines = FileUtils.readLines(res);
|
|
|
|
|
Vector<String> res = new Vector<>();
|
|
|
|
|
for (int i = lines.size() - 1; i >= 0; i--)
|
|
|
|
|
res.add(lines.get(i));
|
|
|
|
|
ff.ShowDialog("Журнал изменений компонента " +
|
2024-10-07 14:22:52 +03:00
|
|
|
CommonUtils.Brackets(target.getComponentType().getDescription()),
|
2023-09-17 22:13:42 +03:00
|
|
|
String.join("\n", res)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|