本文整理汇总了Java中com.intellij.codeInsight.lookup.LookupItemUtil类的典型用法代码示例。如果您正苦于以下问题:Java LookupItemUtil类的具体用法?Java LookupItemUtil怎么用?Java LookupItemUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LookupItemUtil类属于com.intellij.codeInsight.lookup包,在下文中一共展示了LookupItemUtil类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createReferenceLookupItem
import com.intellij.codeInsight.lookup.LookupItemUtil; //导入依赖的package包/类
private LookupElement createReferenceLookupItem(final Object element)
{
if(element instanceof PsiMethod)
{
return new JavaMethodCallElement((PsiMethod) element)
{
@Override
public void handleInsert(InsertionContext context)
{
new MethodSignatureInsertHandler().handleInsert(context, this);
}
};
}
if(element instanceof PsiClass)
{
JavaPsiClassReferenceElement classElement = new JavaPsiClassReferenceElement((PsiClass) element);
classElement.setInsertHandler(JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER);
return classElement;
}
return LookupItemUtil.objectToLookupItem(element);
}
示例2: addLookupItem
import com.intellij.codeInsight.lookup.LookupItemUtil; //导入依赖的package包/类
@Override
protected void addLookupItem(Set<LookupElement> set, final TailType tailType, @NotNull Object completion, final PsiFile file, final CompletionVariant variant) {
if (completion instanceof LookupElement && !(completion instanceof LookupItem)) {
set.add((LookupElement)completion);
return;
}
LookupElement _ret = LookupItemUtil.objectToLookupItem(completion);
if(_ret == null || !(_ret instanceof LookupItem)) return;
LookupItem ret = (LookupItem)_ret;
final InsertHandler insertHandler = variant.getInsertHandler();
if(insertHandler != null && ret.getInsertHandler() == null) {
}
ret.setInsertHandler(new InsertHandler<LookupElement>() {
@Override
public void handleInsert(InsertionContext context, LookupElement item) {
if (context.shouldAddCompletionChar()) {
return;
}
if (tailType != TailType.NONE && tailType.isApplicable(context)) {
tailType.processTail(context.getEditor(), context.getTailOffset());
}
}
});
final Map<Object, Object> itemProperties = variant.getItemProperties();
for (final Object key : itemProperties.keySet()) {
ret.setAttribute(key, itemProperties.get(key));
}
set.add(ret);
}
示例3: addElementLookupItem
import com.intellij.codeInsight.lookup.LookupItemUtil; //导入依赖的package包/类
public static LookupElement addElementLookupItem(Set<LookupElement> items, PsiElement element) {
final LookupElement item = LookupItemUtil.addLookupItem(items, element);
if (item instanceof LookupItem) {
((LookupItem)item).setAttribute(TemplateLookupSelectionHandler.KEY_IN_LOOKUP_ITEM, new JavaTemplateLookupSelectionHandler());
}
return item;
}
示例4: addElementLookupItem
import com.intellij.codeInsight.lookup.LookupItemUtil; //导入依赖的package包/类
public static LookupElement addElementLookupItem(Set<LookupElement> items, PsiElement element)
{
final LookupElement item = LookupItemUtil.objectToLookupItem(element);
items.add(item);
item.putUserData(TemplateLookupSelectionHandler.KEY_IN_LOOKUP_ITEM, new JavaTemplateLookupSelectionHandler());
return item;
}
示例5: addElementLookupItem
import com.intellij.codeInsight.lookup.LookupItemUtil; //导入依赖的package包/类
public static LookupElement addElementLookupItem(Set<LookupElement> items, PsiElement element) {
final LookupElement item = LookupItemUtil.objectToLookupItem(element);
items.add(item);
item.putUserData(TemplateLookupSelectionHandler.KEY_IN_LOOKUP_ITEM, new JavaTemplateLookupSelectionHandler());
return item;
}