mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+1
-13
@@ -32,7 +32,6 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.rt.debugger.DefaultMethodInvoker;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.sun.jdi.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -127,18 +126,7 @@ public class MethodEvaluator implements Evaluator {
|
||||
final String methodName = DebuggerUtilsEx.methodName(referenceType.name(), myMethodName, signature);
|
||||
if (isInvokableType(object)) {
|
||||
if (isInvokableType(referenceType)) {
|
||||
Method jdiMethod;
|
||||
if (signature != null) {
|
||||
if (referenceType instanceof ClassType) {
|
||||
jdiMethod = ((ClassType)referenceType).concreteMethodByName(myMethodName, signature);
|
||||
}
|
||||
else {
|
||||
jdiMethod = ContainerUtil.getFirstItem(referenceType.methodsByName(myMethodName, signature));
|
||||
}
|
||||
}
|
||||
else {
|
||||
jdiMethod = ContainerUtil.getFirstItem(referenceType.methodsByName(myMethodName));
|
||||
}
|
||||
Method jdiMethod = DebuggerUtils.findMethod(referenceType, myMethodName, signature);
|
||||
if (jdiMethod != null && jdiMethod.isStatic()) {
|
||||
if (referenceType instanceof ClassType) {
|
||||
return debugProcess.invokeMethod(context, (ClassType)referenceType, jdiMethod, args);
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.sun.jdi.*;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -149,7 +150,7 @@ public abstract class DebuggerUtils {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Method findMethod(@NotNull ReferenceType refType, @NonNls String methodName, @NonNls String methodSignature) {
|
||||
public static Method findMethod(@NotNull ReferenceType refType, @NonNls String methodName, @Nullable @NonNls String methodSignature) {
|
||||
if (refType instanceof ArrayType) {
|
||||
// for array types methodByName() in JDI always returns empty list
|
||||
final Method method = findMethod(refType.virtualMachine().classesByName(CommonClassNames.JAVA_LANG_OBJECT).get(0), methodName, methodSignature);
|
||||
@@ -164,20 +165,11 @@ public abstract class DebuggerUtils {
|
||||
method = ((ClassType)refType).concreteMethodByName(methodName, methodSignature);
|
||||
}
|
||||
if (method == null) {
|
||||
final List<Method> methods = refType.methodsByName(methodName, methodSignature);
|
||||
if (methods.size() > 0) {
|
||||
method = methods.get(0);
|
||||
}
|
||||
method = ContainerUtil.getFirstItem(refType.methodsByName(methodName, methodSignature));
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<Method> methods = null;
|
||||
if (refType instanceof ClassType) {
|
||||
methods = refType.methodsByName(methodName);
|
||||
}
|
||||
if (methods != null && methods.size() > 0) {
|
||||
method = methods.get(0);
|
||||
}
|
||||
method = ContainerUtil.getFirstItem(refType.methodsByName(methodName));
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,20 +21,16 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: ik
|
||||
* Date: 03.04.2003
|
||||
* Time: 11:22:05
|
||||
*
|
||||
* @see com.intellij.psi.ElementManipulators
|
||||
* @see AbstractElementManipulator
|
||||
* @see ElementManipulators
|
||||
*/
|
||||
public interface ElementManipulator<T extends PsiElement> {
|
||||
|
||||
/**
|
||||
* Changes the element's text to a new value
|
||||
* Changes the element's text to the given new text.
|
||||
*
|
||||
* @param element element to be changed
|
||||
* @param range range within the element
|
||||
* @param element element to be changed
|
||||
* @param range range within the element
|
||||
* @param newContent new element text
|
||||
* @return changed element
|
||||
* @throws IncorrectOperationException if something goes wrong
|
||||
|
||||
@@ -158,8 +158,16 @@ public abstract class Promise<T> {
|
||||
|
||||
@SuppressWarnings("ExceptionClassNameDoesntEndWithException")
|
||||
public static class MessageError extends RuntimeException {
|
||||
private final boolean log;
|
||||
|
||||
public MessageError(@NotNull String error) {
|
||||
this(error, false);
|
||||
}
|
||||
|
||||
public MessageError(@NotNull String error, boolean log) {
|
||||
super(error);
|
||||
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -174,7 +182,7 @@ public abstract class Promise<T> {
|
||||
*/
|
||||
public static void logError(@NotNull Logger logger, @NotNull Throwable e) {
|
||||
if (!(e instanceof ProcessCanceledException) &&
|
||||
(!(e instanceof MessageError) || ApplicationManager.getApplication().isUnitTestMode())) {
|
||||
(!(e instanceof MessageError) || ((MessageError)e).log || ApplicationManager.getApplication().isUnitTestMode())) {
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -118,11 +118,11 @@ public class UpdateCheckerComponent implements ApplicationComponent {
|
||||
app.getMessageBus().connect(app).subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
|
||||
@Override
|
||||
public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) {
|
||||
String currentBuild = ApplicationInfo.getInstance().getBuild().asString();
|
||||
BuildNumber currentBuild = ApplicationInfo.getInstance().getBuild();
|
||||
BuildNumber lastBuildChecked = BuildNumber.fromString(mySettings.getLasBuildChecked());
|
||||
long timeToNextCheck = mySettings.getLastTimeChecked() + CHECK_INTERVAL - System.currentTimeMillis();
|
||||
|
||||
if (BuildNumber.fromString(mySettings.getLasBuildChecked()).compareTo(BuildNumber.fromString(currentBuild)) < 0 ||
|
||||
timeToNextCheck <= 0) {
|
||||
if (lastBuildChecked == null || currentBuild.compareTo(lastBuildChecked) > 0 || timeToNextCheck <= 0) {
|
||||
myCheckRunnable.run();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -34,9 +34,7 @@ abstract class ObsolescentConsumer<T>(private val obsolescent: Obsolescent) : Ob
|
||||
}
|
||||
|
||||
|
||||
inline fun <T, SUB_RESULT> Promise<T>.then(crossinline handler: (T) -> SUB_RESULT) = then(object : Function<T, SUB_RESULT> {
|
||||
override fun `fun`(param: T) = handler(param)
|
||||
})
|
||||
inline fun <T, SUB_RESULT> Promise<T>.then(crossinline handler: (T) -> SUB_RESULT) = then(Function<T, SUB_RESULT> { param -> handler(param) })
|
||||
|
||||
inline fun <T, SUB_RESULT> Promise<T>.then(obsolescent: Obsolescent, crossinline handler: (T) -> SUB_RESULT) = then(object : ObsolescentFunction<T, SUB_RESULT> {
|
||||
override fun `fun`(param: T) = handler(param)
|
||||
@@ -50,9 +48,7 @@ inline fun <T> Promise<T>.done(node: Obsolescent, crossinline handler: (T) -> Un
|
||||
})
|
||||
|
||||
|
||||
inline fun <T, SUB_RESULT> Promise<T>.thenAsync(crossinline handler: (T) -> Promise<SUB_RESULT>) = then(object : AsyncFunction<T, SUB_RESULT> {
|
||||
override fun `fun`(param: T) = handler(param)
|
||||
})
|
||||
inline fun <T, SUB_RESULT> Promise<T>.thenAsync(crossinline handler: (T) -> Promise<SUB_RESULT>) = then(AsyncFunction<T, SUB_RESULT> { param -> handler(param) })
|
||||
|
||||
inline fun <T, SUB_RESULT> Promise<T>.thenAsync(node: Obsolescent, crossinline handler: (T) -> Promise<SUB_RESULT>) = then(object : ValueNodeAsyncFunction<T, SUB_RESULT>(node) {
|
||||
override fun `fun`(param: T) = handler(param)
|
||||
@@ -110,4 +106,6 @@ fun <T> collectResults(promises: List<Promise<T>>): Promise<List<T>> {
|
||||
promise.done { results.add(it) }
|
||||
}
|
||||
return Promise.all(promises, results)
|
||||
}
|
||||
}
|
||||
|
||||
fun createError(error: String, log: Boolean = false): RuntimeException = Promise.MessageError(error, log)
|
||||
@@ -106,13 +106,19 @@ action.EditorMoveDownAndScroll.text=Move Down and Scroll
|
||||
action.EditorMoveUpAndScrollWithSelection.text=Move Up and Scroll with Selection
|
||||
action.EditorMoveDownAndScrollWithSelection.text=Move Down and Scroll with Selection
|
||||
action.EditorAddOrRemoveCaret.text=Add or Remove Caret
|
||||
action.EditorAddOrRemoveCaret.description=Set multiple cursors in the current file to edit multiple lines of code simultaneously.
|
||||
action.EditorCreateRectangularSelection.text=Create Rectangular Selection
|
||||
action.EditorAddRectangularSelectionOnMouseDrag.text=Add Rectangular Selection on Mouse Drag
|
||||
action.EditorCloneCaretBelow.text=Clone Caret Below
|
||||
action.EditorCloneCaretBelow.description=Insert a secondary cursor in the line below to edit multiple lines of code simultaneously.
|
||||
action.EditorCloneCaretAbove.text=Clone Caret Above
|
||||
action.EditorCloneCaretAbove.description=Insert a secondary cursor in the line above to edit multiple lines of code simultaneously.
|
||||
action.SelectNextOccurrence.text=Add Selection for Next Occurrence
|
||||
action.SelectNextOccurrence.description=Set multiple cursors by adding the next occurrence of the current word to the selection.
|
||||
action.SelectAllOccurrences.text=Select All Occurrences
|
||||
action.SelectAllOccurrences.description=Set multiple cursors by adding all occurrences of the current word to the selection.
|
||||
action.UnselectPreviousOccurrence.text=Unselect Occurrence
|
||||
action.UnselectPreviousOccurrence.description=Remove the current occurrence of the word from the selection.
|
||||
action.EditorToggleStickySelection.text=Toggle Sticky Selection
|
||||
action.EditorSwapSelectionBoundaries.text=Swap selection boundaries
|
||||
action.EditorLineStart.text=Move Caret to Line Start
|
||||
|
||||
@@ -269,7 +269,7 @@ internal class DomainGenerator(val generator: Generator, val domain: ProtocolMet
|
||||
if (description != null) {
|
||||
out.doc(description)
|
||||
}
|
||||
out.append("@JsonType").newLine()
|
||||
// out.append("@JsonType").newLine()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ internal class InputClassScope(generator: DomainGenerator, namePath: NamePath) :
|
||||
addMember { out ->
|
||||
out.newLine().newLine().doc(description)
|
||||
if (properties == null) {
|
||||
out.append("@JsonType(allowsOtherProperties=true)").newLine()
|
||||
out.append("interface ").append(objectName).append(" : JsonObjectBased").openBlock()
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -22,7 +22,7 @@ annotation class JsonField(
|
||||
val primitiveValue: String = "")
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class JsonType(val allowsOtherProperties: Boolean = false)
|
||||
annotation class JsonType()
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class JsonSubtypeCasting(val reinterpret: Boolean = false)
|
||||
|
||||
+5
-1
@@ -71,7 +71,11 @@ open class OutMessage() {
|
||||
writer.endArray()
|
||||
}
|
||||
|
||||
fun writeIntArray(name: String, value: IntArray) {
|
||||
fun writeIntArray(name: String, value: IntArray? = null) {
|
||||
if (value == null) {
|
||||
return
|
||||
}
|
||||
|
||||
beginArguments()
|
||||
writer.name(name)
|
||||
writer.beginArray()
|
||||
|
||||
@@ -79,7 +79,7 @@ internal class FieldProcessor(private val reader: InterfaceReader, typeClass: Cl
|
||||
methodHandler = createMethodHandler(member, method, skippedNames.contains(method.name)) ?: continue
|
||||
}
|
||||
else {
|
||||
methodHandler = processManualSubtypeMethod(method, jsonSubtypeCaseAnnotation)
|
||||
methodHandler = processManualSubtypeMethod(member, method, jsonSubtypeCaseAnnotation)
|
||||
lazyRead = true
|
||||
}
|
||||
methodHandlerMap.put(method, methodHandler)
|
||||
@@ -109,7 +109,7 @@ internal class FieldProcessor(private val reader: InterfaceReader, typeClass: Cl
|
||||
}
|
||||
}
|
||||
|
||||
val fieldTypeParser = reader.getFieldTypeParser(genericReturnType, false, method)
|
||||
val fieldTypeParser = reader.getFieldTypeParser(member, genericReturnType, false, method)
|
||||
val isProperty = member is KProperty<*>
|
||||
val isAsImpl = isProperty && !isNotNull
|
||||
if (fieldTypeParser != VOID_PARSER) {
|
||||
@@ -154,18 +154,17 @@ internal class FieldProcessor(private val reader: InterfaceReader, typeClass: Cl
|
||||
}
|
||||
}
|
||||
|
||||
private fun processManualSubtypeMethod(m: Method, jsonSubtypeCaseAnn: JsonSubtypeCasting): MethodHandler {
|
||||
val fieldTypeParser = reader.getFieldTypeParser(m.genericReturnType, !jsonSubtypeCaseAnn.reinterpret, null)
|
||||
private fun processManualSubtypeMethod(member: KCallable<*>, m: Method, jsonSubtypeCaseAnn: JsonSubtypeCasting): MethodHandler {
|
||||
val fieldTypeParser = reader.getFieldTypeParser(member, m.genericReturnType, !jsonSubtypeCaseAnn.reinterpret, null)
|
||||
val fieldInfo = allocateVolatileField(fieldTypeParser, true)
|
||||
val handler = LazyCachedMethodHandler(fieldTypeParser, fieldInfo)
|
||||
val parserAsObjectValueParser = fieldTypeParser.asJsonTypeParser()
|
||||
if (parserAsObjectValueParser != null && parserAsObjectValueParser.isSubtyping()) {
|
||||
val subtypeCaster = object : SubtypeCaster(parserAsObjectValueParser.type) {
|
||||
reader.subtypeCasters.add(object : SubtypeCaster(parserAsObjectValueParser.type) {
|
||||
override fun writeJava(out: TextOutput) {
|
||||
out.append(m.name).append("()")
|
||||
}
|
||||
}
|
||||
reader.subtypeCasters.add(subtypeCaster)
|
||||
})
|
||||
}
|
||||
return handler
|
||||
}
|
||||
@@ -186,3 +185,13 @@ internal class FieldProcessor(private val reader: InterfaceReader, typeClass: Cl
|
||||
}
|
||||
|
||||
internal inline fun <reified T : Annotation> KCallable<*>.annotation(): T? = annotations.firstOrNull() { it is T } as? T ?: (this as? KFunction<*>)?.javaMethod?.getAnnotation<T>(T::class.java)
|
||||
|
||||
/**
|
||||
* An internal facility for navigating from object of base type to object of subtype. Used only
|
||||
* when user wants to parse JSON object as subtype.
|
||||
*/
|
||||
internal abstract class SubtypeCaster(private val subtypeRef: TypeRef<*>) {
|
||||
abstract fun writeJava(out: TextOutput)
|
||||
|
||||
fun getSubtypeHandler() = subtypeRef.type!!
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import java.lang.reflect.ParameterizedType
|
||||
import java.lang.reflect.Type
|
||||
import java.lang.reflect.WildcardType
|
||||
import java.util.*
|
||||
import kotlin.reflect.KCallable
|
||||
|
||||
internal fun InterfaceReader(protocolInterfaces: List<Class<*>>): InterfaceReader {
|
||||
val map = LinkedHashMap<Class<*>, TypeWriter<*>?>(protocolInterfaces.size)
|
||||
@@ -132,7 +133,7 @@ internal class InterfaceReader(val typeToTypeHandler: LinkedHashMap<Class<*>, Ty
|
||||
typeToTypeHandler.put(typeClass, typeWriter)
|
||||
}
|
||||
|
||||
fun getFieldTypeParser(type: Type, isSubtyping: Boolean, method: Method?): ValueReader {
|
||||
fun getFieldTypeParser(member: KCallable<*>?, type: Type, isSubtyping: Boolean, method: Method?): ValueReader {
|
||||
if (type is Class<*>) {
|
||||
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
|
||||
return when {
|
||||
@@ -144,7 +145,7 @@ internal class InterfaceReader(val typeToTypeHandler: LinkedHashMap<Class<*>, Ty
|
||||
type == Void.TYPE -> VOID_PARSER
|
||||
type == String::class.java -> {
|
||||
if (method != null) {
|
||||
val jsonField = method.getAnnotation<JsonField>(JsonField::class.java)
|
||||
val jsonField = member?.annotation<JsonField>()
|
||||
if (jsonField != null && jsonField.allowAnyPrimitiveValue) {
|
||||
return RAW_STRING_PARSER
|
||||
}
|
||||
@@ -157,7 +158,7 @@ internal class InterfaceReader(val typeToTypeHandler: LinkedHashMap<Class<*>, Ty
|
||||
type == Any::class.java -> RAW_STRING_OR_MAP_PARSER
|
||||
type == JsonReaderEx::class.java -> JSON_PARSER
|
||||
type == StringIntPair::class.java -> STRING_INT_PAIR_PARSER
|
||||
type.isArray -> ArrayReader(getFieldTypeParser(type.componentType, false, null), false)
|
||||
type.isArray -> ArrayReader(getFieldTypeParser(null, type.componentType, false, null), false)
|
||||
type.isEnum -> EnumReader(type as Class<Enum<*>>)
|
||||
else -> {
|
||||
val ref = getTypeRef(type) ?: throw UnsupportedOperationException("Method return type $type (simple class) not supported")
|
||||
@@ -175,7 +176,7 @@ internal class InterfaceReader(val typeToTypeHandler: LinkedHashMap<Class<*>, Ty
|
||||
argumentType = wildcard.upperBounds[0]
|
||||
}
|
||||
}
|
||||
val componentParser = getFieldTypeParser(argumentType, false, method)
|
||||
val componentParser = getFieldTypeParser(null, argumentType, false, method)
|
||||
return if (isList) ArrayReader(componentParser, true) else MapReader(componentParser)
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package org.jetbrains.protocolReader
|
||||
|
||||
/**
|
||||
* An internal facility for navigating from object of base type to object of subtype. Used only
|
||||
* when user wants to parse JSON object as subtype.
|
||||
*/
|
||||
internal abstract class SubtypeCaster(private val subtypeRef: TypeRef<*>) {
|
||||
abstract fun writeJava(out: TextOutput)
|
||||
|
||||
fun getSubtypeHandler() = subtypeRef.type!!
|
||||
}
|
||||
@@ -186,9 +186,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
|
||||
public AbstractVcs findVcsByName(String name) {
|
||||
if (name == null) return null;
|
||||
AbstractVcs result = myProject.isDisposed() ? null : AllVcses.getInstance(myProject).getByName(name);
|
||||
if (result == null) {
|
||||
ProgressManager.checkCanceled();
|
||||
}
|
||||
ProgressManager.checkCanceled();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.dgm;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
@@ -27,6 +28,7 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
@@ -42,6 +44,8 @@ public class DGMMemberContributor extends NonCodeMembersContributor {
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull ResolveState state) {
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return;
|
||||
|
||||
final Project project = place.getProject();
|
||||
|
||||
ConcurrentMap<GlobalSearchScope, List<GdkMethodHolder>> map = CachedValuesManager.getManager(project).getCachedValue(
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.jetbrains.plugins.groovy.geb;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
|
||||
@@ -24,7 +25,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethod
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.ClassUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -44,8 +44,7 @@ public class GebPageMemberContributor extends NonCodeMembersContributor {
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) return;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return;
|
||||
|
||||
PsiElement grCall = place.getParent();
|
||||
if (grCall instanceof GrMethodCall) {
|
||||
|
||||
+7
-29
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -169,7 +169,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
|
||||
private abstract static class MyPsiScopeProcessor implements PsiScopeProcessor, NameHint, ClassHint, ElementClassHint {
|
||||
private String myNameHint;
|
||||
private EnumSet<ResolveKind> myResolveTargetKinds;
|
||||
private EnumSet<DeclarationKind> myResolveTargetKinds;
|
||||
|
||||
@Override
|
||||
public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
|
||||
@@ -178,7 +178,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
PsiType type;
|
||||
|
||||
if (element instanceof PsiMethod) {
|
||||
if (!myResolveTargetKinds.contains(ResolveKind.METHOD)) return true;
|
||||
if (!myResolveTargetKinds.contains(DeclarationKind.METHOD)) return true;
|
||||
|
||||
PsiMethod method = (PsiMethod)element;
|
||||
if (!GroovyPropertyUtils.isSimplePropertySetter(method)) return true;
|
||||
@@ -189,7 +189,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
type = method.getParameterList().getParameters()[0].getType();
|
||||
}
|
||||
else {
|
||||
if (!myResolveTargetKinds.contains(ResolveKind.PROPERTY)) return true;
|
||||
if (!myResolveTargetKinds.contains(DeclarationKind.FIELD)) return true;
|
||||
|
||||
type = ((PsiField)element).getType();
|
||||
propertyName = ((PsiField)element).getName();
|
||||
@@ -214,7 +214,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
|
||||
@Override
|
||||
public <T> T getHint(@NotNull Key<T> hintKey) {
|
||||
if ((NameHint.KEY == hintKey && myNameHint != null) || ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) {
|
||||
if (NameHint.KEY == hintKey && myNameHint != null || ElementClassHint.KEY == hintKey) {
|
||||
//noinspection unchecked
|
||||
return (T) this;
|
||||
}
|
||||
@@ -227,31 +227,9 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProcess(ResolveKind resolveKind) {
|
||||
return myResolveTargetKinds.contains(resolveKind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProcess(DeclarationKind kind) {
|
||||
switch (kind) {
|
||||
case CLASS:
|
||||
return shouldProcess(ResolveKind.CLASS);
|
||||
|
||||
case ENUM_CONST:
|
||||
case VARIABLE:
|
||||
case FIELD:
|
||||
return shouldProcess(ResolveKind.PROPERTY);
|
||||
|
||||
case METHOD:
|
||||
return shouldProcess(ResolveKind.METHOD);
|
||||
|
||||
case PACKAGE:
|
||||
return shouldProcess(ResolveKind.PACKAGE);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return myResolveTargetKinds.contains(kind);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,7 +241,7 @@ public class GroovyConstructorNamedArgumentProvider extends GroovyNamedArgumentP
|
||||
myNameHint = nameHint;
|
||||
}
|
||||
|
||||
public void setResolveTargetKinds(EnumSet<ResolveKind> resolveTargetKinds) {
|
||||
public void setResolveTargetKinds(EnumSet<DeclarationKind> resolveTargetKinds) {
|
||||
myResolveTargetKinds = resolveTargetKinds;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
@@ -53,7 +54,6 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.GrPackageDefinitionStub;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.MethodTypeInferencer;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.PackageSkippingProcessor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
@@ -127,7 +127,7 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile {
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
|
||||
if (myContext != null) {
|
||||
if (ResolveUtil.shouldProcessProperties(classHint)) {
|
||||
@@ -225,9 +225,7 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile {
|
||||
final String name = nameHint.getName(state);
|
||||
if (name == null) return true;
|
||||
|
||||
final ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) return true;
|
||||
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
final ConcurrentMap<String, GrBindingVariable> bindings = getBindings();
|
||||
|
||||
@@ -257,7 +255,7 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile {
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (ResolveUtil.shouldProcessClasses(processor.getHint(ClassHint.KEY))) {
|
||||
if (ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) {
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(getPackageName());
|
||||
if (aPackage != null) {
|
||||
return aPackage.processDeclarations(new PackageSkippingProcessor(processor), state, lastParent, place);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -26,7 +27,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatem
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.DefaultImportContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.PackageSkippingProcessor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class GroovyImportHelper {
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull GroovyFile file) {
|
||||
if (!ResolveUtil.shouldProcessClasses(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
JavaPsiFacade facade = JavaPsiFacade.getInstance(file.getProject());
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -30,7 +31,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
@@ -62,7 +62,7 @@ public class GrCatchClauseImpl extends GroovyPsiElementImpl implements GrCatchCl
|
||||
|
||||
@Override
|
||||
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
GrParameter parameter = getParameter();
|
||||
return parameter == null || ResolveUtil.processElement(processor, parameter, state);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -35,7 +36,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.clauses.GrForInClaus
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
/**
|
||||
* @autor: ilyas
|
||||
@@ -71,7 +71,7 @@ public class GrForStatementImpl extends GroovyPsiElementImpl implements GrForSta
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
GrForClause forClause = getClause();
|
||||
final GrVariable varScope = PsiTreeUtil.getParentOfType(place, GrVariable.class);
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.stubs.EmptyStub;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -47,7 +48,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -197,7 +197,7 @@ public class GrVariableDeclarationImpl extends GrStubElementBase<EmptyStub> impl
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
if (lastParent != null && !(getParent() instanceof GrTypeDefinitionBody) && lastParent == getTupleInitializer()) {
|
||||
return true;
|
||||
|
||||
+5
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
@@ -41,10 +42,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.dataFlow.types.TypeInferenceHelper;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GrClosureType;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiManager;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.params.GrParameterListImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.ClosureSyntheticParameter;
|
||||
@@ -53,7 +51,6 @@ import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.MethodTypeInferencer;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyNamesUtil;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
@@ -98,7 +95,7 @@ public class GrClosableBlockImpl extends GrBlockImpl implements GrClosableBlock
|
||||
|
||||
if (!super.processDeclarations(processor, state, lastParent, place)) return false;
|
||||
if (!processParameters(processor, state, place)) return false;
|
||||
if (ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY)) && !ResolveUtil.processElement(processor, getOwner(), state)) return false;
|
||||
if (ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY)) && !ResolveUtil.processElement(processor, getOwner(), state)) return false;
|
||||
if (!processClosureClassMembers(processor, state, lastParent, place)) return false;
|
||||
|
||||
return true;
|
||||
@@ -171,7 +168,7 @@ public class GrClosableBlockImpl extends GrBlockImpl implements GrClosableBlock
|
||||
private boolean processParameters(@NotNull PsiScopeProcessor processor,
|
||||
@NotNull ResolveState state,
|
||||
@NotNull PsiElement place) {
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
if (hasParametersSection()) {
|
||||
for (GrParameter parameter : getParameters()) {
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.intellij.psi.util.PropertyUtil;
|
||||
@@ -163,7 +164,7 @@ public class GrReferenceExpressionImpl extends GrReferenceElementImpl<GrExpressi
|
||||
}
|
||||
|
||||
|
||||
EnumSet<ClassHint.ResolveKind> kinds = getParent() instanceof GrReferenceExpression
|
||||
EnumSet<ElementClassHint.DeclarationKind> kinds = getParent() instanceof GrReferenceExpression
|
||||
? ClassHint.RESOLVE_KINDS_CLASS_PACKAGE
|
||||
: ClassHint.RESOLVE_KINDS_CLASS;
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiManagerEx;
|
||||
import com.intellij.psi.impl.light.LightMethodBuilder;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
@@ -40,7 +41,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUt
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.GrTypeDefinitionStub;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
/**
|
||||
* @author Dmitry.Krasilschikov
|
||||
@@ -119,7 +119,7 @@ public class GrEnumTypeDefinitionImpl extends GrTypeDefinitionImpl implements Gr
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (ResolveUtil.shouldProcessMethods(processor.getHint(ClassHint.KEY))) {
|
||||
if (ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) {
|
||||
final NameHint nameHint = processor.getHint(NameHint.KEY);
|
||||
final String name = nameHint == null ? null : nameHint.getName(state);
|
||||
for (PsiMethod method : getDefEnumMethods()) {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.impl.ElementPresentationUtil;
|
||||
import com.intellij.psi.impl.PsiClassImplUtil;
|
||||
import com.intellij.psi.impl.PsiSuperMethodImplUtil;
|
||||
import com.intellij.psi.presentation.java.JavaPresentationUtil;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
@@ -71,7 +72,6 @@ import org.jetbrains.plugins.groovy.lang.psi.stubs.GrMethodStub;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.MethodTypeInferencer;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
@@ -171,7 +171,7 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase<GrMethodStub> i
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
|
||||
if (ResolveUtil.shouldProcessClasses(classHint)) {
|
||||
for (final GrTypeParameter typeParameter : getTypeParameters()) {
|
||||
|
||||
+7
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.DelegatingScopeProcessor;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.stubs.IStubElementType;
|
||||
@@ -46,6 +47,8 @@ import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.GrDelegatingScopeProcessorWithHints;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_METHOD;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
@@ -160,7 +163,7 @@ public class GrImportStatementImpl extends GrStubElementBase<GrImportStatementSt
|
||||
}
|
||||
}
|
||||
|
||||
if (ResolveUtil.shouldProcessMethods(processor.getHint(ClassHint.KEY))) {
|
||||
if (ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) {
|
||||
if (hintName == null || importedName.equals(GroovyPropertyUtils.getPropertyNameByGetterName(hintName, true))) {
|
||||
if (!clazz.processDeclarations(new StaticGetterProcessor(refName, processor), state, lastParent, place)) {
|
||||
return false;
|
||||
@@ -178,7 +181,7 @@ public class GrImportStatementImpl extends GrStubElementBase<GrImportStatementSt
|
||||
}
|
||||
|
||||
private boolean processSingleClassImport(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state) {
|
||||
if (!ResolveUtil.shouldProcessClasses(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
GrCodeReferenceElement ref = getImportReference();
|
||||
if (ref == null) return true;
|
||||
@@ -226,7 +229,7 @@ public class GrImportStatementImpl extends GrStubElementBase<GrImportStatementSt
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ResolveUtil.shouldProcessClasses(processor.getHint(ClassHint.KEY))) {
|
||||
if (ResolveUtil.shouldProcessClasses(processor.getHint(ElementClassHint.KEY))) {
|
||||
String qName = PsiUtil.getQualifiedReferenceText(ref);
|
||||
if (qName != null) {
|
||||
PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(qName);
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.ResolveCache;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -331,7 +332,7 @@ public class GrCodeReferenceElementImpl extends GrReferenceElementImpl<GrCodeRef
|
||||
break;
|
||||
|
||||
case CLASS: {
|
||||
EnumSet<ClassHint.ResolveKind> kinds = ClassHint.RESOLVE_KINDS_CLASS;
|
||||
EnumSet<ElementClassHint.DeclarationKind> kinds = ClassHint.RESOLVE_KINDS_CLASS;
|
||||
ResolverProcessor processor = new ClassResolverProcessor(refName, ref, kinds);
|
||||
GrCodeReferenceElement qualifier = ref.getQualifier();
|
||||
if (qualifier != null) {
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.RecursionManager;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.DelegatingScopeProcessor;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.*;
|
||||
@@ -90,9 +91,8 @@ public class GdkMethodUtil {
|
||||
}
|
||||
|
||||
public static boolean categoryIteration(GrClosableBlock place, final PsiScopeProcessor processor, ResolveState state) {
|
||||
final ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return true;
|
||||
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
final GrMethodCall call = checkMethodCall(place, USE);
|
||||
if (call == null) return true;
|
||||
|
||||
|
||||
+2
-2
@@ -25,6 +25,7 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiClassImplUtil;
|
||||
import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.*;
|
||||
@@ -59,7 +60,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrScriptField;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.CollectClassMembersUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ast.AstTransformContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -254,7 +254,7 @@ public class GrClassImplUtil {
|
||||
|
||||
NameHint nameHint = processor.getHint(NameHint.KEY);
|
||||
String name = nameHint == null ? null : nameHint.getName(state);
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
final PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY);
|
||||
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(place.getProject());
|
||||
|
||||
|
||||
+7
-6
@@ -19,6 +19,8 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.ElementClassHint.DeclarationKind;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
import com.intellij.psi.util.CachedValuesManager;
|
||||
@@ -29,7 +31,6 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.GrScopeProcessorWithHints;
|
||||
|
||||
import java.util.EnumSet;
|
||||
@@ -50,20 +51,20 @@ class DeclarationCacheKey {
|
||||
}
|
||||
};
|
||||
@Nullable private final String name;
|
||||
@NotNull private final EnumSet<ClassHint.ResolveKind> kinds;
|
||||
@NotNull private final EnumSet<DeclarationKind> kinds;
|
||||
private final boolean nonCode;
|
||||
@NotNull private final PsiElement place;
|
||||
|
||||
DeclarationCacheKey(@Nullable String name, ClassHint hint, boolean nonCode, @NotNull PsiElement place) {
|
||||
DeclarationCacheKey(@Nullable String name, ElementClassHint hint, boolean nonCode, @NotNull PsiElement place) {
|
||||
this.name = name;
|
||||
this.kinds = getResolveKinds(hint);
|
||||
this.nonCode = nonCode;
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
private static EnumSet<ClassHint.ResolveKind> getResolveKinds(ClassHint hint) {
|
||||
EnumSet<ClassHint.ResolveKind> set = EnumSet.noneOf(ClassHint.ResolveKind.class);
|
||||
for (ClassHint.ResolveKind kind : ClassHint.ResolveKind.values()) {
|
||||
private static EnumSet<DeclarationKind> getResolveKinds(ElementClassHint hint) {
|
||||
EnumSet<DeclarationKind> set = EnumSet.noneOf(DeclarationKind.class);
|
||||
for (DeclarationKind kind : DeclarationKind.values()) {
|
||||
if (hint.shouldProcess(kind)) {
|
||||
set.add(kind);
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.resolve;
|
||||
import com.intellij.openapi.util.VolatileNotNullLazyValue;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -61,6 +62,7 @@ public class GdkMethodDslProvider implements GdslMembersProvider {
|
||||
|
||||
@Override
|
||||
public boolean processMembers(GroovyClassDescriptor descriptor, PsiScopeProcessor processor, ResolveState state) {
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
return methodsMap.getValue().processMethods(processor, state, descriptor.getPsiType(), descriptor.getProject());
|
||||
}
|
||||
});
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,8 @@ package org.jetbrains.plugins.groovy.lang.resolve;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.GrDelegatingScopeProcessorWithHints;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_CLASS;
|
||||
|
||||
/**
|
||||
* Created by Max Medvedev on 27/03/14
|
||||
*/
|
||||
|
||||
+16
-11
@@ -22,6 +22,8 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.ElementClassHint.DeclarationKind;
|
||||
import com.intellij.psi.scope.JavaScopeProcessorEvent;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
@@ -73,6 +75,8 @@ import org.jetbrains.plugins.groovy.lang.resolve.processors.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@@ -111,7 +115,7 @@ public class ResolveUtil {
|
||||
boolean processNonCodeMethods,
|
||||
@NotNull final ResolveState state) {
|
||||
try {
|
||||
ClassHint hint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint hint = processor.getHint(ElementClassHint.KEY);
|
||||
if (hint != null) {
|
||||
return new DeclarationCacheKey(getNameHint(processor), hint, processNonCodeMethods, originalPlace).processCachedDeclarations(place, processor);
|
||||
}
|
||||
@@ -239,7 +243,7 @@ public class ResolveUtil {
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place) {
|
||||
if (!shouldProcessProperties(processor.getHint(ClassHint.KEY))) return true;
|
||||
if (!shouldProcessProperties(processor.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
PsiElement run = lastParent == null ? element.getLastChild() : lastParent.getPrevSibling();
|
||||
while (run != null) {
|
||||
@@ -940,27 +944,28 @@ public class ResolveUtil {
|
||||
return expectedParams;
|
||||
}
|
||||
|
||||
public static boolean shouldProcessClasses(ClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.CLASS);
|
||||
public static boolean shouldProcessClasses(ElementClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(DeclarationKind.CLASS);
|
||||
}
|
||||
|
||||
public static boolean shouldProcessMethods(ClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD);
|
||||
public static boolean shouldProcessMethods(ElementClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(DeclarationKind.METHOD);
|
||||
}
|
||||
|
||||
public static boolean shouldProcessProperties(ClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY);
|
||||
public static boolean shouldProcessProperties(ElementClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(DeclarationKind.VARIABLE)
|
||||
|| classHint.shouldProcess(DeclarationKind.FIELD) || classHint.shouldProcess(DeclarationKind.ENUM_CONST);
|
||||
}
|
||||
|
||||
public static boolean shouldProcessPackages(ClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PACKAGE);
|
||||
public static boolean shouldProcessPackages(ElementClassHint classHint) {
|
||||
return classHint == null || classHint.shouldProcess(DeclarationKind.PACKAGE);
|
||||
}
|
||||
|
||||
public static boolean processStaticImports(@NotNull PsiScopeProcessor resolver,
|
||||
@NotNull PsiFile file,
|
||||
@NotNull ResolveState state,
|
||||
@NotNull PsiElement place) {
|
||||
if (!shouldProcessMethods(resolver.getHint(ClassHint.KEY))) return true;
|
||||
if (!shouldProcessMethods(resolver.getHint(ElementClassHint.KEY))) return true;
|
||||
|
||||
return file.processDeclarations(new GrDelegatingScopeProcessorWithHints(resolver, null, ClassHint.RESOLVE_KINDS_METHOD) {
|
||||
@Override
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,8 @@ import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.GrDelegatingScopeProcessorWithHints;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author Maxim.Medvedev
|
||||
*/
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,8 @@ import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatem
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyResolveResultImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
|
||||
/**
|
||||
* @author Maxim.Medvedev
|
||||
*/
|
||||
|
||||
+9
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,27 +18,20 @@ package org.jetbrains.plugins.groovy.lang.resolve.processors;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.scope.ElementClassHint.DeclarationKind;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import static com.intellij.psi.scope.ElementClassHint.DeclarationKind.*;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public interface ClassHint {
|
||||
Key<ClassHint> KEY = Key.create("ClassHint");
|
||||
Key<PsiElement> RESOLVE_CONTEXT = Key.create("RESOLVE_CONTEXT");
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_CLASS_PACKAGE = EnumSet.of(ResolveKind.CLASS, ResolveKind.PACKAGE);
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_CLASS = EnumSet.of(ResolveKind.CLASS);
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_METHOD = EnumSet.of(ResolveKind.METHOD);
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_METHOD_PROPERTY = EnumSet.of(ResolveKind.METHOD, ResolveKind.PROPERTY);
|
||||
EnumSet<ResolveKind> RESOLVE_KINDS_PROPERTY = EnumSet.of(ResolveKind.PROPERTY);
|
||||
|
||||
enum ResolveKind {
|
||||
CLASS,
|
||||
PACKAGE,
|
||||
METHOD,
|
||||
PROPERTY
|
||||
}
|
||||
|
||||
boolean shouldProcess(ResolveKind resolveKind);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_CLASS_PACKAGE = EnumSet.of(CLASS, PACKAGE);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_CLASS = EnumSet.of(CLASS);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_METHOD = EnumSet.of(METHOD);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_PROPERTY = EnumSet.of(VARIABLE, FIELD, ENUM_CONST);
|
||||
EnumSet<DeclarationKind> RESOLVE_KINDS_METHOD_PROPERTY = EnumSet.of(METHOD, VARIABLE, FIELD, ENUM_CONST);
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,11 +21,13 @@ import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_CLASS;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class ClassResolverProcessor extends ResolverProcessor {
|
||||
public ClassResolverProcessor(String refName, GrReferenceElement ref, EnumSet<ResolveKind> kinds) {
|
||||
public ClassResolverProcessor(String refName, GrReferenceElement ref, EnumSet<DeclarationKind> kinds) {
|
||||
super(refName, kinds, ref, ref.getTypeArguments());
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,11 +26,14 @@ import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_CLASS_PACKAGE;
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_METHOD_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class CompletionProcessor extends ResolverProcessor {
|
||||
private CompletionProcessor(PsiElement place, final EnumSet<ResolveKind> resolveTargets, final String name) {
|
||||
private CompletionProcessor(PsiElement place, final EnumSet<DeclarationKind> resolveTargets, final String name) {
|
||||
super(name, resolveTargets, place, PsiType.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ public class GrDelegatingScopeProcessorWithHints extends GrScopeProcessorWithHin
|
||||
|
||||
public GrDelegatingScopeProcessorWithHints(@NotNull PsiScopeProcessor delegate,
|
||||
@Nullable String name,
|
||||
@Nullable EnumSet<ResolveKind> resolveTargets) {
|
||||
@Nullable EnumSet<DeclarationKind> resolveTargets) {
|
||||
super(name, resolveTargets);
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
+10
-34
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,12 +28,12 @@ import java.util.EnumSet;
|
||||
/**
|
||||
* Created by Max Medvedev on 31/03/14
|
||||
*/
|
||||
public abstract class GrScopeProcessorWithHints implements PsiScopeProcessor, NameHint, ClassHint, ElementClassHint {
|
||||
protected final EnumSet<ResolveKind> myResolveTargetKinds;
|
||||
protected final String myName;
|
||||
public abstract class GrScopeProcessorWithHints implements PsiScopeProcessor, NameHint, ElementClassHint {
|
||||
protected final @Nullable EnumSet<DeclarationKind> myResolveTargetKinds;
|
||||
protected final @Nullable String myName;
|
||||
|
||||
public GrScopeProcessorWithHints(@Nullable String name,
|
||||
@Nullable EnumSet<ResolveKind> resolveTargets) {
|
||||
@Nullable EnumSet<DeclarationKind> resolveTargets) {
|
||||
myName = name;
|
||||
myResolveTargetKinds = resolveTargets;
|
||||
}
|
||||
@@ -45,51 +45,27 @@ public abstract class GrScopeProcessorWithHints implements PsiScopeProcessor, Na
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
if ((ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) && myResolveTargetKinds != null) {
|
||||
if (ElementClassHint.KEY == hintKey && myResolveTargetKinds != null) {
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProcess(ResolveKind resolveKind) {
|
||||
assert myResolveTargetKinds != null : "don't invoke shouldProcess if resolveTargets are not declared";
|
||||
return myResolveTargetKinds.contains(resolveKind);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldProcess(DeclarationKind kind) {
|
||||
switch (kind) {
|
||||
case CLASS:
|
||||
return shouldProcess(ResolveKind.CLASS);
|
||||
|
||||
case ENUM_CONST:
|
||||
case VARIABLE:
|
||||
case FIELD:
|
||||
return shouldProcess(ResolveKind.PROPERTY);
|
||||
|
||||
case METHOD:
|
||||
return shouldProcess(ResolveKind.METHOD);
|
||||
|
||||
case PACKAGE:
|
||||
return shouldProcess(ResolveKind.PACKAGE);
|
||||
}
|
||||
|
||||
return false;
|
||||
assert myResolveTargetKinds != null : "don't invoke shouldProcess if resolveTargets are not declared";
|
||||
return myResolveTargetKinds.contains(kind);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName(@NotNull ResolveState state) {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
assert myName != null : "don't invoke getName if myName is not declared";
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEvent(@NotNull Event event, @Nullable Object associated) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,6 +38,9 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_METHOD_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,8 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrBindingVariable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_KINDS_PROPERTY;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
|
||||
+16
-13
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,8 @@ import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@@ -44,7 +46,7 @@ public class ResolverProcessor extends GrScopeProcessorWithHints {
|
||||
private List<GroovyResolveResult> myCandidates;
|
||||
|
||||
protected ResolverProcessor(@Nullable String name,
|
||||
@NotNull EnumSet<ResolveKind> resolveTargets,
|
||||
@NotNull EnumSet<DeclarationKind> resolveTargets,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull PsiType[] typeArguments) {
|
||||
super(name, resolveTargets);
|
||||
@@ -58,11 +60,11 @@ public class ResolverProcessor extends GrScopeProcessorWithHints {
|
||||
return true; // the debugger creates a Java code block context and our expressions to evaluate resolve there
|
||||
}
|
||||
|
||||
if (myResolveTargetKinds.contains(getResolveKind(element))) {
|
||||
if (myResolveTargetKinds == null || myResolveTargetKinds.contains(getDeclarationKind(element))) {
|
||||
//hack for resolve of java local vars and parameters
|
||||
//don't check field for name because they can be aliased imported
|
||||
if (element instanceof PsiVariable && !(element instanceof PsiField) &&
|
||||
getName() != null && !getName().equals(((PsiVariable)element).getName())) {
|
||||
myName != null && !myName.equals(((PsiVariable)element).getName())) {
|
||||
return true;
|
||||
}
|
||||
PsiNamedElement namedElement = (PsiNamedElement)element;
|
||||
@@ -105,7 +107,7 @@ public class ResolverProcessor extends GrScopeProcessorWithHints {
|
||||
String text;
|
||||
if (element instanceof LightElement) {
|
||||
final PsiElement context = element.getContext();
|
||||
text = context instanceof LightElement ? context.toString() :
|
||||
text = context instanceof LightElement ? context.toString() :
|
||||
context != null ? context.getText() : null;
|
||||
}
|
||||
else {
|
||||
@@ -166,21 +168,22 @@ public class ResolverProcessor extends GrScopeProcessorWithHints {
|
||||
return myCandidates != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ResolveKind getResolveKind(PsiElement element) {
|
||||
if (element instanceof PsiVariable) return ResolveKind.PROPERTY;
|
||||
if (element instanceof PsiMethod) return ResolveKind.METHOD;
|
||||
if (element instanceof PsiPackage) return ResolveKind.PACKAGE;
|
||||
if (element instanceof PsiClass) return ResolveKind.CLASS;
|
||||
private static DeclarationKind getDeclarationKind(PsiElement element) {
|
||||
if (element instanceof PsiMethod) return DeclarationKind.METHOD;
|
||||
if (element instanceof PsiEnumConstant) return DeclarationKind.ENUM_CONST;
|
||||
if (element instanceof PsiField) return DeclarationKind.FIELD;
|
||||
if (element instanceof PsiVariable) return DeclarationKind.VARIABLE;
|
||||
if (element instanceof PsiClass) return DeclarationKind.CLASS;
|
||||
if (element instanceof PsiPackage) return DeclarationKind.PACKAGE;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NameHint: '" +
|
||||
getName() +
|
||||
myName +
|
||||
"', " +
|
||||
myResolveTargetKinds.toString() +
|
||||
myResolveTargetKinds +
|
||||
", Candidates: " +
|
||||
(myCandidates == null ? 0 : myCandidates.size());
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,13 +16,13 @@
|
||||
package org.jetbrains.plugins.groovy.markup;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
@@ -45,8 +45,7 @@ public class XmlMarkupBuilderNonCodeMemberContributor extends NonCodeMembersCont
|
||||
|
||||
if (nameHint == null) return;
|
||||
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return;
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return;
|
||||
|
||||
GrLightMethodBuilder res = new GrLightMethodBuilder(aClass.getManager(), nameHint);
|
||||
res.addParameter("attrs", CommonClassNames.JAVA_UTIL_MAP, false);
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -26,7 +27,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMe
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -41,8 +41,8 @@ public class SpockMemberContributor extends NonCodeMembersContributor {
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) {
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
if (ResolveUtil.shouldProcessProperties(classHint)) {
|
||||
GrMethod method = PsiTreeUtil.getParentOfType(place, GrMethod.class);
|
||||
if (method == null) return;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SpockMemberContributor extends NonCodeMembersContributor {
|
||||
}
|
||||
}
|
||||
|
||||
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) {
|
||||
if (ResolveUtil.shouldProcessMethods(classHint)) {
|
||||
if ("get_".equals(ResolveUtil.getNameHint(processor))) {
|
||||
GrLightMethodBuilder m = new GrLightMethodBuilder(aClass.getManager(), "get_");
|
||||
m.setReturnType(null);
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.UserDataHolderEx;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -32,7 +33,6 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrMethodWrapper;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -834,8 +834,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull PsiElement place,
|
||||
@NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return;
|
||||
if (!ResolveUtil.shouldProcessMethods(processor.getHint(ElementClassHint.KEY))) return;
|
||||
|
||||
MultiMap<String, PsiMethod> methodMap = aClass.getUserData(KEY);
|
||||
if (methodMap == null) {
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.UserDataHolderEx;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -37,7 +38,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrRe
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightMethodBuilder;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GrStaticChecker;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
@@ -81,19 +81,19 @@ public class DynamicMemberUtils {
|
||||
}
|
||||
|
||||
public static boolean process(PsiScopeProcessor processor, boolean isInStaticContext, PsiElement place, String classSource) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
String name = ResolveUtil.getNameHint(processor);
|
||||
|
||||
ClassMemberHolder memberHolder = getMembers(place.getProject(), classSource);
|
||||
|
||||
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) {
|
||||
if (ResolveUtil.shouldProcessMethods(classHint)) {
|
||||
PsiMethod[] methods = isInStaticContext ? memberHolder.getStaticMethods(name) : memberHolder.getMethods(name);
|
||||
for (PsiMethod method : methods) {
|
||||
if (!processor.execute(method, ResolveState.initial())) return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) {
|
||||
if (ResolveUtil.shouldProcessProperties(classHint)) {
|
||||
PsiField[] fields = isInStaticContext ? memberHolder.getStaticFields(name) : memberHolder.getFields(name);
|
||||
for (PsiField field : fields) {
|
||||
if (!processor.execute(field, ResolveState.initial())) return false;
|
||||
|
||||
+3
-1
@@ -66,6 +66,8 @@ import org.jetbrains.plugins.groovy.lang.resolve.processors.SubstitutorComputer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint.RESOLVE_CONTEXT;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@@ -404,7 +406,7 @@ public class CompleteReferenceExpression {
|
||||
private boolean myIsEmpty = true;
|
||||
|
||||
protected CompleteReferenceProcessor() {
|
||||
super(null, EnumSet.allOf(ResolveKind.class), myRefExpr, PsiType.EMPTY_ARRAY);
|
||||
super(null, EnumSet.allOf(DeclarationKind.class), myRefExpr, PsiType.EMPTY_ARRAY);
|
||||
myConsumer = new Consumer<LookupElement>() {
|
||||
@Override
|
||||
public void consume(LookupElement element) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.shell;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.PsiImmediateClassType;
|
||||
import com.intellij.psi.scope.ElementClassHint;
|
||||
import com.intellij.psi.scope.NameHint;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
@@ -28,7 +29,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpres
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightVariable;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -89,10 +90,9 @@ public class GroovyShellCodeFragment extends GroovyCodeFragment {
|
||||
}
|
||||
|
||||
private boolean processVariables(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null &&
|
||||
!classHint.shouldProcess(ClassHint.ResolveKind.METHOD) &&
|
||||
!classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) {
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
if (!ResolveUtil.shouldProcessMethods(classHint) &&
|
||||
!ResolveUtil.shouldProcessProperties(classHint)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ public class GroovyShellCodeFragment extends GroovyCodeFragment {
|
||||
}
|
||||
|
||||
private boolean processTypeDefinitions(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state) {
|
||||
ClassHint classHint = processor.getHint(ClassHint.KEY);
|
||||
if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.CLASS)) {
|
||||
ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
|
||||
if (!ResolveUtil.shouldProcessClasses(classHint)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user