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


Java TargetElementUtil.getTargetCandidates方法代码示例

本文整理汇总了Java中consulo.codeInsight.TargetElementUtil.getTargetCandidates方法的典型用法代码示例。如果您正苦于以下问题:Java TargetElementUtil.getTargetCandidates方法的具体用法?Java TargetElementUtil.getTargetCandidates怎么用?Java TargetElementUtil.getTargetCandidates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在consulo.codeInsight.TargetElementUtil的用法示例。


在下文中一共展示了TargetElementUtil.getTargetCandidates方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getExpression

import consulo.codeInsight.TargetElementUtil; //导入方法依赖的package包/类
@Nullable
protected PsiExpression getExpression(PsiElement element) {
  if (myMethodCall == null || !myMethodCall.isValid()) {
    return myExpression == null || !myExpression.isValid() ? null : myExpression;
  }
  final PsiElement method = myMethodCall.resolveMethod();
  if (method != null) {
    final PsiMethod psiMethod = (PsiMethod)method;
    return checkMethod(element, psiMethod);
  } else if (myMethodCall instanceof PsiMethodCallExpression){
    final Collection<PsiElement> psiElements = TargetElementUtil.getTargetCandidates(((PsiMethodCallExpression) myMethodCall).getMethodExpression());
    for (PsiElement psiElement : psiElements) {
      if (psiElement instanceof PsiMethod) {
        final PsiExpression expression = checkMethod(element, (PsiMethod)psiElement);
        if (expression != null) return expression;
      }
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:SurroundWithArrayFix.java

示例2: doTest

import consulo.codeInsight.TargetElementUtil; //导入方法依赖的package包/类
protected Collection<PsiElement> doTest(int expectedSize) {
  PsiFile file = myFixture.getFile();
  assertNotNull(file);
  PsiReference reference = file.findReferenceAt(myFixture.getCaretOffset());
  assertNotNull("no reference", reference);
  final Collection<PsiElement> elements = TargetElementUtil.getTargetCandidates(reference);
  assertNotNull(elements);
  assertEquals(expectedSize, elements.size());
  return elements;
}
 
开发者ID:consulo,项目名称:consulo-apache-thrift,代码行数:11,代码来源:ThriftResolveTest.java

示例3: getPsiElementsIn

import consulo.codeInsight.TargetElementUtil; //导入方法依赖的package包/类
@Nullable
private static PsiElement[] getPsiElementsIn(final Editor editor, final PsiFile psiFile) {
  try {
    final PsiReference reference = TargetElementUtil.findReference(editor, editor.getCaretModel().getOffset());
    if (reference == null) {
      return null;
    }
    final Collection<PsiElement> candidates = TargetElementUtil.getTargetCandidates(reference);
    return ContainerUtil.toArray(candidates, new PsiElement[candidates.size()]);
  }
  catch (IndexNotReadyException e) {
    return null;
  }
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:15,代码来源:AntRenameHandler.java

示例4: doTest

import consulo.codeInsight.TargetElementUtil; //导入方法依赖的package包/类
protected void doTest(PsiFile[] files, int expectedSize) {
  final PsiFile myFile = files[0];
  final Collection<PsiElement> elements = TargetElementUtil.getTargetCandidates(myFile.findReferenceAt(myFixture.getCaretOffset()));
  assertNotNull(elements);
  assertEquals(expectedSize, elements.size());
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:7,代码来源:HaxeGoToDeclarationActionTest.java

示例5: suggestCandidates

import consulo.codeInsight.TargetElementUtil; //导入方法依赖的package包/类
private static Collection<PsiElement> suggestCandidates(final PsiReference reference) {
  if (reference == null) {
    return Collections.emptyList();
  }
  return TargetElementUtil.getTargetCandidates(reference);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:GotoDeclarationAction.java


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