Example usage for org.eclipse.jdt.apt.core.env EclipseAnnotationProcessorEnvironment getJavaProject

List of usage examples for org.eclipse.jdt.apt.core.env EclipseAnnotationProcessorEnvironment getJavaProject

Introduction

In this page you can find the example usage for org.eclipse.jdt.apt.core.env EclipseAnnotationProcessorEnvironment getJavaProject.

Prototype

IJavaProject getJavaProject();

Source Link

Usage

From source file:org.eclipselabs.stlipse.apt.StlipseAnnotationProcessor.java

License:Open Source License

public void process() {
    if (environment instanceof EclipseAnnotationProcessorEnvironment) {
        EclipseAnnotationProcessorEnvironment env = (EclipseAnnotationProcessorEnvironment) environment;
        IJavaProject javaProject = env.getJavaProject();
        String actionBeanType = env.getSpecifiedTypeDeclarations().iterator().next().getQualifiedName();
        for (String annotationType : StlipseAnnotationProcessorFactory.SUPPORTED_ANNOTATIONS) {
            AnnotationTypeDeclaration annotation = (AnnotationTypeDeclaration) env
                    .getTypeDeclaration(annotationType);
            Collection<Declaration> annotatedProperties = env.getDeclarationsAnnotatedWith(annotation);
            for (Declaration annotatedProperty : annotatedProperties) {
                StlipseAnnotationVisitor visitor = new StlipseAnnotationVisitor(annotationType, javaProject,
                        actionBeanType, env.getMessager());
                annotatedProperty.accept(visitor);
            }/*from   w  ww  . java2 s  . co m*/
        }
    }
}