use of com.github.javaparser.ParseException in project Gargoyle by callakrsos.
the class VoEditorController method setFromFile.
/********************************
* 작성일 : 2016. 7. 4. 작성자 : KYJ
*
*
* @param voFile
* @throws IOException
* @throws FileNotFoundException
********************************/
public void setFromFile(File voFile) {
if (voFile == null || !voFile.exists())
return;
if (voFile.isFile()) {
CompilationUnit cu;
try (FileInputStream in = new FileInputStream(voFile)) {
// parse the file
cu = JavaParser.parse(in);
PackageDeclaration packageDeclaration = cu.getPackage();
txtPackageName.setText(packageDeclaration.getName().toString());
txtClassName.setText(voFile.getName().substring(0, voFile.getName().indexOf('.')));
txtLocation.setText(voFile.getAbsolutePath());
MethodVisitor methodVisitor = new MethodVisitor();
methodVisitor.visit(cu, null);
List<TableModelDVO> valideFieldMeta = methodVisitor.getValideFieldMeta(t -> {
TableModelDVO tableModelDVO = new TableModelDVO();
tableModelDVO.setName(t.getName());
tableModelDVO.setType(t.getFieldType().getSimpleName());
return tableModelDVO;
});
this.tbVoEditor.getItems().addAll(valideFieldMeta);
} catch (IOException | ParseException e) {
LOGGER.error(ValueUtil.toString(e));
}
} else {
txtLocation.setText(voFile.getAbsolutePath());
}
}
Aggregations