當前位置: 首頁>>代碼示例>>Java>>正文


Java LookupElement.EMPTY_ARRAY屬性代碼示例

本文整理匯總了Java中com.intellij.codeInsight.lookup.LookupElement.EMPTY_ARRAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java LookupElement.EMPTY_ARRAY屬性的具體用法?Java LookupElement.EMPTY_ARRAY怎麽用?Java LookupElement.EMPTY_ARRAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.intellij.codeInsight.lookup.LookupElement的用法示例。


在下文中一共展示了LookupElement.EMPTY_ARRAY屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateLookupItems

@Override
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
  if (params.length == 0) return LookupElement.EMPTY_ARRAY;
  Result paramResult = params[0].calculateQuickResult(context);
  if (paramResult instanceof PsiTypeResult) {
    final PsiType type = ((PsiTypeResult)paramResult).getType();
    final PsiFile file = PsiDocumentManager.getInstance(context.getProject()).getPsiFile(context.getEditor().getDocument());
    final PsiElement element = file.findElementAt(context.getStartOffset());

    final Set<LookupElement> set = new LinkedHashSet<LookupElement>();
    JavaTemplateUtil.addTypeLookupItem(set, type);
    CodeInsightUtil.processSubTypes(type, element, false, PrefixMatcher.ALWAYS_TRUE, new Consumer<PsiType>() {
      @Override
      public void consume(PsiType psiType) {
        JavaTemplateUtil.addTypeLookupItem(set, psiType);
      }
    });
    return set.toArray(new LookupElement[set.size()]);
  }
  return LookupElement.EMPTY_ARRAY;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:SubtypesMacro.java

示例2: calculateLookupItems

@Override
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
  final Query<PsiMember> query = findAnnotated(context, params);

  if (query != null) {
    Set<LookupElement> set = new LinkedHashSet<LookupElement>();
    final String secondParamValue = params.length > 1 ? params[1].calculateResult(context).toString() : null;
    final boolean isShortName = secondParamValue != null && !Boolean.valueOf(secondParamValue);
    final Project project = context.getProject();
    final PsiClass findInClass = secondParamValue != null
                                 ? JavaPsiFacade.getInstance(project).findClass(secondParamValue, GlobalSearchScope.allScope(project))
                                 : null;

    for (PsiMember object : query.findAll()) {
      if (findInClass != null && !object.getContainingClass().equals(findInClass)) continue;
      boolean isClazz = object instanceof PsiClass;
      final String name = isShortName || !isClazz ? object.getName() : ((PsiClass) object).getQualifiedName();
      set.add(LookupElementBuilder.create(name));
    }

    return set.toArray(new LookupElement[set.size()]);
  }
  return LookupElement.EMPTY_ARRAY;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:AnnotatedMacro.java

示例3: calculateLookupItems

@Override
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
  Object o = runIt(params, context);
  if (o != null) {
    Set<LookupElement> set = new LinkedHashSet<LookupElement>();
    set.add(LookupElementBuilder.create(o.toString()));
    return set.toArray(new LookupElement[set.size()]);
  }
  return LookupElement.EMPTY_ARRAY;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:GroovyScriptMacro.java

示例4: getLookupElements

@Override
@Nullable
public LookupElement[] getLookupElements() {
  LookupImpl lookup = getLookup();
  if (lookup == null) {
    return myEmptyLookup ? LookupElement.EMPTY_ARRAY : null;
  }
  else {
    final List<LookupElement> list = lookup.getItems();
    return list.toArray(new LookupElement[list.size()]);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:CodeInsightTestFixtureImpl.java

示例5: runCompletion

private LookupElement[] runCompletion() {
  myFixture.configureByFiles(getTestCompletionFilePath());
  final LookupElement[] lookupElements =
    myFixture.complete(CompletionType.BASIC, MethodsChainsCompletionContributor.INVOCATIONS_THRESHOLD);
  return lookupElements == null ? LookupElement.EMPTY_ARRAY : lookupElements;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:MethodChainsCompletionTest.java

示例6: calculateLookupItems

@Override
public LookupElement[] calculateLookupItems(ExpressionContext expressionContext) {
  return LookupElement.EMPTY_ARRAY;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:TextExpression.java

示例7: calculateLookupItems

@Override
public LookupElement[] calculateLookupItems(ExpressionContext context) {
  return LookupElement.EMPTY_ARRAY;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:ConstantNode.java


注:本文中的com.intellij.codeInsight.lookup.LookupElement.EMPTY_ARRAY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。