use of com.thecoderscorner.menu.editorui.cli.CreateProjectCommand in project tcMenu by davetcc.
the class NewProjectController method onCreate.
public void onCreate(ActionEvent actionEvent) {
boolean newOnlyMode = newOnlyRadio.isSelected();
if (newOnlyMode) {
if (!passDirtyCheck())
return;
project.newProject();
} else if (maybeDirectory.isPresent() && !StringHelper.isStringEmptyOrNull(projectNameField.getText())) {
if (!passDirtyCheck())
return;
try {
String projName = projectNameField.getText();
var projectCreator = new CreateProjectCommand();
projectCreator.createNewProject(Paths.get(maybeDirectory.get()), projName, cppMainCheckbox.isSelected(), platformCombo.getSelectionModel().getSelectedItem(), s -> logger.log(INFO, s), namespaceField.getText());
Path emfFileName = Paths.get(maybeDirectory.get(), projName, projName + ".emf");
project.openProject(emfFileName.toString());
} catch (Exception e) {
logger.log(ERROR, "Failure processing create new project", e);
var alert = new Alert(Alert.AlertType.ERROR, "Error during create project", ButtonType.CLOSE);
BaseDialogSupport.getJMetro().setScene(alert.getDialogPane().getScene());
alert.showAndWait();
}
} else {
var alert = new Alert(Alert.AlertType.WARNING, "Please ensure all fields are populated", ButtonType.CLOSE);
BaseDialogSupport.getJMetro().setScene(alert.getDialogPane().getScene());
alert.showAndWait();
// avoid closing.
return;
}
Stage stage = (Stage) createButton.getScene().getWindow();
stage.close();
}
Aggregations