Example usage for org.eclipse.jdt.internal.compiler.util Messages compilation_done

List of usage examples for org.eclipse.jdt.internal.compiler.util Messages compilation_done

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.util Messages compilation_done.

Prototype

String compilation_done

To view the source code for org.eclipse.jdt.internal.compiler.util Messages compilation_done.

Click Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MatchLocator.java

License:Open Source License

protected void locateMatches(JavaProject javaProject, PossibleMatch[] possibleMatches, int start, int length)
        throws CoreException {
    initialize(javaProject, length);//from  w  w  w.  j  a va2  s  .  co  m

    // create and resolve binding (equivalent to beginCompilation() in Compiler)
    boolean mustResolvePattern = this.pattern.mustResolve;
    boolean mustResolve = mustResolvePattern;
    this.patternLocator.mayBeGeneric = this.options.sourceLevel >= ClassFileConstants.JDK1_5;
    boolean bindingsWereCreated = mustResolve;
    try {
        for (int i = start, maxUnits = start + length; i < maxUnits; i++) {
            PossibleMatch possibleMatch = possibleMatches[i];
            try {
                if (!parseAndBuildBindings(possibleMatch, mustResolvePattern))
                    continue;
                // Currently we only need to resolve over pattern flag if there's potential parameterized types
                if (this.patternLocator.mayBeGeneric) {
                    // If pattern does not resolve then rely on possible match node set resolution
                    // which may have been modified while locator was adding possible matches to it
                    if (!mustResolvePattern && !mustResolve) {
                        mustResolve = possibleMatch.nodeSet.mustResolve;
                        bindingsWereCreated = mustResolve;
                    }
                } else {
                    // Reset matching node resolution with pattern one if there's no potential parameterized type
                    // to minimize side effect on previous search behavior
                    possibleMatch.nodeSet.mustResolve = mustResolvePattern;
                }
                // possible match node resolution has been merged with pattern one, so rely on it to know
                // whether we need to process compilation unit now or later
                if (!possibleMatch.nodeSet.mustResolve) {
                    if (this.progressMonitor != null) {
                        this.progressWorked++;
                        if ((this.progressWorked % this.progressStep) == 0)
                            this.progressMonitor.worked(this.progressStep);
                    }
                    process(possibleMatch, bindingsWereCreated);
                    if (this.numberOfMatches > 0
                            && this.matchesToProcess[this.numberOfMatches - 1] == possibleMatch) {
                        // forget last possible match as it was processed
                        this.numberOfMatches--;
                    }
                }
            } finally {
                if (possibleMatch.hasSimilarMatch()) {
                    // If there is similar match, then also process it
                    // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=211872
                    possibleMatches[i] = possibleMatch.getSimilarMatch();
                    i--;
                }
                if (!possibleMatch.nodeSet.mustResolve)
                    possibleMatch.cleanUp();
            }
        }
        if (mustResolve)
            this.lookupEnvironment.completeTypeBindings();

        // create hierarchy resolver if needed
        IType focusType = getFocusType();
        if (focusType == null) {
            this.hierarchyResolver = null;
        } else if (!createHierarchyResolver(focusType, possibleMatches)) {
            // focus type is not visible, use the super type names instead of the bindings
            if (computeSuperTypeNames(focusType) == null)
                return;
        }
    } catch (AbortCompilation e) {
        bindingsWereCreated = false;
    }

    if (!mustResolve) {
        return;
    }

    // possible match resolution
    for (int i = 0; i < this.numberOfMatches; i++) {
        if (this.progressMonitor != null && this.progressMonitor.isCanceled())
            throw new OperationCanceledException();
        PossibleMatch possibleMatch = this.matchesToProcess[i];
        this.matchesToProcess[i] = null; // release reference to processed possible match
        try {
            process(possibleMatch, bindingsWereCreated);
        } catch (AbortCompilation e) {
            // problem with class path: it could not find base classes
            // continue and try next matching openable reporting innacurate matches (since bindings will be null)
            bindingsWereCreated = false;
        } catch (JavaModelException e) {
            // problem with class path: it could not find base classes
            // continue and try next matching openable reporting innacurate matches (since bindings will be null)
            bindingsWereCreated = false;
        } finally {
            if (this.progressMonitor != null) {
                this.progressWorked++;
                if ((this.progressWorked % this.progressStep) == 0)
                    this.progressMonitor.worked(this.progressStep);
            }
            if (this.options.verbose)
                System.out.println(Messages.bind(Messages.compilation_done,
                        new String[] { String.valueOf(i + 1), String.valueOf(this.numberOfMatches),
                                new String(possibleMatch.parsedUnit.getFileName()) }));
            // cleanup compilation unit result
            possibleMatch.cleanUp();
        }
    }
}

From source file:org.eclipse.che.jdt.internal.core.search.matching.MatchLocator.java

License:Open Source License

protected void locateMatches(JavaProject javaProject, PossibleMatch[] possibleMatches, int start, int length)
        throws CoreException {
    initialize(javaProject, length);//from w ww  .  j a  v  a 2s  . co m

    // create and resolve binding (equivalent to beginCompilation() in Compiler)
    boolean mustResolvePattern = this.pattern.mustResolve;
    boolean mustResolve = mustResolvePattern;
    this.patternLocator.mayBeGeneric = this.options.sourceLevel >= ClassFileConstants.JDK1_5;
    boolean bindingsWereCreated = mustResolve;
    try {
        for (int i = start, maxUnits = start + length; i < maxUnits; i++) {
            PossibleMatch possibleMatch = possibleMatches[i];
            try {
                if (!parseAndBuildBindings(possibleMatch, mustResolvePattern))
                    continue;
                // Currently we only need to resolve over pattern flag if there's potential parameterized types
                if (this.patternLocator.mayBeGeneric) {
                    // If pattern does not resolve then rely on possible match node set resolution
                    // which may have been modified while locator was adding possible matches to it
                    if (!mustResolvePattern && !mustResolve) {
                        mustResolve = possibleMatch.nodeSet.mustResolve;
                        bindingsWereCreated = mustResolve;
                    }
                } else {
                    // Reset matching node resolution with pattern one if there's no potential parameterized type
                    // to minimize side effect on previous search behavior
                    possibleMatch.nodeSet.mustResolve = mustResolvePattern;
                }
                // possible match node resolution has been merged with pattern one, so rely on it to know
                // whether we need to process compilation unit now or later
                if (!possibleMatch.nodeSet.mustResolve) {
                    if (this.progressMonitor != null) {
                        this.progressWorked++;
                        if ((this.progressWorked % this.progressStep) == 0)
                            this.progressMonitor.worked(this.progressStep);
                    }
                    process(possibleMatch, bindingsWereCreated);
                    if (this.numberOfMatches > 0
                            && this.matchesToProcess[this.numberOfMatches - 1] == possibleMatch) {
                        // forget last possible match as it was processed
                        this.numberOfMatches--;
                    }
                }
            } finally {
                if (possibleMatch.hasSimilarMatch()) {
                    // If there is similar match, then also process it
                    // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=211872
                    possibleMatches[i] = possibleMatch.getSimilarMatch();
                    i--;
                }
                if (!possibleMatch.nodeSet.mustResolve)
                    possibleMatch.cleanUp();
            }
        }
        if (mustResolve)
            this.lookupEnvironment.completeTypeBindings();

        // create hierarchy resolver if needed
        IType focusType = getFocusType();
        if (focusType == null) {
            this.hierarchyResolver = null;
        } else if (!createHierarchyResolver(focusType, possibleMatches)) {
            // focus type is not visible, use the super type names instead of the bindings
            if (computeSuperTypeNames(focusType) == null)
                return;
        }
    } catch (AbortCompilation e) {
        bindingsWereCreated = false;
    }

    if (!mustResolve) {
        return;
    }

    // possible match resolution
    for (int i = 0; i < this.numberOfMatches; i++) {
        if (this.progressMonitor != null && this.progressMonitor.isCanceled())
            throw new OperationCanceledException();
        PossibleMatch possibleMatch = this.matchesToProcess[i];
        this.matchesToProcess[i] = null; // release reference to processed possible match
        try {
            process(possibleMatch, bindingsWereCreated);
        } catch (AbortCompilation e) {
            // problem with class path: it could not find base classes
            // continue and try next matching openable reporting inaccurate matches (since bindings will be null)
            bindingsWereCreated = false;
        } catch (JavaModelException e) {
            // problem with class path: it could not find base classes
            // continue and try next matching openable reporting inaccurate matches (since bindings will be null)
            bindingsWereCreated = false;
        } finally {
            if (this.progressMonitor != null) {
                this.progressWorked++;
                if ((this.progressWorked % this.progressStep) == 0)
                    this.progressMonitor.worked(this.progressStep);
            }
            if (this.options.verbose)
                System.out.println(Messages.bind(Messages.compilation_done,
                        new String[] { String.valueOf(i + 1), String.valueOf(this.numberOfMatches),
                                new String(possibleMatch.parsedUnit.getFileName()) }));
            // cleanup compilation unit result
            possibleMatch.cleanUp();
        }
    }
}

From source file:org.eclipse.jdt.internal.core.search.matching.MatchLocator.java

License:Open Source License

protected void locateMatches(JavaProject javaProject, PossibleMatch[] possibleMatches, int start, int length)
        throws CoreException {
    initialize(javaProject, length);//from  w ww .  ja v a  2 s .co  m

    // GROOVY start
    boolean isInterestingProject = LanguageSupportFactory.isInterestingProject(javaProject.getProject());
    Set alreadyMatched = new HashSet();
    // GROOVY end

    // create and resolve binding (equivalent to beginCompilation() in Compiler)
    boolean mustResolvePattern = this.pattern.mustResolve;
    boolean mustResolve = mustResolvePattern;
    this.patternLocator.mayBeGeneric = this.options.sourceLevel >= ClassFileConstants.JDK1_5;
    boolean bindingsWereCreated = mustResolve;
    try {
        for (int i = start, maxUnits = start + length; i < maxUnits; i++) {
            PossibleMatch possibleMatch = possibleMatches[i];
            // GROOVY start
            if (isInterestingProject
                    && LanguageSupportFactory.isInterestingSourceFile(possibleMatch.document.getPath())) {
                boolean matchPerformed = LanguageSupportFactory.maybePerformDelegatedSearch(possibleMatch,
                        this.pattern, this.requestor);
                if (matchPerformed) {
                    alreadyMatched.add(possibleMatch);
                }
            }
            // GROOVY end
            try {
                if (!parseAndBuildBindings(possibleMatch, mustResolvePattern))
                    continue;
                // Currently we only need to resolve over pattern flag if there's potential parameterized types
                if (this.patternLocator.mayBeGeneric) {
                    // If pattern does not resolve then rely on possible match node set resolution
                    // which may have been modified while locator was adding possible matches to it
                    if (!mustResolvePattern && !mustResolve) {
                        mustResolve = possibleMatch.nodeSet.mustResolve;
                        bindingsWereCreated = mustResolve;
                    }
                } else {
                    // Reset matching node resolution with pattern one if there's no potential parameterized type
                    // to minimize side effect on previous search behavior
                    possibleMatch.nodeSet.mustResolve = mustResolvePattern;
                }
                // possible match node resolution has been merged with pattern one, so rely on it to know
                // whether we need to process compilation unit now or later
                if (!possibleMatch.nodeSet.mustResolve) {
                    if (this.progressMonitor != null) {
                        this.progressWorked++;
                        if ((this.progressWorked % this.progressStep) == 0)
                            this.progressMonitor.worked(this.progressStep);
                    }
                    process(possibleMatch, bindingsWereCreated);
                    if (this.numberOfMatches > 0
                            && this.matchesToProcess[this.numberOfMatches - 1] == possibleMatch) {
                        // forget last possible match as it was processed
                        this.numberOfMatches--;
                    }
                }
            } finally {
                if (possibleMatch.hasSimilarMatch()) {
                    // If there is similar match, then also process it
                    // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=211872
                    possibleMatches[i] = possibleMatch.getSimilarMatch();
                    i--;
                }
                if (!possibleMatch.nodeSet.mustResolve)
                    possibleMatch.cleanUp();
            }
        }
        if (mustResolve)
            this.lookupEnvironment.completeTypeBindings();

        // create hierarchy resolver if needed
        IType focusType = getFocusType();
        if (focusType == null) {
            this.hierarchyResolver = null;
        } else if (!createHierarchyResolver(focusType, possibleMatches)) {
            // focus type is not visible, use the super type names instead of the bindings
            if (computeSuperTypeNames(focusType) == null)
                return;
        }
    } catch (AbortCompilation e) {
        bindingsWereCreated = false;
    }

    if (!mustResolve) {
        return;
    }

    // possible match resolution
    for (int i = 0; i < this.numberOfMatches; i++) {
        if (this.progressMonitor != null && this.progressMonitor.isCanceled())
            throw new OperationCanceledException();
        PossibleMatch possibleMatch = this.matchesToProcess[i];
        this.matchesToProcess[i] = null; // release reference to processed possible match
        try {
            process(possibleMatch, bindingsWereCreated);
        } catch (AbortCompilation e) {
            // problem with class path: it could not find base classes
            // continue and try next matching openable reporting innacurate matches (since bindings will be null)
            bindingsWereCreated = false;
        } catch (JavaModelException e) {
            // problem with class path: it could not find base classes
            // continue and try next matching openable reporting innacurate matches (since bindings will be null)
            bindingsWereCreated = false;
        } finally {
            if (this.progressMonitor != null) {
                this.progressWorked++;
                if ((this.progressWorked % this.progressStep) == 0)
                    this.progressMonitor.worked(this.progressStep);
            }
            if (this.options.verbose)
                System.out.println(Messages.bind(Messages.compilation_done,
                        new String[] { String.valueOf(i + 1), String.valueOf(this.numberOfMatches),
                                new String(possibleMatch.parsedUnit.getFileName()) }));
            // cleanup compilation unit result
            // GROOVY Start
            // delay cleanup of groovy possible matches until later
            // the clean up will null-out back pointers to scopes used by other CompilationUnitDeclarations
            // old
            // possibleMatch.cleanUp();
            // new
            if (!alreadyMatched.contains(possibleMatch)) {
                possibleMatch.cleanUp();
            }
            // GROOVY End
        }
    }
    // GROOVY Start
    // now do the clean up of groovy matches
    for (Iterator iterator = alreadyMatched.iterator(); iterator.hasNext();) {
        PossibleMatch match = (PossibleMatch) iterator.next();
        match.cleanUp();
    }
    // GROOVY End      
}