2024-10-14 12:14:01 +03:00
|
|
|
package _VisualDVM.Passes.All;
|
2024-10-11 00:00:30 +03:00
|
|
|
import Common.Utils.Utils_;
|
2024-10-16 00:40:45 +03:00
|
|
|
import _VisualDVM.Visual.Windows.ReadOnlyMultilineTextForm;
|
2024-10-14 15:19:13 +03:00
|
|
|
import _VisualDVM.Current;
|
2024-10-13 22:08:13 +03:00
|
|
|
import _VisualDVM.Global;
|
2024-10-14 15:19:13 +03:00
|
|
|
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.Repository.Component.Component;
|
|
|
|
|
import _VisualDVM.Repository.Server.ServerCode;
|
|
|
|
|
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
|
2024-10-14 15:19:13 +03:00
|
|
|
import _VisualDVM.Utils;
|
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> {
|
2024-10-14 15:19:13 +03:00
|
|
|
File res;
|
2023-09-17 22:13:42 +03:00
|
|
|
@Override
|
|
|
|
|
public String getIconPath() {
|
2024-10-15 16:58:20 +03:00
|
|
|
return "/Common/icons/Log.png";
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getButtonText() {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2024-10-13 22:08:13 +03:00
|
|
|
if (Global.mainModule.Check(Log, Current.Component)) {
|
|
|
|
|
target = Global.mainModule.getComponent();
|
2023-09-17 22:13:42 +03:00
|
|
|
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-11 00:00:30 +03:00
|
|
|
Utils_.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-11 00:00:30 +03:00
|
|
|
Utils_.Brackets(target.getComponentType().getDescription()),
|
2023-09-17 22:13:42 +03:00
|
|
|
String.join("\n", res)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|