no message
This commit is contained in:
72
src/_VisualDVM/Passes/All/OpenBugReportTestProject.java
Normal file
72
src/_VisualDVM/Passes/All/OpenBugReportTestProject.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Repository.BugReport.BugReport;
|
||||
import _VisualDVM.Repository.BugReport.BugReportInterface;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class OpenBugReportTestProject extends Pass<BugReport> {
|
||||
File root = null;
|
||||
File project = null;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadBugReport.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Global.mainModule.Check(Log, Current.BugReport) &&
|
||||
(BugReportInterface.CheckNotDraft(target=Global.mainModule.getBugReport(),Log))) {
|
||||
|
||||
if (!target.project_version.isEmpty()) {
|
||||
root = Paths.get(Global.visualiser.getWorkspace().getAbsolutePath(),
|
||||
target.id).toFile();
|
||||
project = Paths.get(root.getAbsolutePath(),
|
||||
Utils_.isWindows() ? Utils_.toW(target.project_version)
|
||||
: Utils_.toU(target.project_version)).toFile();
|
||||
return true;
|
||||
}else {
|
||||
Log.Writeln_("Отчёт об ошибке не содержит прикреплённого проекта!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void performPreparation() throws Exception {
|
||||
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
|
||||
Global.mainModule.set(Current.Root, null); //чтобы гарантированно не существовало корня.
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
//попытка скачки. проверка существования архива уже там.
|
||||
Global.mainModule.getPass(PassCode.DownloadBugReport).Do(target);
|
||||
if (BugReportInterface.getArchiveFile(target).exists()) {
|
||||
Global.mainModule.getPass(PassCode.UnzipFolderPass).Do(
|
||||
BugReportInterface.getArchiveFile(target).getAbsolutePath(),
|
||||
root.getAbsolutePath()
|
||||
);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
if (!project.exists()) {
|
||||
Log.Writeln_("Тестовый проект\n" + project.getAbsolutePath() +
|
||||
"\nне был скачан.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
if ( Global.mainModule.getPass(PassCode.OpenCurrentProject).Do(project))
|
||||
Global.mainModule.getPass(PassCode.ApplyBugReportSettings).Do();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user