本文整理匯總了Java中com.intellij.codeInsight.lookup.LookupElementBuilder.createWithIcon方法的典型用法代碼示例。如果您正苦於以下問題:Java LookupElementBuilder.createWithIcon方法的具體用法?Java LookupElementBuilder.createWithIcon怎麽用?Java LookupElementBuilder.createWithIcon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.codeInsight.lookup.LookupElementBuilder
的用法示例。
在下文中一共展示了LookupElementBuilder.createWithIcon方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addLookupElement
import com.intellij.codeInsight.lookup.LookupElementBuilder; //導入方法依賴的package包/類
private void addLookupElement(List<LookupElement> lookupElements, PsiElement el) {
if (!el.isValid()) return;
LookupElementBuilder builder;
if (el instanceof DictionaryComponent) {
DictionaryComponent dc = (DictionaryComponent) el;
String dName = dc.getDictionary().getName();
builder = LookupElementBuilder.createWithIcon(dc).appendTailText(" " + dName, true);
} else if (el instanceof AppleScriptComponent) {
builder = LookupElementBuilder.createWithIcon((AppleScriptComponent) el);
if (el instanceof AppleScriptHandlerPositionalParametersDefinition) {
AppleScriptHandlerPositionalParametersDefinition handlerCall = (AppleScriptHandlerPositionalParametersDefinition) el;
builder = builder.withInsertHandler(handlerCall.getFormalParameterList() != null ?
ParenthesesInsertHandler.WITH_PARAMETERS : ParenthesesInsertHandler.NO_PARAMETERS);
}
} else {
builder = LookupElementBuilder.create(el);
}
AppleScriptComponentType componentType = AppleScriptComponentType.typeOf(el);
String typeText = componentType != null ? componentType.toString().toLowerCase() : null;
builder = builder.withTypeText(typeText, null, true);
lookupElements.add(builder);
}