mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
origin info without parentheses
This commit is contained in:
+1
-3
@@ -36,9 +36,7 @@ public abstract class OriginInfoProvider {
|
||||
@Nullable
|
||||
public static String getOriginInfo(@Nullable PsiElement element) {
|
||||
if (element == null) return null;
|
||||
String info = _getOriginInfo(element);
|
||||
if (info != null) info = "(" + info + ")";
|
||||
return info;
|
||||
return _getOriginInfo(element);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrGdkMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrGdkMethodImpl;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GdkMethodUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil;
|
||||
|
||||
/**
|
||||
@@ -101,8 +102,8 @@ public class GdkMethodHolder {
|
||||
|
||||
for (String superType : ResolveUtil.getAllSuperTypes(qualifierType, project).keySet()) {
|
||||
for (PsiMethod method : map.get(superType)) {
|
||||
String originInfo = method.getContainingClass().getName();
|
||||
GrGdkMethod gdk = GrGdkMethodImpl.createGdkMethod(method, myStatic, originInfo);
|
||||
String info = GdkMethodUtil.generateOriginInfo(method);
|
||||
GrGdkMethod gdk = GrGdkMethodImpl.createGdkMethod(method, myStatic, info);
|
||||
if (!processor.execute(gdk, state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-12
@@ -38,7 +38,7 @@ public class GrGdkMethodImpl extends LightMethodBuilder implements GrGdkMethod {
|
||||
private static Key<CachedValue<GrGdkMethodImpl>> CACHED_NON_STATIC = Key.create("Cached instance gdk method");
|
||||
private final PsiMethod myMethod;
|
||||
|
||||
private GrGdkMethodImpl(PsiMethod method, boolean isStatic, String originInfo) {
|
||||
private GrGdkMethodImpl(PsiMethod method, boolean isStatic, @Nullable String originInfo) {
|
||||
super(method.getManager(), GroovyFileType.GROOVY_LANGUAGE, method.getName());
|
||||
myMethod = method;
|
||||
|
||||
@@ -98,17 +98,6 @@ public class GrGdkMethodImpl extends LightMethodBuilder implements GrGdkMethod {
|
||||
return myMethod.hashCode();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiClass inferContainingClassByFirstParameter(PsiMethod method) {
|
||||
PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
if (parameters.length < 1) return null;
|
||||
|
||||
PsiType type = parameters[0].getType();
|
||||
if (!(type instanceof PsiClassType)) return null;
|
||||
|
||||
return ((PsiClassType)type).resolve();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static GrGdkMethod createGdkMethod(@NotNull final PsiMethod original,
|
||||
final boolean isStatic,
|
||||
|
||||
@@ -108,10 +108,11 @@ public class GdkMethodUtil {
|
||||
@Override
|
||||
public boolean execute(@NotNull PsiElement element, ResolveState state) {
|
||||
if (element instanceof PsiMethod) {
|
||||
if (!((PsiMethod)element).hasModifierProperty(PsiModifier.STATIC)) return true;
|
||||
final PsiParameter[] parameters = ((PsiMethod)element).getParameterList().getParameters();
|
||||
PsiMethod method = (PsiMethod)element;
|
||||
if (!method.hasModifierProperty(PsiModifier.STATIC)) return true;
|
||||
final PsiParameter[] parameters = method.getParameterList().getParameters();
|
||||
if (parameters.length == 0) return true;
|
||||
return processor.execute(GrGdkMethodImpl.createGdkMethod((PsiMethod)element, false, categoryClass.getName()), state);
|
||||
return processor.execute(GrGdkMethodImpl.createGdkMethod(method, false, generateOriginInfo(method)), state);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -177,4 +178,12 @@ public class GdkMethodUtil {
|
||||
public static boolean isWithName(String name) {
|
||||
return WITH.equals(name) || IDENTITY.equals(name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String generateOriginInfo(PsiMethod method) {
|
||||
PsiClass cc = method.getContainingClass();
|
||||
if (cc == null) return null;
|
||||
//'\u2191'
|
||||
return "via " + cc.getName();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user