Example usage for org.eclipse.jdt.core IProblemRequestor isActive

List of usage examples for org.eclipse.jdt.core IProblemRequestor isActive

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IProblemRequestor isActive.

Prototype

boolean isActive();

Source Link

Document

Predicate allowing the problem requestor to signal whether or not it is currently interested by problem reports.

Usage

From source file:org.eclipse.ajdt.core.reconcile.AJReconcileWorkingCopyOperation.java

License:Open Source License

/**
 * @exception JavaModelException if setting the source
 *    of the original compilation unit fails
 *//*from   www.j a va  2 s .c om*/
protected void executeOperation() throws JavaModelException {
    checkCanceled();

    try {
        beginTask(Messages.element_reconciling, 2);

        CompilationUnit workingCopy = getWorkingCopy();
        boolean wasConsistent = workingCopy.isConsistent();

        // check is problem requestor is active
        IProblemRequestor problemRequestor = workingCopy.getPerWorkingCopyInfo();
        if (problemRequestor != null)
            problemRequestor = ((JavaModelManager.PerWorkingCopyInfo) problemRequestor).getProblemRequestor();
        boolean defaultRequestorIsActive = problemRequestor != null && problemRequestor.isActive();
        IProblemRequestor ownerProblemRequestor = this.workingCopyOwner.getProblemRequestor(workingCopy);
        boolean ownerRequestorIsActive = ownerProblemRequestor != null
                && ownerProblemRequestor != problemRequestor && ownerProblemRequestor.isActive();
        this.requestorIsActive = defaultRequestorIsActive || ownerRequestorIsActive;

        // create the delta builder (this remembers the current content of the cu)
        this.deltaBuilder = new JavaElementDeltaBuilder(workingCopy);

        // make working copy consistent if needed and compute AST if needed
        makeConsistent(workingCopy);

        // notify reconcile participants only if working copy was not consistent or if forcing problem detection
        // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=177319)
        if (!wasConsistent || ((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0)) {
            notifyParticipants(workingCopy);

            // recreate ast if one participant reset it
            if (this.ast == null)
                makeConsistent(workingCopy);
        }

        // report problems
        if (this.problems != null && (((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0)
                || !wasConsistent)) {
            if (defaultRequestorIsActive) {
                reportProblems(workingCopy, problemRequestor);
            }
            if (ownerRequestorIsActive) {
                reportProblems(workingCopy, ownerProblemRequestor);
            }
        }

        // register the deltas
        // AspectJ Change Begin
        JavaElementDelta delta = getDelta(deltaBuilder);
        if (delta != null) {
            addReconcileDelta(workingCopy, delta);
        }
        // AspectJ Change End
    } finally {
        done();
    }
}