本文整理汇总了Java中com.intellij.codeInsight.lookup.impl.LookupImpl.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java LookupImpl.getItems方法的具体用法?Java LookupImpl.getItems怎么用?Java LookupImpl.getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.lookup.impl.LookupImpl
的用法示例。
在下文中一共展示了LookupImpl.getItems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLookupElements
import com.intellij.codeInsight.lookup.impl.LookupImpl; //导入方法依赖的package包/类
@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()]);
}
}
示例2: getLookupElementWeights
import com.intellij.codeInsight.lookup.impl.LookupImpl; //导入方法依赖的package包/类
public static List<String> getLookupElementWeights(LookupImpl lookup) {
final Map<LookupElement,StringBuilder> strings = lookup.getRelevanceStrings();
List<String> sb = new ArrayList<String>();
for (LookupElement item : lookup.getItems()) {
StringBuilder builder = strings.get(item);
String weight = builder == null ? "null" : builder.toString();
final String s = item.getLookupString() + "\t" + weight;
sb.add(s);
}
return sb;
}
示例3: getLookupElementWeights
import com.intellij.codeInsight.lookup.impl.LookupImpl; //导入方法依赖的package包/类
public static List<String> getLookupElementWeights(LookupImpl lookup) {
final Map<LookupElement,StringBuilder> strings = lookup.getRelevanceStrings();
List<String> sb = new ArrayList<String>();
for (LookupElement item : lookup.getItems()) {
String weight = strings.get(item).toString();
final String s = item.getLookupString() + "\t" + weight;
sb.add(s);
}
return sb;
}
示例4: getLookupElements
import com.intellij.codeInsight.lookup.impl.LookupImpl; //导入方法依赖的package包/类
@Override
@javax.annotation.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: doTest
import com.intellij.codeInsight.lookup.impl.LookupImpl; //导入方法依赖的package包/类
protected void doTest(String directory) {
CamelHumpMatcher.forceStartMatching(getTestRootDisposable());
final List<String> stringList = TestUtils.readInput(getTestDataPath() + "/" + getTestName(true) + ".test");
if (directory.length()!=0) directory += "/";
final String fileName = directory + getTestName(true) + "." + getExtension();
myFixture.addFileToProject(fileName, stringList.get(0));
myFixture.configureByFile(fileName);
boolean old = CodeInsightSettings.getInstance().AUTOCOMPLETE_COMMON_PREFIX;
CodeInsightSettings.getInstance().AUTOCOMPLETE_COMMON_PREFIX = false;
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = false;
String result = "";
try {
myFixture.completeBasic();
final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(myFixture.getEditor());
if (lookup != null) {
List<LookupElement> items = lookup.getItems();
if (!addReferenceVariants()) {
items = ContainerUtil.findAll(items, new Condition<LookupElement>() {
@Override
public boolean value(LookupElement lookupElement) {
final Object o = lookupElement.getObject();
return !(o instanceof PsiMember) && !(o instanceof GrVariable) && !(o instanceof GroovyResolveResult) && !(o instanceof PsiPackage);
}
});
}
Collections.sort(items, new Comparator<LookupElement>() {
@Override
public int compare(LookupElement o1, LookupElement o2) {
return o1.getLookupString().compareTo(o2.getLookupString());
}
});
result = "";
for (LookupElement item : items) {
result = result + "\n" + item.getLookupString();
}
result = result.trim();
LookupManager.getInstance(myFixture.getProject()).hideActiveLookup();
}
}
finally {
CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION = true;
CodeInsightSettings.getInstance().AUTOCOMPLETE_COMMON_PREFIX = old;
}
assertEquals(StringUtil.trimEnd(stringList.get(1), "\n"), result);
}