no message
This commit is contained in:
46
src/_VisualDVM/Passes/All/CreateEmptyProject.java
Normal file
46
src/_VisualDVM/Passes/All/CreateEmptyProject.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Constants;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Visual.Windows.Dialog.Text.FileNameForm;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import Common.Passes.PassException;
|
||||
import Common.Passes.Pass;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class CreateEmptyProject extends Pass<File> {
|
||||
String project_name;
|
||||
FileNameForm ff = new FileNameForm();
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/CreateProject.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
project_name = "";
|
||||
target = null;
|
||||
if (ff.ShowDialog("Укажите имя создаваемого проекта", "NewProject")) {
|
||||
project_name = ff.Result;
|
||||
target = Paths.get(Global.visualiser.getWorkspace().getAbsolutePath(), project_name).toFile();
|
||||
if (target.exists())
|
||||
Log.Writeln("Файл\n" + Utils_.Brackets(target.getAbsolutePath()) + "\nуже существует");
|
||||
return Log.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
File data = new File(target, Constants.data);
|
||||
if (!(target.mkdir()&&data.mkdir()))
|
||||
throw new PassException("Не удалось создать проект.");
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
Global.mainModule.getPass(PassCode.OpenCurrentProject).Do(target);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user