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

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

Introduction

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

Prototype

public void runOperation(IProgressMonitor monitor) throws JavaModelException 

Source Link

Document

Main entry point for Java Model operations.

Usage

From source file:org.codehaus.jdt.groovy.model.GroovyCompilationUnit.java

License:Open Source License

@Override
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  ww.  j  a v  a2 s  .  c o  m*/
    if (ReconcileWorkingCopyOperation.PERF) {
        stats = PerformanceStats.getStats(JavaModelManager.RECONCILE_PERF, this);
        stats.startRun(new String(this.getFileName()));
    }
    ReconcileWorkingCopyOperation op = new GroovyReconcileWorkingCopyOperation(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;
}

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;//from   w  w w.j av  a2s .com
    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;
}