当前位置: 首页>>代码示例>>Java>>正文


Java LookupImpl.getItems方法代码示例

本文整理汇总了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()]);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:CodeInsightTestFixtureImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:DumpLookupElementWeights.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:DumpLookupElementWeights.java

示例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()]);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:CodeInsightTestFixtureImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:CompletionTestBase.java


注:本文中的com.intellij.codeInsight.lookup.impl.LookupImpl.getItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。