2024-08-18 01:08:56 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-08 22:33:49 +03:00
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.GlobalData.GlobalDatabase;
|
2024-10-07 00:58:29 +03:00
|
|
|
import _VisualDVM.Global;
|
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.Settings.SettingName;
|
2024-10-10 23:57:36 +03:00
|
|
|
import Common.Passes.Pass;
|
2024-08-18 01:08:56 +03:00
|
|
|
|
|
|
|
|
import java.io.File;
|
2024-09-10 01:50:44 +03:00
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.GregorianCalendar;
|
2024-10-09 23:37:58 +03:00
|
|
|
public class GetOldBugReports extends Pass<DirInfosDataSet> {
|
2024-08-18 01:08:56 +03:00
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2024-09-10 01:50:44 +03:00
|
|
|
target = new DirInfosDataSet();
|
2024-08-18 01:08:56 +03:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean needsAnimation() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void body() throws Exception {
|
|
|
|
|
File workspace = Global.visualiser.getWorkspace();
|
|
|
|
|
File[] files = workspace.listFiles(pathname -> pathname.isDirectory() && pathname.getName().toLowerCase().startsWith("bugreport_"));
|
|
|
|
|
if (files != null) {
|
|
|
|
|
//---
|
|
|
|
|
Calendar c = new GregorianCalendar();
|
|
|
|
|
c.setTimeInMillis(System.currentTimeMillis());
|
2024-10-08 22:33:49 +03:00
|
|
|
c.add(Calendar.MONTH, -((GlobalDatabase) CommonUtils.db).settings.get(SettingName.BugReportsAgeLimit).toInt32());
|
2024-08-18 01:08:56 +03:00
|
|
|
Date date = c.getTime();
|
|
|
|
|
System.out.println(date);
|
|
|
|
|
long border = date.getTime();
|
|
|
|
|
//--
|
2024-09-10 01:50:44 +03:00
|
|
|
for (File file : files) {
|
2024-08-18 01:08:56 +03:00
|
|
|
ShowMessage2(file.getName());
|
|
|
|
|
long mdate = Utils.getNewestFileDate(file);
|
2024-09-10 01:50:44 +03:00
|
|
|
if (mdate <= border) {
|
|
|
|
|
DirInfo d = new DirInfo(file, mdate);
|
|
|
|
|
target.put(d.getPK(), d);
|
2024-08-18 01:08:56 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|