no message
This commit is contained in:
62
src/_VisualDVM/Passes/All/DeleteVersion.java
Normal file
62
src/_VisualDVM/Passes/All/DeleteVersion.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.UI;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.ProjectData.Project.db_project_info;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
public class DeleteVersion extends Pass<db_project_info> {
|
||||
db_project_info parent;
|
||||
boolean current;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/Delete.png";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
if (args.length > 0) {
|
||||
target = (db_project_info) args[0];
|
||||
current = (Global.mainModule.getVersion() != null) && Global.mainModule.getVersion().Home.equals(target.Home);
|
||||
return true;
|
||||
} else {
|
||||
if (((target = Global.mainModule.getVersion()) != null) && (!UI_.isActive() ||
|
||||
UI_.Warning("Удалить " +
|
||||
((Global.mainModule.HasProject() && target.Home.equals(Global.mainModule.getProject().Home)) ? "текущий проект" : "версию ")
|
||||
+ Utils_.Brackets(target.name)))) {
|
||||
current = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
if (target.parent != null)
|
||||
target.parent.checkLastModification(target);
|
||||
if (Global.mainModule.HasProject()) {
|
||||
if ((Global.mainModule.getProject().Home.getAbsolutePath().startsWith(target.Home.getAbsolutePath())))
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
||||
}
|
||||
if (UI_.isActive()) {
|
||||
UI.getVersionsWindow().RemoveVersionFromComparison(target);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
Utils.forceDeleteWithCheck(target.Home);
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
parent = target.parent;
|
||||
if (current)
|
||||
Global.mainModule.set(Current.Version, null);
|
||||
if (parent != null) {
|
||||
UI.getVersionsWindow().getVersionsForm().getTree().RemoveNode(target.node);
|
||||
parent.versions.remove(target.name);
|
||||
} else
|
||||
Global.mainModule.set(Current.Root, null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user