Example usage for org.eclipse.jdt.apt.core.util AptConfig setProcessDuringReconcile

List of usage examples for org.eclipse.jdt.apt.core.util AptConfig setProcessDuringReconcile

Introduction

In this page you can find the example usage for org.eclipse.jdt.apt.core.util AptConfig setProcessDuringReconcile.

Prototype

public static void setProcessDuringReconcile(IJavaProject jproject, boolean enabled) 

Source Link

Document

Turn processing during reconcile on or off.

Usage

From source file:org.jboss.tools.maven.apt.internal.AbstractAptProjectConfigurator.java

License:Open Source License

/**
 * reconcile is enabled by default while enabling apt for maven-compiler-plugin,
 * As Annotation processing usually takes a long time for even a java file change,
 * and what's more, validate a jsp also triggers apt reconcile as jsp compiles into java,
 * this option is provided to switch off the "Processing on Edit" feature.
 * //  w  w  w .j  ava 2s  .  co m
 * @throws CoreException 
 */
private void configureAptReconcile(IProject project) throws CoreException {
    if (project.hasNature(JavaCore.NATURE_ID)) {
        IJavaProject jp = JavaCore.create(project);
        if (jp != null && AptConfig.isEnabled(jp)) {
            boolean shouldEnable = MavenJdtAptPlugin.getDefault().getPreferencesManager()
                    .shouldEnableAnnotationProcessDuringReconcile(project);
            if (shouldEnable && !AptConfig.shouldProcessDuringReconcile(jp)) {
                AptConfig.setProcessDuringReconcile(jp, true);
            }
            if (!shouldEnable && AptConfig.shouldProcessDuringReconcile(jp)) {
                AptConfig.setProcessDuringReconcile(jp, false);
            }
        }
    }
}