Files
VisualSapfor/src/_VisualDVM/Passes/All/DeleteSelectedVersions.java

55 lines
2.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package _VisualDVM.Passes.All;
import Common.Passes.Pass;
import Common.Visual.UI;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.Project.db_project_info;
import java.util.Vector;
public class DeleteSelectedVersions extends Pass<Vector<db_project_info>> {
boolean has_current_project;
@Override
public String getButtonText() {
return "";
}
@Override
public String getIconPath() {
return "/Common/icons/Delete.png";
}
@Override
protected boolean canStart(Object... args) throws Exception {
has_current_project = false;
target = new Vector<>();
//------------------------
if (!Global.versions_multiselection) {
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора версий.");
return false;
}
if (!Global.mainModule.Check(Log, Current.Root)) {
return false;
}
Vector<db_project_info> allVersions = new Vector<>();
Global.mainModule.getRoot().getSelectedVersions(allVersions);
if (allVersions.size() == 0) {
Log.Writeln_("Не отмечено ни одной версии.");
return false;
}
int q = Global.mainModule.getRoot().getSelectedVersionsForDeletion(target);
if (Global.mainModule.HasProject()) {
for (db_project_info version : target) {
if (Global.mainModule.getProject().Home.getAbsolutePath().startsWith(version.Home.getAbsolutePath())) {
has_current_project = true;
break;
}
}
}
return UI.Warning("Удалить " + q + " версий.");
}
@Override
protected void body() throws Exception {
for (db_project_info version : target)
Global.mainModule.getPass(PassCode.DeleteVersion).Do(version);
}
}