2023-11-19 02:12:44 +03:00
|
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-08 22:33:49 +03:00
|
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import _VisualDVM.Current;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.GlobalData.GlobalDatabase;
|
2024-10-08 22:33:49 +03:00
|
|
|
|
import Common.Visual.Windows.Dialog.Dialog;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import _VisualDVM.Utils;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.GlobalData.FileObject.DirInfo;
|
|
|
|
|
|
import _VisualDVM.GlobalData.FileObject.DirInfosDataSet;
|
|
|
|
|
|
import _VisualDVM.GlobalData.FileObject.DirInfosFields;
|
|
|
|
|
|
import _VisualDVM.GlobalData.Settings.SettingName;
|
2024-10-09 23:37:58 +03:00
|
|
|
|
import Visual_DVM_2021.Passes.PassCode;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.Pass;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
2024-08-18 01:08:56 +03:00
|
|
|
|
import javax.swing.*;
|
2024-10-09 23:37:58 +03:00
|
|
|
|
public class DeleteDownloadedBugReports extends Pass<DirInfosDataSet> {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean needsAnimation() {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
|
target = null;
|
2024-10-09 23:37:58 +03:00
|
|
|
|
if (passes.get(PassCode.GetOldBugReports).Do()){
|
|
|
|
|
|
target = (DirInfosDataSet) passes.get(PassCode.GetOldBugReports).target;
|
2024-09-10 01:50:44 +03:00
|
|
|
|
if (target.Data.isEmpty()){
|
|
|
|
|
|
Log.Writeln_("Не найдено отчетов, не использовавшихся " +
|
2024-10-08 22:33:49 +03:00
|
|
|
|
((GlobalDatabase) CommonUtils.db).settings.get(SettingName.BugReportsAgeLimit).toInt32() +
|
2024-09-10 01:50:44 +03:00
|
|
|
|
" месяцев и более!");
|
|
|
|
|
|
return false;
|
2024-08-18 01:08:56 +03:00
|
|
|
|
}
|
|
|
|
|
|
//-
|
2024-09-10 01:50:44 +03:00
|
|
|
|
Dialog<Object, DirInfosFields> dialog = new Dialog<Object, DirInfosFields>(DirInfosFields.class) {
|
2024-08-18 01:08:56 +03:00
|
|
|
|
@Override
|
|
|
|
|
|
public int getDefaultHeight() {
|
2024-08-18 12:28:54 +03:00
|
|
|
|
return 300;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public int getDefaultWidth() {
|
|
|
|
|
|
return 600;
|
2024-08-18 01:08:56 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void Init(Object... params) {
|
2024-09-10 01:50:44 +03:00
|
|
|
|
target.mountUI((JPanel) content);
|
|
|
|
|
|
target.ShowUI();
|
2024-08-18 01:08:56 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void validateFields() {
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2024-09-10 01:50:44 +03:00
|
|
|
|
if (dialog.ShowDialog("Найдено "+target.size()+" отчетов, не использовавшихся " +
|
2024-10-08 22:33:49 +03:00
|
|
|
|
((GlobalDatabase)CommonUtils.db).settings.get(SettingName.BugReportsAgeLimit).toInt32()+
|
2024-09-10 01:50:44 +03:00
|
|
|
|
" месяцев и более. Удалить?")) {
|
2024-08-18 01:08:56 +03:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performPreparation() throws Exception {
|
|
|
|
|
|
if (Current.HasProject())
|
2024-10-09 23:37:58 +03:00
|
|
|
|
passes.get(PassCode.CloseCurrentProject).Do();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void body() throws Exception {
|
2024-09-10 01:50:44 +03:00
|
|
|
|
for (DirInfo dir : target.Data.values()) {
|
|
|
|
|
|
ShowMessage1(dir.getPK().toString());
|
|
|
|
|
|
Utils.forceDeleteWithCheck(dir.getFile());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|