no message
This commit is contained in:
55
src/_VisualDVM/Passes/All/DeleteSelectedFiles.java
Normal file
55
src/_VisualDVM/Passes/All/DeleteSelectedFiles.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
public class DeleteSelectedFiles extends Pass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.getProject().db.files.getCheckedCount() == 0) {
|
||||
Log.Writeln_("Не отмечено ни одного файла.");
|
||||
return false;
|
||||
}
|
||||
return UI_.Warning("Удалить " + Global.mainModule.getProject().db.files.getCheckedCount() + " файлов.");
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
boolean hasCurrent = false;
|
||||
boolean hasSelected = false;
|
||||
if (Global.mainModule.HasFile()) {
|
||||
for (DBProjectFile file :Global.mainModule.getProject().db.files.getCheckedItems()) {
|
||||
if (Global.mainModule.getFile().file.equals(file.file))
|
||||
hasCurrent = true;
|
||||
if (Global.mainModule.getSelectedFile().file.equals(file.file))
|
||||
hasSelected = true;
|
||||
}
|
||||
}
|
||||
if (hasCurrent)
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentFile).Do();
|
||||
if (hasSelected) {
|
||||
Global.mainModule.set(Current.SelectedFile, null);
|
||||
Global.mainModule.set(Current.ProjectNode, null);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
for (DBProjectFile file : Global.mainModule.getProject().db.files.getCheckedItems()) {
|
||||
ShowMessage1(file.name);
|
||||
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RemoveNode(file.node);
|
||||
Global.mainModule.getProject().db.Delete(file);
|
||||
Utils.forceDeleteWithCheck(file.file);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user