no message
This commit is contained in:
68
src/_VisualDVM/Passes/All/DeleteDownloadedBugReports.java
Normal file
68
src/_VisualDVM/Passes/All/DeleteDownloadedBugReports.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.Dialog;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.FileObject.DirInfo;
|
||||
import _VisualDVM.GlobalData.FileObject.DirInfosDataSet;
|
||||
import _VisualDVM.GlobalData.FileObject.DirInfosFields;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import javax.swing.*;
|
||||
public class DeleteDownloadedBugReports extends Pass<DirInfosDataSet> {
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = null;
|
||||
if ( Global.mainModule.getPass(PassCode.GetOldBugReports).Do()){
|
||||
target = (DirInfosDataSet) Global.mainModule.getPass(PassCode.GetOldBugReports).target;
|
||||
if (target.Data.isEmpty()){
|
||||
Log.Writeln_("Не найдено отчетов, не использовавшихся " +
|
||||
(Global.mainModule.getDb()).settings.get(SettingName.BugReportsAgeLimit).toInt32() +
|
||||
" месяцев и более!");
|
||||
return false;
|
||||
}
|
||||
//-
|
||||
Dialog<Object, DirInfosFields> dialog = new Dialog<Object, DirInfosFields>(DirInfosFields.class) {
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 300;
|
||||
}
|
||||
@Override
|
||||
public int getDefaultWidth() {
|
||||
return 600;
|
||||
}
|
||||
@Override
|
||||
public void Init(Object... params) {
|
||||
target.mountUI((JPanel) content);
|
||||
target.ShowUI();
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
}
|
||||
};
|
||||
if (dialog.ShowDialog("Найдено "+target.size()+" отчетов, не использовавшихся " +
|
||||
(Global.mainModule.getDb()).settings.get(SettingName.BugReportsAgeLimit).toInt32()+
|
||||
" месяцев и более. Удалить?")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (Global.mainModule.HasProject())
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (DirInfo dir : target.Data.values()) {
|
||||
ShowMessage1(dir.getPK().toString());
|
||||
Utils.forceDeleteWithCheck(dir.getFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user