本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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()]);
}
}
示例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;
}
示例6: calculateLookupItems
@Override
public LookupElement[] calculateLookupItems(ExpressionContext expressionContext) {
return LookupElement.EMPTY_ARRAY;
}
示例7: calculateLookupItems
@Override
public LookupElement[] calculateLookupItems(ExpressionContext context) {
return LookupElement.EMPTY_ARRAY;
}