Search in sources :

Example 1 with NameExpr

use of com.github.javaparser.ast.expr.NameExpr in project Gargoyle by callakrsos.

the class BaseInfoComposite method start.

/**
	 *
	 * 코드 분석 시작 처리.
	 * @작성자 : KYJ
	 * @작성일 : 2017. 2. 3.
	 */
public void start() {
    // 동적처리에 따라 API 함수 수정.
    FileUtil.consumeJavaParser(targetFile, cu -> {
        NameExpr name = cu.getPackage().getName();
        lblPackage.setText(name.toString());
        String importStatement = cu.getImports().stream().map(im -> im.getName().toString()).collect(Collectors.joining(","));
        lblImports.setText(importStatement);
        Service<Void> service = new Service<Void>() {

            @Override
            protected Task<Void> createTask() {
                return new Task<Void>() {

                    @Override
                    protected Void call() throws Exception {
                        new MethodVisitor(v -> {
                            methodData.add(v);
                        }).visit(cu, null);
                        return null;
                    }
                };
            }
        };
        service.start();
    }, err -> {
        LOGGER.error(ValueUtil.toString(err));
    });
}
Also used : VoidVisitorAdapter(com.github.javaparser.ast.visitor.VoidVisitorAdapter) TreeItem(javafx.scene.control.TreeItem) Parameter(com.github.javaparser.ast.body.Parameter) LoggerFactory(org.slf4j.LoggerFactory) FXCollections(javafx.collections.FXCollections) Function(java.util.function.Function) ArrayList(java.util.ArrayList) FileWrapper(com.kyj.fx.voeditor.visual.component.FileWrapper) Task(javafx.concurrent.Task) MethodDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.MethodDVO) Type(com.github.javaparser.ast.type.Type) JavaProjectFileTreeItem(com.kyj.fx.voeditor.visual.component.JavaProjectFileTreeItem) FileUtil(com.kyj.fx.voeditor.visual.util.FileUtil) SpecResource(com.kyj.fx.voeditor.visual.words.spec.auto.msword.ui.model.SpecResource) MethodParameterDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.MethodParameterDVO) VariableDeclaratorId(com.github.javaparser.ast.body.VariableDeclaratorId) SystemUtils(org.apache.commons.lang.SystemUtils) TextField(javafx.scene.control.TextField) Logger(org.slf4j.Logger) GargoyleJavaParser(com.kyj.fx.voeditor.visual.framework.parser.GargoyleJavaParser) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) NameExpr(com.github.javaparser.ast.expr.NameExpr) Service(javafx.concurrent.Service) Collectors(java.util.stream.Collectors) File(java.io.File) Consumer(java.util.function.Consumer) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) Stream(java.util.stream.Stream) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) Comment(com.github.javaparser.ast.comments.Comment) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) Collections(java.util.Collections) AbstractSpecTab(com.kyj.fx.voeditor.visual.words.spec.auto.msword.ui.tabs.AbstractSpecTab) Task(javafx.concurrent.Task) NameExpr(com.github.javaparser.ast.expr.NameExpr) Service(javafx.concurrent.Service)

Aggregations

MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)1 Parameter (com.github.javaparser.ast.body.Parameter)1 VariableDeclaratorId (com.github.javaparser.ast.body.VariableDeclaratorId)1 Comment (com.github.javaparser.ast.comments.Comment)1 NameExpr (com.github.javaparser.ast.expr.NameExpr)1 Type (com.github.javaparser.ast.type.Type)1 VoidVisitorAdapter (com.github.javaparser.ast.visitor.VoidVisitorAdapter)1 FileWrapper (com.kyj.fx.voeditor.visual.component.FileWrapper)1 JavaProjectFileTreeItem (com.kyj.fx.voeditor.visual.component.JavaProjectFileTreeItem)1 FXMLController (com.kyj.fx.voeditor.visual.framework.annotation.FXMLController)1 GargoyleJavaParser (com.kyj.fx.voeditor.visual.framework.parser.GargoyleJavaParser)1 FileUtil (com.kyj.fx.voeditor.visual.util.FileUtil)1 FxUtil (com.kyj.fx.voeditor.visual.util.FxUtil)1 ValueUtil (com.kyj.fx.voeditor.visual.util.ValueUtil)1 SpecResource (com.kyj.fx.voeditor.visual.words.spec.auto.msword.ui.model.SpecResource)1 AbstractSpecTab (com.kyj.fx.voeditor.visual.words.spec.auto.msword.ui.tabs.AbstractSpecTab)1 MethodDVO (com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.MethodDVO)1 MethodParameterDVO (com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.MethodParameterDVO)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1