Example usage for org.eclipse.jdt.internal.core ReconcileWorkingCopyOperation ReconcileWorkingCopyOperation

List of usage examples for org.eclipse.jdt.internal.core ReconcileWorkingCopyOperation ReconcileWorkingCopyOperation

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core ReconcileWorkingCopyOperation ReconcileWorkingCopyOperation.

Prototype

public ReconcileWorkingCopyOperation(IJavaElement workingCopy, int astLevel, int reconcileFlags,
            WorkingCopyOwner workingCopyOwner) 

Source Link

Usage

From source file:org.eclipse.jdt.internal.core.CompilationUnit.java

License:Open Source License

public org.eclipse.jdt.core.dom.CompilationUnit reconcile(int astLevel, int reconcileFlags,
        WorkingCopyOwner workingCopyOwner, IProgressMonitor monitor) throws JavaModelException {

    if (!isWorkingCopy())
        return null; // Reconciling is not supported on non working copies
    if (workingCopyOwner == null)
        workingCopyOwner = DefaultWorkingCopyOwner.PRIMARY;

    PerformanceStats stats = null;// w w  w.  j a v a  2  s. c om
    if (ReconcileWorkingCopyOperation.PERF) {
        stats = PerformanceStats.getStats(JavaModelManager.RECONCILE_PERF, this);
        stats.startRun(new String(getFileName()));
    }
    ReconcileWorkingCopyOperation op = new ReconcileWorkingCopyOperation(this, astLevel, reconcileFlags,
            workingCopyOwner);
    JavaModelManager manager = JavaModelManager.getJavaModelManager();
    try {
        manager.cacheZipFiles(this); // cache zip files for performance (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=134172)
        op.runOperation(monitor);
    } finally {
        manager.flushZipFiles(this);
    }
    if (ReconcileWorkingCopyOperation.PERF) {
        stats.endRun();
    }
    return op.ast;
}