use of com.ilargia.games.entitas.codeGenerator.providers.TypeReflectionProvider in project Entitas-Java by Rubentxu.
the class CodeGeneratorApp method handleGenerate.
@FXML
public void handleGenerate(ActionEvent actionEvent) throws IOException {
result.setText("");
progress.setVisible(true);
result.setText("Generating...");
if (props != null)
saveProperties();
// loads the items at another thread, asynchronously
Task loader = new Task<List<CodeGenFile>>() {
{
setOnSucceeded(workerStateEvent -> {
progress.setVisible(false);
result.setText("Success");
});
setOnFailed(workerStateEvent -> {
result.setText("Failed");
getException().printStackTrace();
});
}
@Override
protected List<CodeGenFile> call() throws Exception {
List<ICodeGenerator> codeGenerators = new ArrayList<>();
if (componentsGenerator.isSelected())
codeGenerators.add(new EntityGenerator());
if (componentIndicesGenerator.isSelected())
codeGenerators.add(new ComponentIndicesGenerator());
if (contextsGenerator.isSelected())
codeGenerators.add(new ContextGenerator());
codeGenerators.add(new MatcherGenerator());
codeGenerators.add(new EntitasGenerator());
TypeReflectionProvider provider = new TypeReflectionProvider(fieldComponentFolder.getText());
CodeGeneratorOld generator = new CodeGeneratorOld();
return generator.generate(provider, fieldGeneratedFolder.getText(), codeGenerators);
}
};
Thread loadingThread = new Thread(loader, "generated-loader");
loadingThread.setDaemon(true);
loadingThread.start();
}
Aggregations