Search in sources :

Example 1 with InternalCompletionContext

use of org.eclipse.jdt.internal.codeassist.InternalCompletionContext in project lombok by rzwitserloot.

the class PatchExtensionMethodCompletionProposal method getClassScope.

private static ClassScope getClassScope(CompletionProposalCollector completionProposalCollector) {
    ClassScope scope = null;
    try {
        InternalCompletionContext context = (InternalCompletionContext) Reflection.contextField.get(completionProposalCollector);
        InternalExtendedCompletionContext extendedContext = (InternalExtendedCompletionContext) Reflection.extendedContextField.get(context);
        if (extendedContext != null) {
            Scope assistScope = ((Scope) Reflection.assistScopeField.get(extendedContext));
            if (assistScope != null) {
                scope = assistScope.classScope();
            }
        }
    } catch (IllegalAccessException ignore) {
    // ignore
    }
    return scope;
}
Also used : InternalCompletionContext(org.eclipse.jdt.internal.codeassist.InternalCompletionContext) ClassScope(org.eclipse.jdt.internal.compiler.lookup.ClassScope) Scope(org.eclipse.jdt.internal.compiler.lookup.Scope) InternalExtendedCompletionContext(org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext) ClassScope(org.eclipse.jdt.internal.compiler.lookup.ClassScope)

Example 2 with InternalCompletionContext

use of org.eclipse.jdt.internal.codeassist.InternalCompletionContext in project lombok by rzwitserloot.

the class PatchExtensionMethodCompletionProposal method copyNameLookupAndCompletionEngine.

private static void copyNameLookupAndCompletionEngine(CompletionProposalCollector completionProposalCollector, IJavaCompletionProposal proposal, InternalCompletionProposal newProposal) {
    try {
        InternalCompletionContext context = (InternalCompletionContext) Reflection.contextField.get(completionProposalCollector);
        InternalExtendedCompletionContext extendedContext = (InternalExtendedCompletionContext) Reflection.extendedContextField.get(context);
        LookupEnvironment lookupEnvironment = (LookupEnvironment) Reflection.lookupEnvironmentField.get(extendedContext);
        Reflection.nameLookupField.set(newProposal, ((SearchableEnvironment) lookupEnvironment.nameEnvironment).nameLookup);
        Reflection.completionEngineField.set(newProposal, lookupEnvironment.typeRequestor);
    } catch (IllegalAccessException ignore) {
    // ignore
    }
}
Also used : LookupEnvironment(org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment) InternalCompletionContext(org.eclipse.jdt.internal.codeassist.InternalCompletionContext) InternalExtendedCompletionContext(org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext)

Example 3 with InternalCompletionContext

use of org.eclipse.jdt.internal.codeassist.InternalCompletionContext in project lombok by rzwitserloot.

the class PatchExtensionMethodCompletionProposal method getAssistNode.

private static ASTNode getAssistNode(CompletionProposalCollector completionProposalCollector) {
    try {
        InternalCompletionContext context = (InternalCompletionContext) Reflection.contextField.get(completionProposalCollector);
        InternalExtendedCompletionContext extendedContext = (InternalExtendedCompletionContext) Reflection.extendedContextField.get(context);
        if (extendedContext == null)
            return null;
        return (ASTNode) Reflection.assistNodeField.get(extendedContext);
    } catch (Exception ignore) {
        return null;
    }
}
Also used : InternalCompletionContext(org.eclipse.jdt.internal.codeassist.InternalCompletionContext) InternalExtendedCompletionContext(org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext) ASTNode(org.eclipse.jdt.internal.compiler.ast.ASTNode)

Aggregations

InternalCompletionContext (org.eclipse.jdt.internal.codeassist.InternalCompletionContext)3 InternalExtendedCompletionContext (org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext)3 ASTNode (org.eclipse.jdt.internal.compiler.ast.ASTNode)1 ClassScope (org.eclipse.jdt.internal.compiler.lookup.ClassScope)1 LookupEnvironment (org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment)1 Scope (org.eclipse.jdt.internal.compiler.lookup.Scope)1