Example usage for org.eclipse.jdt.internal.codeassist.select SelectionParser SelectionParser

List of usage examples for org.eclipse.jdt.internal.codeassist.select SelectionParser SelectionParser

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.codeassist.select SelectionParser SelectionParser.

Prototype

public SelectionParser(ProblemReporter problemReporter) 

Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.codeassist.SelectionEngine.java

License:Open Source License

/**
 * The SelectionEngine is responsible for computing the selected object.
 *
 * It requires a searchable name environment, which supports some
 * specific search APIs, and a requestor to feed back the results to a UI.
 *
 *  @param nameEnvironment org.eclipse.jdt.internal.core.SearchableEnvironment
 *      used to resolve type/package references and search for types/packages
 *      based on partial names./*  w  ww . jav  a2  s .co m*/
 *
 *  @param requestor org.eclipse.jdt.internal.codeassist.ISelectionRequestor
 *      since the engine might produce answers of various forms, the engine
 *      is associated with a requestor able to accept all possible completions.
 *
 *  @param settings java.util.Map
 *      set of options used to configure the code assist engine.
 */
public SelectionEngine(SearchableEnvironment nameEnvironment, ISelectionRequestor requestor, Map settings,
        WorkingCopyOwner owner, IndexManager indexManager, JavaProject javaProject) {

    super(settings);

    this.requestor = requestor;
    this.indexManager = indexManager;
    this.javaProject = javaProject;
    this.nameEnvironment = nameEnvironment;

    ProblemReporter problemReporter = new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(),
            this.compilerOptions, new DefaultProblemFactory(Locale.getDefault())) {

        public CategorizedProblem createProblem(char[] fileName, int problemId, String[] problemArguments,
                String[] messageArguments, int severity, int problemStartPosition, int problemEndPosition,
                int lineNumber, int columnNumber) {
            CategorizedProblem pb = super.createProblem(fileName, problemId, problemArguments, messageArguments,
                    severity, problemStartPosition, problemEndPosition, lineNumber, columnNumber);
            if (SelectionEngine.this.problem == null && pb.isError() && (pb.getID() & IProblem.Syntax) == 0) {
                SelectionEngine.this.problem = pb;
            }

            return pb;
        }
    };
    this.lookupEnvironment = new LookupEnvironment(this, this.compilerOptions, problemReporter,
            nameEnvironment);
    this.parser = new SelectionParser(problemReporter);
    this.owner = owner;
}