当前位置: 首页>>代码示例>>Java>>正文


Java FilterUtil类代码示例

本文整理汇总了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};
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:InstanceOfLeftPartTypeGetter.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AssignableFromFilter.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:AssignableToFilter.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:AssignableToFilter.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:AssignableToFilter.java

示例6: getType

import com.intellij.psi.filters.FilterUtil; //导入依赖的package包/类
@Override
public PsiType getType() {
  return FilterUtil.getKeywordItemType(myPosition, getLookupString());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:KeywordLookupItem.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:StartElementFilter.java


注:本文中的com.intellij.psi.filters.FilterUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。