Class CompletionEngine

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.codeassist.impl.Engine
org.aspectj.org.eclipse.jdt.internal.codeassist.CompletionEngine
All Implemented Interfaces:
ISearchRequestor, RelevanceConstants, ITypeRequestor, TypeConstants, TerminalTokens, SuffixConstants

public final class CompletionEngine extends Engine implements ISearchRequestor, TypeConstants, TerminalTokens, RelevanceConstants, SuffixConstants
This class is the entry point for source completions. It contains two public APIs used to call CodeAssist on a given source with a given environment, assisting position and storage (and possibly options).
  • Field Details

    • typeCache

      public HashtableOfObject typeCache
    • openedBinaryTypes

      public int openedBinaryTypes
    • DEBUG

      public static boolean DEBUG
    • PERF

      public static boolean PERF
    • NO_TYPE_COMPLETION_ON_EMPTY_TOKEN

      public static final boolean NO_TYPE_COMPLETION_ON_EMPTY_TOKEN
      See Also:
      Constant Field Values
  • Constructor Details

    • CompletionEngine

      public CompletionEngine(SearchableEnvironment nameEnvironment, CompletionRequestor requestor, Map settings, IJavaProject javaProject, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor)
      The CompletionEngine is responsible for computing source completions. It requires a searchable name environment, which supports some specific search APIs, and a requestor to feed back the results to a UI.
      Parameters:
      nameEnvironment - org.aspectj.org.eclipse.jdt.internal.codeassist.ISearchableNameEnvironment used to resolve type/package references and search for types/packages based on partial names.
      requestor - org.aspectj.org.eclipse.jdt.internal.codeassist.ICompletionRequestor since the engine might produce answers of various forms, the engine is associated with a requestor able to accept all possible completions.
      settings - java.util.Map set of options used to configure the code assist engine.
  • Method Details

    • createBindingKey

      public static char[] createBindingKey(char[] packageName, char[] typeName)
    • createDefaultParameterNames

      public static char[][] createDefaultParameterNames(int length)
    • createMethodSignature

      public static char[] createMethodSignature(char[][] parameterPackageNames, char[][] parameterTypeNames, char[] returnTypeSignature)
    • createMethodSignature

      public static char[] createMethodSignature(char[][] parameterPackageNames, char[][] parameterTypeNames, char[] returnPackagename, char[] returnTypeName)
    • createNonGenericTypeSignature

      public static char[] createNonGenericTypeSignature(char[] qualifiedPackageName, char[] qualifiedTypeName)
    • createTypeSignature

      public static char[] createTypeSignature(char[] qualifiedPackageName, char[] qualifiedTypeName)
    • accept

      public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction)
      Description copied from class: Engine
      Add an additional compilation unit.
      Specified by:
      accept in interface ITypeRequestor
      Overrides:
      accept in class Engine
    • acceptConstructor

      public void acceptConstructor(int modifiers, char[] simpleTypeName, int parameterCount, char[] signature, char[][] parameterTypes, char[][] parameterNames, int typeModifiers, char[] packageName, int extraFlags, String path, AccessRestriction accessRestriction)
      Specified by:
      acceptConstructor in interface ISearchRequestor
    • acceptModule

      public void acceptModule(char[] moduleName)
      One result of the search consists of a new module. NOTE - All module names are presented in their readable form: Module names are in the form "a.b.c". The default module is represented by an empty array.
      Specified by:
      acceptModule in interface ISearchRequestor
    • acceptPackage

      public void acceptPackage(char[] packageName)
      Description copied from interface: ISearchRequestor
      One result of the search consists of a new package. NOTE - All package names are presented in their readable form: Package names are in the form "a.b.c". The default package is represented by an empty array.
      Specified by:
      acceptPackage in interface ISearchRequestor
    • acceptType

      public void acceptType(char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, int modifiers, AccessRestriction accessRestriction)
      Description copied from interface: ISearchRequestor
      One result of the search consists of a new type. NOTE - All package and type names are presented in their readable form: Package names are in the form "a.b.c". Nested type names are in the qualified form "A.I". The default package is represented by an empty array.
      Specified by:
      acceptType in interface ISearchRequestor
    • acceptUnresolvedName

      public void acceptUnresolvedName(char[] name)
    • complete

      public void complete(ICompilationUnit sourceUnit, int completionPosition, int pos, ITypeRoot root)
      Ask the engine to compute a completion at the specified position of the given compilation unit. No return completion results are answered through a requestor.
      Parameters:
      sourceUnit - org.aspectj.org.eclipse.jdt.internal.compiler.env.ICompilationUnit the source of the current compilation unit.
      completionPosition - int a position in the source where the completion is taking place. This position is relative to the source provided.
    • complete

      public void complete(IType type, char[] snippet, int position, char[][] localVariableTypeNames, char[][] localVariableNames, int[] localVariableModifiers, boolean isStatic)
    • createProposal

      protected InternalCompletionProposal createProposal(int kind, int completionOffset)
    • findFieldsAndMethods

      protected void findFieldsAndMethods(char[] token, TypeBinding receiverType, Scope scope, ObjectVector fieldsFound, ObjectVector methodsFound, InvocationSite invocationSite, Scope invocationScope, boolean implicitCall, boolean superCall, Binding[] missingElements, int[] missingElementsStarts, int[] missingElementsEnds, boolean missingElementsHaveProblems, char[] castedReceiver, int receiverStart, int receiverEnd)
    • findFieldsAndMethodsFromAnotherReceiver

      protected void findFieldsAndMethodsFromAnotherReceiver(char[] token, TypeReference receiverType, Scope scope, ObjectVector fieldsFound, ObjectVector methodsFound, InvocationSite invocationSite, Scope invocationScope, boolean implicitCall, boolean superCall, Binding[] missingElements, int[] missingElementsStarts, int[] missingElementsEnds, boolean missingElementsHaveProblems, char[][] receiverName, int receiverStart, int receiverEnd)
    • findMembers

      protected void findMembers(char[] token, ReferenceBinding receiverType, Scope scope, InvocationSite invocationSite, boolean isInsideAnnotationAttribute, Binding[] missingElements, int[] missingElementsStarts, int[] missingElementsEnds, boolean missingElementsHaveProblems)
    • findMemberTypes

      protected void findMemberTypes(char[] typeName, ReferenceBinding receiverType, Scope scope, SourceTypeBinding typeInvocation, boolean staticOnly, boolean staticFieldsAndMethodOnly, ObjectVector typesFound, Binding[] missingElements, int[] missingElementsStarts, int[] missingElementsEnds, boolean missingElementsHaveProblems)
    • getParser

      public AssistParser getParser()
      Specified by:
      getParser in class Engine
    • hasArrayTypeAsExpectedSuperTypes

      protected boolean hasArrayTypeAsExpectedSuperTypes()
    • hasPossibleAnnotationTarget

      protected boolean hasPossibleAnnotationTarget(TypeBinding typeBinding, Scope scope)
    • printDebug

      protected void printDebug(CategorizedProblem error)
    • printDebug

      protected void printDebug(CompletionProposal proposal)
    • reset

      protected void reset()