本文整理汇总了Java中com.intellij.psi.filters.FilterUtil类的典型用法代码示例。如果您正苦于以下问题:Java FilterUtil类的具体用法?Java FilterUtil怎么用?Java FilterUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FilterUtil类属于com.intellij.psi.filters包,在下文中一共展示了FilterUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLeftTypes
import com.intellij.psi.filters.FilterUtil; //导入依赖的package包/类
public static PsiType[] getLeftTypes(PsiElement context) {
if((context = FilterUtil.getPreviousElement(context, true)) == null) return PsiType.EMPTY_ARRAY;
if(!PsiKeyword.INSTANCEOF.equals(context.getText())) return PsiType.EMPTY_ARRAY;
if((context = FilterUtil.getPreviousElement(context, false)) == null) return PsiType.EMPTY_ARRAY;
final PsiExpression contextOfType = PsiTreeUtil.getContextOfType(context, PsiExpression.class, false);
if (contextOfType == null) return PsiType.EMPTY_ARRAY;
PsiType type = contextOfType.getType();
if (type == null) return PsiType.EMPTY_ARRAY;
if (type instanceof PsiClassType) {
final PsiClass psiClass = ((PsiClassType)type).resolve();
if (psiClass instanceof PsiTypeParameter) {
return psiClass.getExtendsListTypes();
}
}
return new PsiType[]{type};
}
示例2: isAcceptable
import com.intellij.psi.filters.FilterUtil; //导入依赖的package包/类
public static boolean isAcceptable(PsiElement element, PsiElement context, PsiType expectedType, PsiSubstitutor substitutor) {
if (element instanceof PsiMethod && isReturnTypeInferrable((PsiMethod)element, context, expectedType, substitutor)) {
return true;
}
PsiType typeByElement = FilterUtil.getTypeByElement(element, context);
if (typeByElement == null) {
return false;
}
if(substitutor != null) {
typeByElement = substitutor.substitute(typeByElement);
}
if (!allowBoxing(context) && (expectedType instanceof PsiPrimitiveType != typeByElement instanceof PsiPrimitiveType)) {
return false;
}
return expectedType.isAssignableFrom(typeByElement);
}
示例3: isAcceptable
import com.intellij.psi.filters.FilterUtil; //导入依赖的package包/类
@Override
public boolean isAcceptable(Object element, PsiElement context){
if(myType != null){
if(element == null) return false;
if (element instanceof PsiType) return myType.isAssignableFrom((PsiType) element);
PsiSubstitutor substitutor = null;
if(element instanceof CandidateInfo){
final CandidateInfo info = (CandidateInfo)element;
substitutor = info.getSubstitutor();
element = info.getElement();
}
PsiType typeByElement = FilterUtil.getTypeByElement((PsiElement)element, context);
if(substitutor != null) typeByElement = substitutor.substitute(typeByElement);
return typeByElement != null && typeByElement.isAssignableFrom(myType) && !typeByElement.equals(myType);
}
else if(myFilter != null){
if(element == null) return false;
return myFilter.isAcceptable(element, context);
}
else return false;
}
示例4: isAcceptable
import com.intellij.psi.filters.FilterUtil; //导入依赖的package包/类
@Override
public boolean isAcceptable(Object element, PsiElement context)
{
if(element == null)
{
return false;
}
if(element instanceof PsiType)
{
return myType.isAssignableFrom((PsiType) element);
}
PsiSubstitutor substitutor = null;
if(element instanceof CandidateInfo)
{
final CandidateInfo info = (CandidateInfo) element;
substitutor = info.getSubstitutor();
element = info.getElement();
}
PsiType typeByElement = FilterUtil.getTypeByElement((PsiElement) element, context);
if(substitutor != null)
{
typeByElement = substitutor.substitute(typeByElement);
}
return typeByElement != null && typeByElement.isAssignableFrom(myType) && !typeByElement.equals(myType);
}
示例5: isAcceptable
import com.intellij.psi.filters.FilterUtil; //导入依赖的package包/类
@Override
public boolean isAcceptable(Object element, PsiElement context){
if(element == null) return false;
if (element instanceof PsiType) return myType.isAssignableFrom((PsiType) element);
PsiSubstitutor substitutor = null;
if(element instanceof CandidateInfo){
final CandidateInfo info = (CandidateInfo)element;
substitutor = info.getSubstitutor();
element = info.getElement();
}
PsiType typeByElement = FilterUtil.getTypeByElement((PsiElement)element, context);
if(substitutor != null) typeByElement = substitutor.substitute(typeByElement);
return typeByElement != null && typeByElement.isAssignableFrom(myType) && !typeByElement.equals(myType);
}
示例6: getType
import com.intellij.psi.filters.FilterUtil; //导入依赖的package包/类
@Override
public PsiType getType() {
return FilterUtil.getKeywordItemType(myPosition, getLookupString());
}
示例7: isAcceptable
import com.intellij.psi.filters.FilterUtil; //导入依赖的package包/类
@Override
public boolean isAcceptable(Object element, PsiElement context){
if (!(element instanceof PsiElement)) return false;
return FilterUtil.getPreviousElement((PsiElement) element, false) == null;
}